@bigmistqke/workpad 0.0.0-stage → 0.18.1
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/LICENSE +21 -0
- package/README.md +781 -2
- package/bin/workpad.ts +1526 -0
- package/dist/_virtual/_@oxc-project_runtime@0.156.0/helpers/esm/taggedTemplateLiteral.js +5 -0
- package/dist/bin/workpad.js +1202 -0
- package/dist/client/runtime.js +1194 -0
- package/dist/define.js +27 -0
- package/dist/plugins/alert/README.md +18 -0
- package/dist/plugins/alert/index.js +40 -0
- package/dist/plugins/alert/public/style.css +40 -0
- package/dist/plugins/ansi/README.md +36 -0
- package/dist/plugins/ansi/index.js +63 -0
- package/dist/plugins/ansi/public/style.css +28 -0
- package/dist/plugins/badge/README.md +32 -0
- package/dist/plugins/badge/index.js +28 -0
- package/dist/plugins/badge/public/style.css +30 -0
- package/dist/plugins/chat/README.md +81 -0
- package/dist/plugins/chat/index.js +96 -0
- package/dist/plugins/chat/public/client.js +3 -0
- package/dist/plugins/chat/public/style.css +143 -0
- package/dist/plugins/claude/README.md +116 -0
- package/dist/plugins/claude/channel.js +130 -0
- package/dist/plugins/claude/doctor.js +316 -0
- package/dist/plugins/claude/index.js +199 -0
- package/dist/plugins/claude/session.js +68 -0
- package/dist/plugins/code/README.md +54 -0
- package/dist/plugins/code/diff.js +75 -0
- package/dist/plugins/code/index.js +105 -0
- package/dist/plugins/code/public/client.js +1 -0
- package/dist/plugins/code/public/style.css +99 -0
- package/dist/plugins/comments/README.md +30 -0
- package/dist/plugins/comments/index.js +39 -0
- package/dist/plugins/comments/public/client.js +24 -0
- package/dist/plugins/comments/public/style.css +224 -0
- package/dist/plugins/details/README.md +24 -0
- package/dist/plugins/details/index.js +28 -0
- package/dist/plugins/details/public/style.css +7 -0
- package/dist/plugins/draft/README.md +14 -0
- package/dist/plugins/draft/index.js +27 -0
- package/dist/plugins/draft/public/style.css +21 -0
- package/dist/plugins/forge/README.md +22 -0
- package/dist/plugins/forge/index.js +83 -0
- package/dist/plugins/form/README.md +126 -0
- package/dist/plugins/form/index.js +179 -0
- package/dist/plugins/form/public/style.css +172 -0
- package/dist/plugins/grid/README.md +45 -0
- package/dist/plugins/grid/index.js +35 -0
- package/dist/plugins/grid/public/style.css +98 -0
- package/dist/plugins/iframe/README.md +18 -0
- package/dist/plugins/iframe/index.js +49 -0
- package/dist/plugins/iframe/public/style.css +28 -0
- package/dist/plugins/index.js +44 -0
- package/dist/plugins/lightbox/README.md +24 -0
- package/dist/plugins/lightbox/index.js +20 -0
- package/dist/plugins/lightbox/public/client.js +4 -0
- package/dist/plugins/lightbox/public/style.css +66 -0
- package/dist/plugins/mermaid/README.md +21 -0
- package/dist/plugins/mermaid/index.js +42 -0
- package/dist/plugins/mermaid/public/style.css +21 -0
- package/dist/plugins/opencode/README.md +48 -0
- package/dist/plugins/opencode/channel.js +92 -0
- package/dist/plugins/opencode/index.js +64 -0
- package/dist/plugins/opencode/shim.js +150 -0
- package/dist/plugins/quiet/README.md +26 -0
- package/dist/plugins/quiet/index.js +23 -0
- package/dist/plugins/tabs/README.md +44 -0
- package/dist/plugins/tabs/index.js +75 -0
- package/dist/plugins/tabs/public/client.js +1 -0
- package/dist/plugins/tabs/public/style.css +98 -0
- package/dist/plugins/terminal/README.md +63 -0
- package/dist/plugins/terminal/host.js +338 -0
- package/dist/plugins/terminal/index.js +170 -0
- package/dist/plugins/terminal/modes.js +32 -0
- package/dist/plugins/terminal/public/client.js +41 -0
- package/dist/plugins/terminal/public/style.css +511 -0
- package/dist/plugins/terminal/server.js +256 -0
- package/dist/plugins/terminal/sizes.js +58 -0
- package/dist/plugins/timeline/README.md +48 -0
- package/dist/plugins/timeline/index.js +83 -0
- package/dist/plugins/timeline/public/style.css +138 -0
- package/dist/plugins/toc/README.md +40 -0
- package/dist/plugins/toc/index.js +29 -0
- package/dist/plugins/toc/public/client.js +1 -0
- package/dist/plugins/toc/public/style.css +117 -0
- package/dist/plugins/window/README.md +51 -0
- package/dist/plugins/window/index.js +91 -0
- package/dist/solid/index.js +41 -0
- package/dist/src/agents.js +81 -0
- package/dist/src/anchors.js +52 -0
- package/dist/src/api.js +282 -0
- package/dist/src/archive.js +49 -0
- package/dist/src/auth.js +67 -0
- package/dist/src/build.js +159 -0
- package/dist/src/client/page/base.css +1762 -0
- package/dist/src/client/page/main.js +2121 -0
- package/dist/src/config.js +76 -0
- package/dist/src/document.js +93 -0
- package/dist/src/entries.js +264 -0
- package/dist/src/events.js +322 -0
- package/dist/src/files.js +47 -0
- package/dist/src/formstate.js +65 -0
- package/dist/src/help.js +213 -0
- package/dist/src/html.js +34 -0
- package/dist/src/hub.js +348 -0
- package/dist/src/icons.js +6 -0
- package/dist/src/listen.js +132 -0
- package/dist/src/listeners.js +64 -0
- package/dist/src/load.js +81 -0
- package/dist/src/loader.js +179 -0
- package/dist/src/migrate.js +314 -0
- package/dist/src/package.js +52 -0
- package/dist/src/pages/blocks.js +67 -0
- package/dist/src/pages/board.js +59 -0
- package/dist/src/pages/index.js +27 -0
- package/dist/src/pages/markdown.js +863 -0
- package/dist/src/pages/render.js +761 -0
- package/dist/src/pages/window.js +29 -0
- package/dist/src/plugins.js +283 -0
- package/dist/src/public.js +24 -0
- package/dist/src/rename.js +130 -0
- package/dist/src/running.js +146 -0
- package/dist/src/serve.js +188 -0
- package/dist/src/server.js +1105 -0
- package/dist/src/site.js +179 -0
- package/dist/src/state.js +155 -0
- package/dist/src/status.js +323 -0
- package/dist/src/thread.js +68 -0
- package/dist/src/watchdog.js +38 -0
- package/dist/src/ws.js +128 -0
- package/package.json +154 -4
- package/plugins/README.md +304 -0
- package/plugins/alert/README.md +18 -0
- package/plugins/alert/index.ts +50 -0
- package/plugins/alert/public/style.css +40 -0
- package/plugins/ansi/README.md +36 -0
- package/plugins/ansi/index.ts +95 -0
- package/plugins/ansi/public/style.css +28 -0
- package/plugins/badge/README.md +32 -0
- package/plugins/badge/index.ts +36 -0
- package/plugins/badge/public/style.css +30 -0
- package/plugins/chat/README.md +81 -0
- package/plugins/chat/autosize.ts +139 -0
- package/plugins/chat/client.tsx +187 -0
- package/plugins/chat/index.ts +146 -0
- package/plugins/chat/public/style.css +143 -0
- package/plugins/claude/README.md +116 -0
- package/plugins/claude/channel.ts +136 -0
- package/plugins/claude/doctor.ts +274 -0
- package/plugins/claude/index.ts +248 -0
- package/plugins/claude/session.ts +70 -0
- package/plugins/code/README.md +54 -0
- package/plugins/code/client.ts +73 -0
- package/plugins/code/diff.ts +96 -0
- package/plugins/code/index.ts +136 -0
- package/plugins/code/public/style.css +99 -0
- package/plugins/comments/README.md +30 -0
- package/plugins/comments/client.ts +723 -0
- package/plugins/comments/index.ts +48 -0
- package/plugins/comments/public/style.css +224 -0
- package/plugins/details/README.md +24 -0
- package/plugins/details/index.ts +30 -0
- package/plugins/details/public/style.css +7 -0
- package/plugins/draft/README.md +14 -0
- package/plugins/draft/index.ts +23 -0
- package/plugins/draft/public/style.css +21 -0
- package/plugins/forge/README.md +22 -0
- package/plugins/forge/index.ts +84 -0
- package/plugins/form/README.md +126 -0
- package/plugins/form/index.ts +199 -0
- package/plugins/form/public/style.css +172 -0
- package/plugins/grid/README.md +45 -0
- package/plugins/grid/index.ts +41 -0
- package/plugins/grid/public/style.css +98 -0
- package/plugins/iframe/README.md +18 -0
- package/plugins/iframe/index.ts +53 -0
- package/plugins/iframe/public/style.css +28 -0
- package/plugins/index.ts +49 -0
- package/plugins/lightbox/README.md +24 -0
- package/plugins/lightbox/client.ts +109 -0
- package/plugins/lightbox/index.ts +25 -0
- package/plugins/lightbox/public/style.css +66 -0
- package/plugins/mermaid/README.md +21 -0
- package/plugins/mermaid/index.ts +46 -0
- package/plugins/mermaid/public/style.css +21 -0
- package/plugins/opencode/README.md +48 -0
- package/plugins/opencode/channel.ts +112 -0
- package/plugins/opencode/index.ts +91 -0
- package/plugins/opencode/shim.ts +166 -0
- package/plugins/quiet/README.md +26 -0
- package/plugins/quiet/index.ts +28 -0
- package/plugins/tabs/README.md +44 -0
- package/plugins/tabs/client.ts +96 -0
- package/plugins/tabs/index.ts +103 -0
- package/plugins/tabs/public/style.css +98 -0
- package/plugins/terminal/README.md +63 -0
- package/plugins/terminal/client.ts +391 -0
- package/plugins/terminal/host.ts +434 -0
- package/plugins/terminal/index.ts +199 -0
- package/plugins/terminal/modes.ts +30 -0
- package/plugins/terminal/public/style.css +225 -0
- package/plugins/terminal/server.ts +266 -0
- package/plugins/terminal/sizes.ts +72 -0
- package/plugins/timeline/README.md +48 -0
- package/plugins/timeline/index.ts +82 -0
- package/plugins/timeline/public/style.css +138 -0
- package/plugins/toc/README.md +40 -0
- package/plugins/toc/client.ts +236 -0
- package/plugins/toc/index.ts +55 -0
- package/plugins/toc/public/style.css +117 -0
- package/plugins/window/README.md +51 -0
- package/plugins/window/index.ts +92 -0
- package/skills/workpad/SKILL.md +592 -0
- package/solid/index.tsx +80 -0
- package/src/agents.ts +134 -0
- package/src/anchors.ts +85 -0
- package/src/api.ts +444 -0
- package/src/archive.ts +75 -0
- package/src/auth.ts +99 -0
- package/src/build.ts +213 -0
- package/src/client/base.ts +19 -0
- package/src/client/forms.ts +420 -0
- package/src/client/markdown.ts +147 -0
- package/src/client/page/base.css +1762 -0
- package/src/client/page/board.ts +166 -0
- package/src/client/page/elsewhere.ts +153 -0
- package/src/client/page/fresh.ts +343 -0
- package/src/client/page/heading-link.ts +32 -0
- package/src/client/page/live.ts +134 -0
- package/src/client/page/main.ts +398 -0
- package/src/client/page/orphans.ts +64 -0
- package/src/client/page/place.ts +260 -0
- package/src/client/page/sort.ts +49 -0
- package/src/client/page/sticky.ts +58 -0
- package/src/client/page/theme.ts +36 -0
- package/src/client/page/view.ts +9 -0
- package/src/client/page/waiting.ts +278 -0
- package/src/client/page/window.ts +40 -0
- package/src/client/reactive.ts +19 -0
- package/src/client/read.ts +111 -0
- package/src/client/runtime.ts +499 -0
- package/src/client/scroll.ts +90 -0
- package/src/client/toast.ts +99 -0
- package/src/config.ts +111 -0
- package/src/define.ts +997 -0
- package/src/document.ts +191 -0
- package/src/entries.ts +352 -0
- package/src/events.ts +463 -0
- package/src/files.ts +74 -0
- package/src/formstate.ts +72 -0
- package/src/help.ts +240 -0
- package/src/html.ts +44 -0
- package/src/hub.ts +435 -0
- package/src/icons.ts +18 -0
- package/src/listen.ts +171 -0
- package/src/listeners.ts +89 -0
- package/src/load.ts +113 -0
- package/src/loader.ts +227 -0
- package/src/migrate.ts +352 -0
- package/src/package.ts +62 -0
- package/src/pages/blocks.ts +106 -0
- package/src/pages/board.ts +89 -0
- package/src/pages/index.ts +79 -0
- package/src/pages/markdown.ts +976 -0
- package/src/pages/render.ts +845 -0
- package/src/pages/window.ts +69 -0
- package/src/plugins.ts +319 -0
- package/src/public.ts +39 -0
- package/src/rename.ts +147 -0
- package/src/running.ts +171 -0
- package/src/serve.ts +221 -0
- package/src/server.ts +1385 -0
- package/src/site.ts +170 -0
- package/src/state.ts +327 -0
- package/src/status.ts +466 -0
- package/src/thread.ts +98 -0
- package/src/watchdog.ts +53 -0
- package/src/ws.ts +155 -0
package/dist/src/hub.js
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { filesFold } from "./pages/render.js";
|
|
2
|
+
import { project } from "./config.js";
|
|
3
|
+
import { followEntries, machineDir, readMachineConfig, stateDir } from "./entries.js";
|
|
4
|
+
import { VERSION, compareVersions } from "./package.js";
|
|
5
|
+
import { API_LISTS, createServer } from "./server.js";
|
|
6
|
+
import { holdStream, listenerOf } from "./listeners.js";
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
// src/hub.ts
|
|
10
|
+
function createHub({ dir = machineDir(), state = stateDir(), home, interval, onShutdown, version = VERSION } = {}) {
|
|
11
|
+
const served = /* @__PURE__ */ new Map();
|
|
12
|
+
let origins = [];
|
|
13
|
+
const allowed = () => origins;
|
|
14
|
+
const entryListens = /* @__PURE__ */ new Set();
|
|
15
|
+
/** An entry listen held on one of its projects, so the project's pages say it listens. */
|
|
16
|
+
function hold(s, el) {
|
|
17
|
+
if (!el.held.has(s)) el.held.set(s, s.server.addListener(el.listener));
|
|
18
|
+
}
|
|
19
|
+
/** Let go of a project (gone, or the listen ended). */
|
|
20
|
+
function release(s, el) {
|
|
21
|
+
el.held.get(s)?.();
|
|
22
|
+
el.held.delete(s);
|
|
23
|
+
}
|
|
24
|
+
const allStreams = /* @__PURE__ */ new Set();
|
|
25
|
+
const followAll = (st) => {
|
|
26
|
+
for (const s of served.values()) if (!st.followed.has(s)) st.followed.set(s, s.server.stream(st.query, st.send));
|
|
27
|
+
for (const [s, stop] of st.followed) if (![...served.values()].includes(s)) {
|
|
28
|
+
stop();
|
|
29
|
+
st.followed.delete(s);
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
function sync(projects) {
|
|
33
|
+
setImmediate(() => touch());
|
|
34
|
+
const wanted = new Map(projects.map((p) => [`${p.base}\n${p.dir}\n${p.files ?? ""}`, p]));
|
|
35
|
+
for (const [key, s] of served) if (!wanted.has(key)) {
|
|
36
|
+
for (const el of entryListens) release(s, el);
|
|
37
|
+
s.server.close();
|
|
38
|
+
served.delete(key);
|
|
39
|
+
console.log(`workpad: ${s.base} is gone (${s.dir})`);
|
|
40
|
+
}
|
|
41
|
+
for (const [key, p] of wanted) {
|
|
42
|
+
if (served.has(key)) continue;
|
|
43
|
+
const project$1 = project(p.dir);
|
|
44
|
+
if (!project$1) continue;
|
|
45
|
+
const server = createServer(project$1, {
|
|
46
|
+
base: p.base,
|
|
47
|
+
entry: p.entry,
|
|
48
|
+
label: [p.group, p.name].filter(Boolean).join(" › "),
|
|
49
|
+
onChange: () => changed(p.base),
|
|
50
|
+
origins: allowed,
|
|
51
|
+
filesDefault: p.files
|
|
52
|
+
});
|
|
53
|
+
const s = {
|
|
54
|
+
...p,
|
|
55
|
+
project: project$1,
|
|
56
|
+
server
|
|
57
|
+
};
|
|
58
|
+
served.set(key, s);
|
|
59
|
+
for (const el of entryListens) if (el.entry === p.entry) hold(s, el);
|
|
60
|
+
console.log(`workpad: ${p.base} → ${p.dir}`);
|
|
61
|
+
}
|
|
62
|
+
for (const el of entryListens) el.tell();
|
|
63
|
+
for (const st of allStreams) followAll(st);
|
|
64
|
+
}
|
|
65
|
+
const overviewDir = path.join(state, "overview");
|
|
66
|
+
fs.mkdirSync(path.join(overviewDir, ".workpad", "pages"), { recursive: true });
|
|
67
|
+
const root = createServer(project(overviewDir), {
|
|
68
|
+
name: "workpad",
|
|
69
|
+
files: false,
|
|
70
|
+
origins: allowed,
|
|
71
|
+
overview: async () => {
|
|
72
|
+
const projects = await Promise.all([...served.values()].map(async (s) => ({
|
|
73
|
+
...await indexOf(s),
|
|
74
|
+
files: await s.server.files().catch(() => false)
|
|
75
|
+
})));
|
|
76
|
+
const boxed = (process.env.WORKPAD_SANDBOX ?? "").split(":").filter(Boolean);
|
|
77
|
+
return {
|
|
78
|
+
projects,
|
|
79
|
+
note: `workpad ${version} · ${boxed.length ? `boxed: ${boxed.join(", ")}` : "not boxed"} · ${dir}/config.json`
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
let touching;
|
|
84
|
+
const changes = /* @__PURE__ */ new Set();
|
|
85
|
+
const touch = () => {
|
|
86
|
+
clearTimeout(touching);
|
|
87
|
+
touching = setTimeout(() => {
|
|
88
|
+
root.touch();
|
|
89
|
+
const from = [...changes];
|
|
90
|
+
changes.clear();
|
|
91
|
+
for (const s of served.values()) if (from.some((b) => b !== s.base)) s.server.elsewhere();
|
|
92
|
+
}, 150);
|
|
93
|
+
};
|
|
94
|
+
const changed = (base) => {
|
|
95
|
+
changes.add(base);
|
|
96
|
+
touch();
|
|
97
|
+
};
|
|
98
|
+
const entries = followEntries(() => {
|
|
99
|
+
const config = readMachineConfig(dir);
|
|
100
|
+
origins = config?.origins ?? [];
|
|
101
|
+
return config;
|
|
102
|
+
}, sync, {
|
|
103
|
+
interval,
|
|
104
|
+
home
|
|
105
|
+
});
|
|
106
|
+
/** The project a path is under: the longest base that is the path or a folder above it. */
|
|
107
|
+
const owner = (p) => {
|
|
108
|
+
let best = null;
|
|
109
|
+
for (const s of served.values()) if ((p === s.base || p.startsWith(s.base + "/")) && (!best || s.base.length > best.base.length)) best = s;
|
|
110
|
+
return best;
|
|
111
|
+
};
|
|
112
|
+
/** A project's pages and what waits on each, as the index and the overview give them. */
|
|
113
|
+
async function indexOf(s) {
|
|
114
|
+
const at = {
|
|
115
|
+
entry: s.entry,
|
|
116
|
+
group: s.group,
|
|
117
|
+
name: s.name,
|
|
118
|
+
label: [s.group, s.name].filter(Boolean).join(" › "),
|
|
119
|
+
dir: s.dir,
|
|
120
|
+
base: s.base
|
|
121
|
+
};
|
|
122
|
+
let statuses;
|
|
123
|
+
try {
|
|
124
|
+
statuses = await s.server.status();
|
|
125
|
+
} catch (err) {
|
|
126
|
+
return {
|
|
127
|
+
...at,
|
|
128
|
+
pages: [],
|
|
129
|
+
active: 0,
|
|
130
|
+
error: err.message
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const pages = statuses.map((p) => ({
|
|
134
|
+
page: p.page,
|
|
135
|
+
title: p.title,
|
|
136
|
+
url: `${s.base}/${p.page.split("/").map(encodeURIComponent).join("/")}`,
|
|
137
|
+
mtime: mtimeOf(p.file),
|
|
138
|
+
open: p.open,
|
|
139
|
+
unread: p.unread.length,
|
|
140
|
+
unreceived: p.unreceived.length
|
|
141
|
+
})).toSorted((a, b) => b.mtime - a.mtime);
|
|
142
|
+
return {
|
|
143
|
+
...at,
|
|
144
|
+
pages,
|
|
145
|
+
active: pages[0]?.mtime ?? 0
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
const index = () => Promise.all([...served.values()].map(indexOf));
|
|
149
|
+
const send = (res, status, body, type = "text/html; charset=utf-8") => {
|
|
150
|
+
res.writeHead(status, {
|
|
151
|
+
"content-type": type,
|
|
152
|
+
"cache-control": "no-store"
|
|
153
|
+
});
|
|
154
|
+
res.end(body);
|
|
155
|
+
};
|
|
156
|
+
const sendJson = (res, status, data) => send(res, status, JSON.stringify(data), "application/json");
|
|
157
|
+
const list = () => [...served.values()].map(({ entry, group, name, dir, base }) => ({
|
|
158
|
+
entry,
|
|
159
|
+
group,
|
|
160
|
+
name,
|
|
161
|
+
dir,
|
|
162
|
+
base
|
|
163
|
+
}));
|
|
164
|
+
function readBody(req) {
|
|
165
|
+
return new Promise((resolve, reject) => {
|
|
166
|
+
let body = "";
|
|
167
|
+
req.setEncoding("utf8");
|
|
168
|
+
req.on("data", (c) => {
|
|
169
|
+
body += c;
|
|
170
|
+
if (body.length > 1e4) req.destroy();
|
|
171
|
+
});
|
|
172
|
+
req.on("end", () => resolve(body));
|
|
173
|
+
req.on("error", reject);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
async function handle(req, res) {
|
|
177
|
+
try {
|
|
178
|
+
const url = new URL((req.url ?? "/").replace(/^\/+/, "/"), "http://localhost");
|
|
179
|
+
const p = decodeURIComponent(url.pathname);
|
|
180
|
+
if (p === "/api/health") {
|
|
181
|
+
if (url.searchParams.has("rescan")) entries.rescan();
|
|
182
|
+
return sendJson(res, 200, {
|
|
183
|
+
ok: true,
|
|
184
|
+
hub: true,
|
|
185
|
+
pid: process.pid,
|
|
186
|
+
version,
|
|
187
|
+
dir,
|
|
188
|
+
projects: list()
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (p === "/api/index") {
|
|
192
|
+
const entry = url.searchParams.get("entry");
|
|
193
|
+
return sendJson(res, 200, (await index()).filter((x) => !entry || x.entry === entry));
|
|
194
|
+
}
|
|
195
|
+
if (p === "/api/shutdown" && req.method === "POST") {
|
|
196
|
+
if (req.headers.origin) return sendJson(res, 403, { error: "not from a browser" });
|
|
197
|
+
let asker = "";
|
|
198
|
+
try {
|
|
199
|
+
asker = String(JSON.parse(await readBody(req)).version ?? "");
|
|
200
|
+
} catch {}
|
|
201
|
+
if (!asker || compareVersions(asker, version) <= 0) return sendJson(res, 409, { error: `workpad ${version} runs here; ${asker || "that"} is not newer` });
|
|
202
|
+
sendJson(res, 200, {
|
|
203
|
+
ok: true,
|
|
204
|
+
version
|
|
205
|
+
});
|
|
206
|
+
setImmediate(() => onShutdown?.());
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (p === "/api/listen" && url.searchParams.has("entry")) return listenEntry(req, res, url.searchParams);
|
|
210
|
+
const what = /^\/api\/(\w+)$/.exec(p)?.[1];
|
|
211
|
+
if (req.method === "GET" && what && API_LISTS.includes(what)) {
|
|
212
|
+
const query = Object.fromEntries(url.searchParams);
|
|
213
|
+
const all = await Promise.all([...served.values()].map((s) => s.server.read(what, query).catch(() => [])));
|
|
214
|
+
return sendJson(res, 200, all.flat());
|
|
215
|
+
}
|
|
216
|
+
if (p === "/api/stream") return streamAll(req, res, Object.fromEntries(url.searchParams));
|
|
217
|
+
if (p === "/api/files") {
|
|
218
|
+
const s = [...served.values()].find((x) => x.base === url.searchParams.get("base"));
|
|
219
|
+
if (!s) return sendJson(res, 404, { error: "no such project" });
|
|
220
|
+
if (!await s.server.files().catch(() => false)) return sendJson(res, 403, { error: "its files are not served" });
|
|
221
|
+
return sendJson(res, 200, await filesFold(s.dir, s.base));
|
|
222
|
+
}
|
|
223
|
+
if (p === "/favicon.ico") {
|
|
224
|
+
res.writeHead(204);
|
|
225
|
+
res.end();
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
const s = owner(p);
|
|
229
|
+
if (s && p === s.base) {
|
|
230
|
+
res.writeHead(302, { location: `${s.base}/${url.search}` });
|
|
231
|
+
res.end();
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
return route(req, p, url).handle(req, res);
|
|
235
|
+
} catch (err) {
|
|
236
|
+
console.error(err);
|
|
237
|
+
send(res, 500, String(err?.stack || err), "text/plain");
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* Whose request this is: a project's (`req.url` made the path within it), or else the overview's.
|
|
242
|
+
*/
|
|
243
|
+
function route(req, p, url) {
|
|
244
|
+
let s = owner(p);
|
|
245
|
+
if (s) {
|
|
246
|
+
req.url = p.slice(s.base.length).split("/").map(encodeURIComponent).join("/") + url.search;
|
|
247
|
+
return s.server;
|
|
248
|
+
}
|
|
249
|
+
const from = req.headers.referer ? new URL(req.headers.referer).pathname : null;
|
|
250
|
+
s = /^\/(api|_)\//.test(p) && from ? owner(decodeURIComponent(from)) : null;
|
|
251
|
+
req.url = s ? (req.url ?? "/").replace(/^\/+/, "/") : req.url;
|
|
252
|
+
return s ? s.server : root;
|
|
253
|
+
}
|
|
254
|
+
/** An upgrade (a page's live channel), routed as a request is. */
|
|
255
|
+
function upgrade(req, conn, head) {
|
|
256
|
+
try {
|
|
257
|
+
const url = new URL((req.url ?? "/").replace(/^\/+/, "/"), "http://localhost");
|
|
258
|
+
route(req, decodeURIComponent(url.pathname), url).upgrade(req, conn, head);
|
|
259
|
+
} catch (err) {
|
|
260
|
+
console.error(err);
|
|
261
|
+
conn.destroy();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* A listen over a whole entry (`workpad listen` without a page in one of its projects): any
|
|
266
|
+
* number run. Each project holds it as a listener, so its pages say who listens; its stream is
|
|
267
|
+
* told the entry's projects, at once and whenever they change. The command itself reads their logs.
|
|
268
|
+
*/
|
|
269
|
+
function listenEntry(req, res, q) {
|
|
270
|
+
const entry = q.get("entry");
|
|
271
|
+
const mine = () => [...served.values()].filter((s) => s.entry === entry);
|
|
272
|
+
const el = {
|
|
273
|
+
entry,
|
|
274
|
+
listener: listenerOf(q),
|
|
275
|
+
held: /* @__PURE__ */ new Map(),
|
|
276
|
+
tell: () => {}
|
|
277
|
+
};
|
|
278
|
+
for (const s of mine()) hold(s, el);
|
|
279
|
+
entryListens.add(el);
|
|
280
|
+
const stream = holdStream(req, res, () => {
|
|
281
|
+
closers.delete(stream.end);
|
|
282
|
+
entryListens.delete(el);
|
|
283
|
+
for (const s of [...el.held.keys()]) release(s, el);
|
|
284
|
+
});
|
|
285
|
+
el.tell = () => stream.send("projects", { projects: mine().map((s) => ({
|
|
286
|
+
dir: s.dir,
|
|
287
|
+
base: s.base
|
|
288
|
+
})) });
|
|
289
|
+
closers.add(stream.end);
|
|
290
|
+
el.tell();
|
|
291
|
+
}
|
|
292
|
+
const closers = /* @__PURE__ */ new Set();
|
|
293
|
+
/** /api/stream across every project: as a project's, each event with its project. */
|
|
294
|
+
function streamAll(req, res, query) {
|
|
295
|
+
res.writeHead(200, {
|
|
296
|
+
"content-type": "text/event-stream",
|
|
297
|
+
"cache-control": "no-store",
|
|
298
|
+
connection: "keep-alive"
|
|
299
|
+
});
|
|
300
|
+
res.write(": streaming\n\n");
|
|
301
|
+
const st = {
|
|
302
|
+
query,
|
|
303
|
+
send: (e) => res.write(`event: event\nid: ${e.id}\ndata: ${JSON.stringify(e)}\n\n`),
|
|
304
|
+
followed: /* @__PURE__ */ new Map()
|
|
305
|
+
};
|
|
306
|
+
allStreams.add(st);
|
|
307
|
+
followAll(st);
|
|
308
|
+
const ping = setInterval(() => res.write(": ping\n\n"), 25e3);
|
|
309
|
+
const end = () => {
|
|
310
|
+
clearInterval(ping);
|
|
311
|
+
allStreams.delete(st);
|
|
312
|
+
for (const stop of st.followed.values()) stop();
|
|
313
|
+
st.followed.clear();
|
|
314
|
+
closers.delete(close);
|
|
315
|
+
};
|
|
316
|
+
const close = () => {
|
|
317
|
+
end();
|
|
318
|
+
res.end();
|
|
319
|
+
};
|
|
320
|
+
closers.add(close);
|
|
321
|
+
req.on("close", end);
|
|
322
|
+
}
|
|
323
|
+
return {
|
|
324
|
+
handle,
|
|
325
|
+
upgrade,
|
|
326
|
+
projects: list,
|
|
327
|
+
rescan() {
|
|
328
|
+
entries.rescan();
|
|
329
|
+
return list();
|
|
330
|
+
},
|
|
331
|
+
close() {
|
|
332
|
+
clearTimeout(touching);
|
|
333
|
+
root.close();
|
|
334
|
+
for (const c of closers) c();
|
|
335
|
+
entries.stop();
|
|
336
|
+
for (const s of served.values()) s.server.close();
|
|
337
|
+
served.clear();
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
const mtimeOf = (file) => {
|
|
342
|
+
try {
|
|
343
|
+
return fs.statSync(file).mtimeMs;
|
|
344
|
+
} catch {
|
|
345
|
+
return 0;
|
|
346
|
+
}
|
|
347
|
+
};
|
|
348
|
+
export { createHub };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// src/icons.ts
|
|
2
|
+
/** An inbox: what awaits the reader (the header's menu, the overview). */
|
|
3
|
+
const INBOX_ICON = "<svg viewBox=\"0 0 16 16\" width=\"13\" height=\"13\" aria-hidden=\"true\"><path d=\"M2 9.5 3.8 3.2A1 1 0 0 1 4.8 2.5h6.4a1 1 0 0 1 1 .7L14 9.5V13a.5.5 0 0 1-.5.5h-11A.5.5 0 0 1 2 13Zm0 0h3.5l1 1.5h3l1-1.5H14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.4\" stroke-linejoin=\"round\"/></svg>";
|
|
4
|
+
/** "Awaiting you: 2 things", and where: what the inbox says to a reader who hovers it. */
|
|
5
|
+
const awaitingLabel = (n, where = "") => `Awaiting you: ${n === 1 ? "1 question or message" : `${n} questions and messages`}${where}`;
|
|
6
|
+
export { INBOX_ICON, awaitingLabel };
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
import https from "node:https";
|
|
3
|
+
// src/listen.ts
|
|
4
|
+
/**
|
|
5
|
+
* A held GET to the server, over http or https as its address says: a server reached at an https
|
|
6
|
+
* URL (a container behind a proxy, see serverUrl) is held the same way, its certificate checked as
|
|
7
|
+
* Node checks any (a private CA: NODE_EXTRA_CA_CERTS).
|
|
8
|
+
*/
|
|
9
|
+
const get = (url, onResponse) => (url.startsWith("https:") ? https : http).get(url, onResponse);
|
|
10
|
+
/**
|
|
11
|
+
* Hold a listener at a server for as long as the process runs, and again after the server restarts.
|
|
12
|
+
* Resolves once the server holds it; with `orNone`, also after a first try that found no server
|
|
13
|
+
* running (a listen reads the log all the same, and registers once one appears).
|
|
14
|
+
*/
|
|
15
|
+
function listen({ at, query, onSnapshot }, { orNone = false } = {}) {
|
|
16
|
+
return new Promise((settled) => {
|
|
17
|
+
const connect = async () => {
|
|
18
|
+
let base = null;
|
|
19
|
+
try {
|
|
20
|
+
base = await at();
|
|
21
|
+
} catch {}
|
|
22
|
+
if (!base) {
|
|
23
|
+
if (orNone) settled();
|
|
24
|
+
return setTimeout(connect, 2e3).unref();
|
|
25
|
+
}
|
|
26
|
+
let again = false;
|
|
27
|
+
const retry = (ms) => {
|
|
28
|
+
if (!again) {
|
|
29
|
+
again = true;
|
|
30
|
+
setTimeout(connect, ms).unref();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
get(`${base}/api/listen?${new URLSearchParams(query)}`, (res) => {
|
|
34
|
+
res.setEncoding("utf8");
|
|
35
|
+
settled();
|
|
36
|
+
res.socket.unref();
|
|
37
|
+
let buf = "";
|
|
38
|
+
res.on("data", (chunk) => {
|
|
39
|
+
buf += chunk;
|
|
40
|
+
let end;
|
|
41
|
+
while ((end = buf.indexOf("\n\n")) >= 0) {
|
|
42
|
+
const block = buf.slice(0, end);
|
|
43
|
+
buf = buf.slice(end + 2);
|
|
44
|
+
const event = /^event: (.*)$/m.exec(block)?.[1];
|
|
45
|
+
const data = /^data: (.*)$/m.exec(block)?.[1];
|
|
46
|
+
if (event === "projects" && data && onSnapshot) onSnapshot(JSON.parse(data));
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
res.on("close", () => retry(1e3));
|
|
50
|
+
}).on("error", () => retry(2e3));
|
|
51
|
+
};
|
|
52
|
+
connect();
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* A listen over the projects a server names: `start` is called once for each project as it appears,
|
|
57
|
+
* to hand out from its log; a project no longer named is stopped (`signal`).
|
|
58
|
+
* @returns what takes each snapshot the server sends
|
|
59
|
+
*/
|
|
60
|
+
function everyProject(start) {
|
|
61
|
+
const followed = /* @__PURE__ */ new Map();
|
|
62
|
+
return ({ projects }) => {
|
|
63
|
+
for (const p of projects) {
|
|
64
|
+
if (followed.has(p.dir)) continue;
|
|
65
|
+
const stop = new AbortController();
|
|
66
|
+
followed.set(p.dir, stop);
|
|
67
|
+
start(p, stop.signal);
|
|
68
|
+
}
|
|
69
|
+
for (const [dir, stop] of followed) if (!projects.some((p) => p.dir === dir)) {
|
|
70
|
+
stop.abort();
|
|
71
|
+
followed.delete(dir);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Hold an agent channel's line at the server (/api/channel) for as long as the process runs, and
|
|
77
|
+
* again after the server restarts, then saying it was confirmed: the server forgets that. `move`:
|
|
78
|
+
* the session it serves changed (a resume); it was confirmed for the process, not the session, so
|
|
79
|
+
* that stays.
|
|
80
|
+
*/
|
|
81
|
+
function holdChannel(at, first, { onPing, onConfirmed }) {
|
|
82
|
+
const id = Math.random().toString(36).slice(2) + Date.now().toString(36);
|
|
83
|
+
let session = first;
|
|
84
|
+
let confirmed = false;
|
|
85
|
+
let current = null;
|
|
86
|
+
const connect = async () => {
|
|
87
|
+
let base = null;
|
|
88
|
+
try {
|
|
89
|
+
base = await at();
|
|
90
|
+
} catch {}
|
|
91
|
+
if (!base) return void setTimeout(connect, 2e3).unref();
|
|
92
|
+
let again = false;
|
|
93
|
+
const retry = (ms) => {
|
|
94
|
+
if (again) return;
|
|
95
|
+
again = true;
|
|
96
|
+
setTimeout(connect, ms).unref();
|
|
97
|
+
};
|
|
98
|
+
const query = new URLSearchParams({
|
|
99
|
+
id,
|
|
100
|
+
session,
|
|
101
|
+
...confirmed && { confirmed: "1" }
|
|
102
|
+
});
|
|
103
|
+
(current = get(`${base}/api/channel?${query}`, (res) => {
|
|
104
|
+
res.setEncoding("utf8");
|
|
105
|
+
res.socket.unref();
|
|
106
|
+
let buf = "";
|
|
107
|
+
res.on("data", (chunk) => {
|
|
108
|
+
buf += chunk;
|
|
109
|
+
let end;
|
|
110
|
+
while ((end = buf.indexOf("\n\n")) >= 0) {
|
|
111
|
+
const block = buf.slice(0, end);
|
|
112
|
+
buf = buf.slice(end + 2);
|
|
113
|
+
const event = /^event: (.*)$/m.exec(block)?.[1];
|
|
114
|
+
const data = /^data: (.*)$/m.exec(block)?.[1];
|
|
115
|
+
if (event === "ping" && data) onPing(JSON.parse(data).code);
|
|
116
|
+
if (event === "confirmed" && !confirmed) {
|
|
117
|
+
confirmed = true;
|
|
118
|
+
onConfirmed();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
res.on("close", () => retry(1e3));
|
|
123
|
+
})).on("error", () => retry(2e3));
|
|
124
|
+
};
|
|
125
|
+
connect();
|
|
126
|
+
return { move(next) {
|
|
127
|
+
if (next === session) return;
|
|
128
|
+
session = next;
|
|
129
|
+
current?.destroy();
|
|
130
|
+
} };
|
|
131
|
+
}
|
|
132
|
+
export { everyProject, holdChannel, listen };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { covers } from "./status.js";
|
|
2
|
+
// src/listeners.ts
|
|
3
|
+
function createRegistry() {
|
|
4
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
5
|
+
const watchers = /* @__PURE__ */ new Set();
|
|
6
|
+
const changed = () => {
|
|
7
|
+
for (const fn of watchers) fn();
|
|
8
|
+
};
|
|
9
|
+
return {
|
|
10
|
+
list: (page = null) => [...listeners].filter((l) => page == null || covers(l, page)).map(({ page, type, agent }) => ({
|
|
11
|
+
page,
|
|
12
|
+
type,
|
|
13
|
+
agent
|
|
14
|
+
})),
|
|
15
|
+
add(l) {
|
|
16
|
+
listeners.add(l);
|
|
17
|
+
changed();
|
|
18
|
+
return () => {
|
|
19
|
+
if (listeners.delete(l)) changed();
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
onChange(fn) {
|
|
23
|
+
watchers.add(fn);
|
|
24
|
+
return () => watchers.delete(fn);
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/** The listener a /api/listen request asks for. */
|
|
29
|
+
const listenerOf = (q) => ({
|
|
30
|
+
page: q.get("page") || "",
|
|
31
|
+
type: q.get("type") || null,
|
|
32
|
+
agent: q.get("agent") || null
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* Hold a /api/listen connection open as an event stream (with a ping, so nothing between closes it
|
|
36
|
+
* as idle). `send` writes an event on it; `onEnd` runs once, when the agent goes or `end` is called.
|
|
37
|
+
*/
|
|
38
|
+
function holdStream(req, res, onEnd) {
|
|
39
|
+
res.writeHead(200, {
|
|
40
|
+
"content-type": "text/event-stream",
|
|
41
|
+
"cache-control": "no-store",
|
|
42
|
+
connection: "keep-alive"
|
|
43
|
+
});
|
|
44
|
+
res.write(": listening\n\n");
|
|
45
|
+
const ping = setInterval(() => res.write(": ping\n\n"), 25e3);
|
|
46
|
+
let ended = false;
|
|
47
|
+
const finish = () => {
|
|
48
|
+
if (ended) return;
|
|
49
|
+
ended = true;
|
|
50
|
+
clearInterval(ping);
|
|
51
|
+
onEnd();
|
|
52
|
+
};
|
|
53
|
+
req.on("close", finish);
|
|
54
|
+
return {
|
|
55
|
+
send(event, data) {
|
|
56
|
+
if (!ended) res.write(`event: ${event}\ndata: ${JSON.stringify(data)}\n\n`);
|
|
57
|
+
},
|
|
58
|
+
end() {
|
|
59
|
+
finish();
|
|
60
|
+
res.end();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export { createRegistry, holdStream, listenerOf };
|
package/dist/src/load.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { FROM_SOURCE, PACKAGE_DIR } from "./package.js";
|
|
2
|
+
import { registerHooks } from "node:module";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { pathToFileURL } from "node:url";
|
|
6
|
+
// src/load.ts
|
|
7
|
+
const ENGINE_DIR = PACKAGE_DIR;
|
|
8
|
+
const PACKAGE = "@bigmistqke/workpad";
|
|
9
|
+
/** The package's `exports`, read afresh; undefined when its package.json can't be read. */
|
|
10
|
+
function ownExports() {
|
|
11
|
+
try {
|
|
12
|
+
return JSON.parse(fs.readFileSync(path.join(ENGINE_DIR, "package.json"), "utf8")).exports;
|
|
13
|
+
} catch {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
/** The file `@bigmistqke/workpad` or one of its parts is, by the package's `exports`; null for none. */
|
|
18
|
+
function ownFile(specifier) {
|
|
19
|
+
if (specifier !== PACKAGE && !specifier.startsWith(PACKAGE + "/")) return null;
|
|
20
|
+
const target = ownExports()?.[specifier === PACKAGE ? "." : `./${specifier.slice(20)}`];
|
|
21
|
+
const file = typeof target === "string" ? target : FROM_SOURCE && target?.source || target?.default;
|
|
22
|
+
return file ? path.join(ENGINE_DIR, file) : null;
|
|
23
|
+
}
|
|
24
|
+
const versionOf = (url) => new URL(url).searchParams.get("wp-v");
|
|
25
|
+
/**
|
|
26
|
+
* Install the hooks, once: the first time something loads a config or the package's own parts, not
|
|
27
|
+
* on import, so a command that loads nothing leaves the process's module loading alone.
|
|
28
|
+
*/
|
|
29
|
+
let installed = false;
|
|
30
|
+
function installHooks() {
|
|
31
|
+
if (installed) return;
|
|
32
|
+
installed = true;
|
|
33
|
+
registerHooks({ resolve(specifier, context, next) {
|
|
34
|
+
const own = ownFile(specifier);
|
|
35
|
+
if (own) {
|
|
36
|
+
const url = pathToFileURL(own).href;
|
|
37
|
+
const v = context.parentURL && versionOf(context.parentURL);
|
|
38
|
+
return {
|
|
39
|
+
url: v ? `${url}?wp-v=${v}` : url,
|
|
40
|
+
shortCircuit: true,
|
|
41
|
+
format: moduleFormat(own) ?? "module"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const exports = specifier.startsWith(PACKAGE + "/") && ownExports();
|
|
45
|
+
if (exports) throw new Error(`${PACKAGE} has no part "${specifier.slice(20)}"; its parts: ${Object.keys(exports).filter((k) => k !== "." && !k.endsWith(".json")).map((k) => k.slice(2)).join(", ")}`);
|
|
46
|
+
const resolved = next(specifier, context);
|
|
47
|
+
if (!resolved.url.startsWith("file:") || resolved.url.includes("/node_modules/")) return resolved;
|
|
48
|
+
const v = versionOf(resolved.url) ?? (context.parentURL?.startsWith("file:") && versionOf(context.parentURL));
|
|
49
|
+
if (!v) return resolved;
|
|
50
|
+
const url = new URL(resolved.url);
|
|
51
|
+
url.searchParams.set("wp-v", v);
|
|
52
|
+
const inProject = url.pathname.split("/").includes(".workpad");
|
|
53
|
+
return {
|
|
54
|
+
...resolved,
|
|
55
|
+
url: url.href,
|
|
56
|
+
format: inProject ? moduleFormat(url.pathname) : resolved.format ?? moduleFormat(url.pathname)
|
|
57
|
+
};
|
|
58
|
+
} });
|
|
59
|
+
}
|
|
60
|
+
function moduleFormat(file) {
|
|
61
|
+
if (/\.[mc]?ts$/.test(file)) return file.endsWith(".cts") ? "commonjs-typescript" : "module-typescript";
|
|
62
|
+
if (/\.c?js$/.test(file)) return file.endsWith(".cjs") ? "commonjs" : "module";
|
|
63
|
+
}
|
|
64
|
+
let version = 0;
|
|
65
|
+
/**
|
|
66
|
+
* Import one of the package's own parts (`plugins`) afresh, with everything it imports, the way
|
|
67
|
+
* `importFresh` does a config: for what the core loads itself on a config's behalf, such as the
|
|
68
|
+
* built-in plugins, which must reload along with the config.
|
|
69
|
+
*/
|
|
70
|
+
function importOwn(part) {
|
|
71
|
+
installHooks();
|
|
72
|
+
const file = ownFile(`${PACKAGE}/${part}`);
|
|
73
|
+
if (!file) throw new Error(`the package has no part "${part}"`);
|
|
74
|
+
return import(`${pathToFileURL(file).href}?wp-v=${++version}`);
|
|
75
|
+
}
|
|
76
|
+
/** Import `file` and everything local it imports afresh. */
|
|
77
|
+
function importFresh(file) {
|
|
78
|
+
installHooks();
|
|
79
|
+
return import(`${pathToFileURL(file).href}?wp-v=${++version}`);
|
|
80
|
+
}
|
|
81
|
+
export { importFresh, importOwn, installHooks };
|