@pablopunk/webr 0.1.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 +661 -0
- package/README.md +17 -0
- package/bin/webr.mjs +11 -0
- package/dist/client/_astro/App.BxlQhLhN.css +1 -0
- package/dist/client/_astro/App.CzxEZ_Dw.js +2 -0
- package/dist/client/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CTgtIFyY.js +1 -0
- package/dist/client/_astro/addon-fit.jgKqzwky.js +1 -0
- package/dist/client/_astro/addon-web-links.C9lyQRxI.js +1 -0
- package/dist/client/_astro/client.BDkzSRUN.js +1 -0
- package/dist/client/_astro/client.Bbg9OBwT.js +1 -0
- package/dist/client/_astro/client.CLSsMr2g.js +9 -0
- package/dist/client/_astro/jetbrains-mono.CFJaiWaY.woff2 +0 -0
- package/dist/client/_astro/symbols-nerd.CEdkKAK8.woff2 +0 -0
- package/dist/client/_astro/xterm.B-l5AIf6.js +7 -0
- package/dist/client/apple-touch-icon.png +0 -0
- package/dist/client/brand-mark.png +0 -0
- package/dist/client/favicon-16.png +0 -0
- package/dist/client/favicon-32.png +0 -0
- package/dist/client/favicon.ico +0 -0
- package/dist/client/icon-192.png +0 -0
- package/dist/client/icon-512.png +0 -0
- package/dist/client/icon-maskable-512.png +0 -0
- package/dist/client/manifest.webmanifest +30 -0
- package/dist/server/chunks/App_BmsGAwGf.mjs +4314 -0
- package/dist/server/chunks/_id__u0ueX6GO.mjs +34 -0
- package/dist/server/chunks/_tab__DL6wyr-j.mjs +35 -0
- package/dist/server/chunks/_virtual_astro_server-island-manifest_C1Q2srgE.mjs +5 -0
- package/dist/server/chunks/_virtual_astro_session-driver_DS5V7T-N.mjs +6 -0
- package/dist/server/chunks/compiler_CpXox_xS.mjs +35 -0
- package/dist/server/chunks/console_CucE1SwS.mjs +170 -0
- package/dist/server/chunks/errors_BgIp4W2B.mjs +383 -0
- package/dist/server/chunks/index_DyyPce_k.mjs +22 -0
- package/dist/server/chunks/new_G7XChx5p.mjs +33 -0
- package/dist/server/chunks/node_BlixNyYV.mjs +1816 -0
- package/dist/server/chunks/noop-entrypoint_Z3zFhrGC.mjs +4 -0
- package/dist/server/chunks/remote_BxuVLM0r.mjs +169 -0
- package/dist/server/chunks/server_DS45LC4q.mjs +2496 -0
- package/dist/server/chunks/settings_DLV2Js3e.mjs +31 -0
- package/dist/server/chunks/sharp_CgNvPCpY.mjs +152 -0
- package/dist/server/chunks/vnode-children_CRmaSs5G.mjs +24 -0
- package/dist/server/entry.mjs +5837 -0
- package/dist/server/virtual_astro_middleware.mjs +4 -0
- package/drizzle/0000_gateway.sql +13 -0
- package/drizzle/0001_device_sessions.sql +9 -0
- package/drizzle/0002_audit_events.sql +7 -0
- package/drizzle/meta/_journal.json +1 -0
- package/package.json +88 -0
- package/server/cli.ts +93 -0
- package/server/command.ts +9 -0
- package/server/entry.ts +3 -0
- package/server/herdr-check.ts +37 -0
- package/server/home.ts +4 -0
- package/server/log-file.ts +52 -0
- package/server/package-info.ts +6 -0
- package/server/plugin/config.ts +14 -0
- package/server/plugin/dev.ts +27 -0
- package/server/plugin/files.ts +10 -0
- package/server/plugin/herdr.ts +33 -0
- package/server/plugin/index.ts +68 -0
- package/server/plugin/probe.ts +17 -0
- package/server/plugin/stop.ts +39 -0
- package/server/port.ts +8 -0
- package/server/run.ts +35 -0
- package/server/ssr.ts +23 -0
- package/server/start.ts +5 -0
- package/server/update/hint.ts +26 -0
- package/server/update/index.ts +33 -0
- package/server/update/latest.ts +33 -0
- package/server/update/package-manager.ts +24 -0
- package/server/update/versions.ts +15 -0
- package/src/lib/avatars.ts +15 -0
- package/src/lib/launch.ts +16 -0
- package/src/lib/machines.ts +41 -0
- package/src/lib/mock-store.ts +82 -0
- package/src/lib/models.ts +139 -0
- package/src/lib/project-icons.ts +120 -0
- package/src/lib/terminal-split.ts +23 -0
- package/src/lib/uuid.ts +10 -0
- package/src/server/auth/access.ts +22 -0
- package/src/server/auth/audit.ts +15 -0
- package/src/server/auth/auth.ts +134 -0
- package/src/server/auth/pair-page.ts +85 -0
- package/src/server/auth/pairing.ts +91 -0
- package/src/server/auth/presence.ts +8 -0
- package/src/server/auth/sessions.ts +48 -0
- package/src/server/directories.ts +21 -0
- package/src/server/dist.ts +3 -0
- package/src/server/host.ts +166 -0
- package/src/server/perf-log.ts +23 -0
- package/src/server/protocol/deadlines.ts +24 -0
- package/src/server/protocol/native.ts +10 -0
- package/src/server/protocol/ndjson.ts +22 -0
- package/src/server/protocol/socket.ts +81 -0
- package/src/server/protocol/validate.ts +17 -0
- package/src/server/public-urls.ts +17 -0
- package/src/server/runtime/herdr-actions.ts +122 -0
- package/src/server/runtime/launch.ts +55 -0
- package/src/server/runtime/manager.ts +187 -0
- package/src/server/runtime/reconcile.ts +51 -0
- package/src/server/runtime/supervisor.ts +92 -0
- package/src/server/runtime/target.ts +37 -0
- package/src/server/runtime/workspace.ts +24 -0
- package/src/server/storage/database.ts +88 -0
- package/src/server/storage/drizzle-node-sqlite.ts +18 -0
- package/src/server/storage/node-sqlite-client.ts +44 -0
- package/src/server/storage/schema.ts +25 -0
- package/src/server/tailscale-host.ts +17 -0
- package/src/server/terminal/cli.ts +44 -0
- package/src/server/terminal/hub.ts +140 -0
- package/src/server/terminal/writer.ts +38 -0
- package/src/server/transport/herdr-target.ts +148 -0
- package/src/server/transport/icons.ts +65 -0
- package/src/server/transport/identity.ts +5 -0
- package/src/server/transport/local-session.ts +65 -0
- package/src/server/transport/model-discovery.ts +18 -0
- package/src/server/transport/native-locations.ts +17 -0
- package/src/server/transport/process.ts +21 -0
- package/src/server/transport/registry.ts +27 -0
- package/src/server/transport/ssh.ts +47 -0
- package/src/server/uploads.ts +40 -0
- package/src/server/websockets.ts +62 -0
- package/src/shared/agent-kinds.ts +4 -0
- package/src/shared/frame.ts +38 -0
- package/src/shared/projects.ts +1 -0
- package/src/shared/retry.ts +1 -0
- package/src/shared/runtime.ts +33 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
//#region node_modules/.pnpm/@astrojs+internal-helpers@0.11.0/node_modules/@astrojs/internal-helpers/dist/path.js
|
|
2
|
+
function appendForwardSlash(path) {
|
|
3
|
+
return path.endsWith("/") ? path : path + "/";
|
|
4
|
+
}
|
|
5
|
+
function prependForwardSlash(path) {
|
|
6
|
+
return path[0] === "/" ? path : "/" + path;
|
|
7
|
+
}
|
|
8
|
+
var MANY_LEADING_SLASHES = /^\/{2,}/;
|
|
9
|
+
function collapseDuplicateLeadingSlashes(path) {
|
|
10
|
+
if (!path) return path;
|
|
11
|
+
return path.replace(MANY_LEADING_SLASHES, "/");
|
|
12
|
+
}
|
|
13
|
+
var MANY_SLASHES = /\/{2,}/g;
|
|
14
|
+
function collapseDuplicateSlashes(path) {
|
|
15
|
+
if (!path) return path;
|
|
16
|
+
return path.replace(MANY_SLASHES, "/");
|
|
17
|
+
}
|
|
18
|
+
var MANY_TRAILING_SLASHES = /\/{2,}$/g;
|
|
19
|
+
function collapseDuplicateTrailingSlashes(path, trailingSlash) {
|
|
20
|
+
if (!path) return path;
|
|
21
|
+
return path.replace(MANY_TRAILING_SLASHES, trailingSlash ? "/" : "") || "/";
|
|
22
|
+
}
|
|
23
|
+
function removeTrailingForwardSlash(path) {
|
|
24
|
+
return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
|
|
25
|
+
}
|
|
26
|
+
function removeLeadingForwardSlash(path) {
|
|
27
|
+
return path.startsWith("/") ? path.substring(1) : path;
|
|
28
|
+
}
|
|
29
|
+
function trimSlashes(path) {
|
|
30
|
+
return path.replace(/^\/|\/$/g, "");
|
|
31
|
+
}
|
|
32
|
+
function isString(path) {
|
|
33
|
+
return typeof path === "string" || path instanceof String;
|
|
34
|
+
}
|
|
35
|
+
var INTERNAL_PREFIXES = /* @__PURE__ */ new Set([
|
|
36
|
+
"/_",
|
|
37
|
+
"/@",
|
|
38
|
+
"/.",
|
|
39
|
+
"//"
|
|
40
|
+
]);
|
|
41
|
+
var JUST_SLASHES = /^\/{2,}$/;
|
|
42
|
+
function isInternalPath(path) {
|
|
43
|
+
const prefix = path.slice(0, 2).replace(/\\/g, "/");
|
|
44
|
+
return INTERNAL_PREFIXES.has(prefix) && !JUST_SLASHES.test(path);
|
|
45
|
+
}
|
|
46
|
+
function joinPaths(...paths) {
|
|
47
|
+
return paths.filter(isString).map((path, i) => {
|
|
48
|
+
if (i === 0) return removeTrailingForwardSlash(path);
|
|
49
|
+
else if (i === paths.length - 1) return removeLeadingForwardSlash(path);
|
|
50
|
+
else return trimSlashes(path);
|
|
51
|
+
}).join("/");
|
|
52
|
+
}
|
|
53
|
+
function removeQueryString(path) {
|
|
54
|
+
const index = path.lastIndexOf("?");
|
|
55
|
+
return index > 0 ? path.substring(0, index) : path;
|
|
56
|
+
}
|
|
57
|
+
function isRemotePath(src) {
|
|
58
|
+
if (!src) return false;
|
|
59
|
+
const trimmed = src.trim();
|
|
60
|
+
if (!trimmed) return false;
|
|
61
|
+
let decoded = trimmed;
|
|
62
|
+
let previousDecoded = "";
|
|
63
|
+
let maxIterations = 10;
|
|
64
|
+
while (decoded !== previousDecoded && maxIterations > 0) {
|
|
65
|
+
previousDecoded = decoded;
|
|
66
|
+
try {
|
|
67
|
+
decoded = decodeURIComponent(decoded);
|
|
68
|
+
} catch {
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
maxIterations--;
|
|
72
|
+
}
|
|
73
|
+
if (/^[a-zA-Z]:/.test(decoded)) return false;
|
|
74
|
+
if (decoded[0] === "/" && /^\/[\w.@-]/.test(decoded)) return false;
|
|
75
|
+
if (decoded[0] === "\\") return true;
|
|
76
|
+
if (decoded.startsWith("//")) return true;
|
|
77
|
+
try {
|
|
78
|
+
const url = new URL(decoded, "http://n");
|
|
79
|
+
if (url.username || url.password) return true;
|
|
80
|
+
if (decoded.includes("@") && !url.pathname.includes("@") && !url.search.includes("@")) return true;
|
|
81
|
+
if (url.origin !== "http://n") {
|
|
82
|
+
if (url.protocol.toLowerCase() === "file:") return false;
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
if (URL.canParse(decoded)) return true;
|
|
86
|
+
return false;
|
|
87
|
+
} catch {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
function isParentDirectory(parentPath, childPath) {
|
|
92
|
+
if (!parentPath || !childPath) return false;
|
|
93
|
+
if (parentPath.includes("://") || childPath.includes("://")) return false;
|
|
94
|
+
if (isRemotePath(parentPath) || isRemotePath(childPath)) return false;
|
|
95
|
+
if (parentPath.includes("..") || childPath.includes("..")) return false;
|
|
96
|
+
if (parentPath.includes("\0") || childPath.includes("\0")) return false;
|
|
97
|
+
const normalizedParent = appendForwardSlash(slash(parentPath).toLowerCase());
|
|
98
|
+
const normalizedChild = slash(childPath).toLowerCase();
|
|
99
|
+
if (normalizedParent === normalizedChild || normalizedParent === normalizedChild + "/") return false;
|
|
100
|
+
return normalizedChild.startsWith(normalizedParent);
|
|
101
|
+
}
|
|
102
|
+
function slash(path) {
|
|
103
|
+
return path.replace(/\\/g, "/");
|
|
104
|
+
}
|
|
105
|
+
function fileExtension(path) {
|
|
106
|
+
const ext = path.split(".").pop();
|
|
107
|
+
return ext !== path ? `.${ext}` : "";
|
|
108
|
+
}
|
|
109
|
+
function stripRequestBase(pathname, base) {
|
|
110
|
+
pathname = collapseDuplicateLeadingSlashes(pathname);
|
|
111
|
+
const baseWithoutTrailingSlash = removeTrailingForwardSlash(base);
|
|
112
|
+
if (pathname === baseWithoutTrailingSlash) return "/";
|
|
113
|
+
if (pathname.startsWith(baseWithoutTrailingSlash + "/")) return pathname.slice(baseWithoutTrailingSlash.length);
|
|
114
|
+
return pathname;
|
|
115
|
+
}
|
|
116
|
+
var WITH_FILE_EXT = /\/[^/]+\.\w+$/;
|
|
117
|
+
function hasFileExtension(path) {
|
|
118
|
+
return WITH_FILE_EXT.test(path);
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region node_modules/.pnpm/@astrojs+internal-helpers@0.11.0/node_modules/@astrojs/internal-helpers/dist/remote.js
|
|
122
|
+
function matchPattern(url, remotePattern) {
|
|
123
|
+
return matchProtocol(url, remotePattern.protocol) && matchHostname(url, remotePattern.hostname, true) && matchPort(url, remotePattern.port) && matchPathname(url, remotePattern.pathname, true);
|
|
124
|
+
}
|
|
125
|
+
function matchPort(url, port) {
|
|
126
|
+
return !port || port === url.port;
|
|
127
|
+
}
|
|
128
|
+
function matchProtocol(url, protocol) {
|
|
129
|
+
return !protocol || protocol === url.protocol.slice(0, -1);
|
|
130
|
+
}
|
|
131
|
+
function matchHostname(url, hostname, allowWildcard = false) {
|
|
132
|
+
if (!hostname) return true;
|
|
133
|
+
else if (!allowWildcard || !hostname.startsWith("*")) return hostname === url.hostname;
|
|
134
|
+
else if (hostname.startsWith("**.")) {
|
|
135
|
+
const slicedHostname = hostname.slice(2);
|
|
136
|
+
return slicedHostname !== url.hostname && url.hostname.endsWith(slicedHostname);
|
|
137
|
+
} else if (hostname.startsWith("*.")) {
|
|
138
|
+
const slicedHostname = hostname.slice(1);
|
|
139
|
+
if (!url.hostname.endsWith(slicedHostname)) return false;
|
|
140
|
+
const subdomainWithDot = url.hostname.slice(0, -(slicedHostname.length - 1));
|
|
141
|
+
return subdomainWithDot.endsWith(".") && !subdomainWithDot.slice(0, -1).includes(".");
|
|
142
|
+
}
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
function matchPathname(url, pathname, allowWildcard = false) {
|
|
146
|
+
if (!pathname) return true;
|
|
147
|
+
else if (!allowWildcard || !pathname.endsWith("*")) return pathname === url.pathname;
|
|
148
|
+
else if (pathname.endsWith("/**")) {
|
|
149
|
+
const slicedPathname = pathname.slice(0, -2);
|
|
150
|
+
return slicedPathname !== url.pathname && url.pathname.startsWith(slicedPathname);
|
|
151
|
+
} else if (pathname.endsWith("/*")) {
|
|
152
|
+
const slicedPathname = pathname.slice(0, -1);
|
|
153
|
+
if (!url.pathname.startsWith(slicedPathname)) return false;
|
|
154
|
+
return url.pathname.slice(slicedPathname.length).split("/").filter(Boolean).length === 1;
|
|
155
|
+
}
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
function isRemoteAllowed(src, { domains, remotePatterns }) {
|
|
159
|
+
if (!URL.canParse(src)) return false;
|
|
160
|
+
const url = new URL(src);
|
|
161
|
+
if (![
|
|
162
|
+
"http:",
|
|
163
|
+
"https:",
|
|
164
|
+
"data:"
|
|
165
|
+
].includes(url.protocol)) return false;
|
|
166
|
+
return domains.some((domain) => matchHostname(url, domain)) || remotePatterns.some((remotePattern) => matchPattern(url, remotePattern));
|
|
167
|
+
}
|
|
168
|
+
//#endregion
|
|
169
|
+
export { slash as _, collapseDuplicateSlashes as a, hasFileExtension as c, isRemotePath as d, joinPaths as f, removeTrailingForwardSlash as g, removeQueryString as h, collapseDuplicateLeadingSlashes as i, isInternalPath as l, removeLeadingForwardSlash as m, matchPattern as n, collapseDuplicateTrailingSlashes as o, prependForwardSlash as p, appendForwardSlash as r, fileExtension as s, isRemoteAllowed as t, isParentDirectory as u, stripRequestBase as v, trimSlashes as y };
|