@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,31 @@
|
|
|
1
|
+
import { R as __exportAll, S as createAstro, i as renderComponent, u as renderTemplate } from "./server_DS45LC4q.mjs";
|
|
2
|
+
import { t as createComponent } from "./compiler_CpXox_xS.mjs";
|
|
3
|
+
import { n as $$Base, t as App } from "./App_BmsGAwGf.mjs";
|
|
4
|
+
//#region src/pages/settings.astro
|
|
5
|
+
var settings_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
default: () => $$Settings,
|
|
7
|
+
file: () => $$file,
|
|
8
|
+
url: () => $$url
|
|
9
|
+
});
|
|
10
|
+
createAstro("https://astro.build");
|
|
11
|
+
var $$Settings = createComponent(($$result, $$props, $$slots) => {
|
|
12
|
+
const Astro = $$result.createAstro($$props, $$slots);
|
|
13
|
+
Astro.self = $$Settings;
|
|
14
|
+
const bootstrap = Astro.locals.runtime.bootstrap();
|
|
15
|
+
return renderTemplate`${renderComponent($$result, "Base", $$Base, { "title": "Settings" }, { "default": ($$result) => renderTemplate`${renderComponent($$result, "App", App, {
|
|
16
|
+
"page": "settings",
|
|
17
|
+
"bootstrap": bootstrap,
|
|
18
|
+
"client:load": true,
|
|
19
|
+
"data-astro-transition-persist": "webr-app",
|
|
20
|
+
"client:component-hydration": "load",
|
|
21
|
+
"client:component-path": "/Users/pablopunk/src/herdr-web/src/components/App.tsx",
|
|
22
|
+
"client:component-export": "default"
|
|
23
|
+
})}` })}`;
|
|
24
|
+
}, "/Users/pablopunk/src/herdr-web/src/pages/settings.astro", void 0);
|
|
25
|
+
var $$file = "/Users/pablopunk/src/herdr-web/src/pages/settings.astro";
|
|
26
|
+
var $$url = "/settings";
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region \0virtual:astro:page:src/pages/settings@_@astro
|
|
29
|
+
var page = () => settings_exports;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { page };
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { $ as UnsupportedImageFormat, F as NoImageMetadata, N as MissingSharp, t as AstroError } from "./errors_BgIp4W2B.mjs";
|
|
2
|
+
import { a as resolveDefaultOutputFormat, i as detector, n as baseService, r as parseQuality } from "./node_BlixNyYV.mjs";
|
|
3
|
+
//#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/services/sharp.js
|
|
4
|
+
var sharp;
|
|
5
|
+
var qualityTable = {
|
|
6
|
+
low: 25,
|
|
7
|
+
mid: 50,
|
|
8
|
+
high: 80,
|
|
9
|
+
max: 100
|
|
10
|
+
};
|
|
11
|
+
function resolveSharpQuality(quality) {
|
|
12
|
+
if (!quality) return void 0;
|
|
13
|
+
const parsedQuality = parseQuality(quality);
|
|
14
|
+
if (typeof parsedQuality === "number") return parsedQuality;
|
|
15
|
+
return quality in qualityTable ? qualityTable[quality] : void 0;
|
|
16
|
+
}
|
|
17
|
+
function resolveSharpEncoderOptions(transform, inputFormat, serviceConfig = {}) {
|
|
18
|
+
const quality = resolveSharpQuality(transform.quality);
|
|
19
|
+
if (transform.format === void 0) return quality === void 0 ? void 0 : { quality };
|
|
20
|
+
switch (transform.format) {
|
|
21
|
+
case "jpg":
|
|
22
|
+
case "jpeg": return {
|
|
23
|
+
...serviceConfig.jpeg,
|
|
24
|
+
...quality === void 0 ? {} : { quality }
|
|
25
|
+
};
|
|
26
|
+
case "png": return {
|
|
27
|
+
...serviceConfig.png,
|
|
28
|
+
...quality === void 0 ? {} : { quality }
|
|
29
|
+
};
|
|
30
|
+
case "webp": {
|
|
31
|
+
const webpOptions = {
|
|
32
|
+
...serviceConfig.webp,
|
|
33
|
+
...quality === void 0 ? {} : { quality }
|
|
34
|
+
};
|
|
35
|
+
if (inputFormat === "gif") webpOptions.loop ??= 0;
|
|
36
|
+
return webpOptions;
|
|
37
|
+
}
|
|
38
|
+
case "avif": return {
|
|
39
|
+
...serviceConfig.avif,
|
|
40
|
+
...quality === void 0 ? {} : { quality }
|
|
41
|
+
};
|
|
42
|
+
default: return quality === void 0 ? void 0 : { quality };
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async function loadSharp() {
|
|
46
|
+
let sharpImport;
|
|
47
|
+
try {
|
|
48
|
+
sharpImport = (await import("sharp")).default;
|
|
49
|
+
} catch {
|
|
50
|
+
throw new AstroError(MissingSharp);
|
|
51
|
+
}
|
|
52
|
+
sharpImport.cache(false);
|
|
53
|
+
return sharpImport;
|
|
54
|
+
}
|
|
55
|
+
var fitMap = {
|
|
56
|
+
fill: "fill",
|
|
57
|
+
contain: "inside",
|
|
58
|
+
cover: "cover",
|
|
59
|
+
none: "outside",
|
|
60
|
+
"scale-down": "inside",
|
|
61
|
+
outside: "outside",
|
|
62
|
+
inside: "inside"
|
|
63
|
+
};
|
|
64
|
+
var sharp_default = {
|
|
65
|
+
validateOptions: baseService.validateOptions,
|
|
66
|
+
getURL: baseService.getURL,
|
|
67
|
+
parseURL: baseService.parseURL,
|
|
68
|
+
getHTMLAttributes: baseService.getHTMLAttributes,
|
|
69
|
+
getSrcSet: baseService.getSrcSet,
|
|
70
|
+
getRemoteSize: baseService.getRemoteSize,
|
|
71
|
+
async transform(inputBuffer, transformOptions, config, logger) {
|
|
72
|
+
if (!sharp) sharp = await loadSharp();
|
|
73
|
+
const transform = transformOptions;
|
|
74
|
+
const kernel = config.service.config.kernel;
|
|
75
|
+
const bufferFormat = detector(inputBuffer);
|
|
76
|
+
const outputFormat = transform.format ?? resolveDefaultOutputFormat(bufferFormat);
|
|
77
|
+
if (outputFormat === "svg") {
|
|
78
|
+
if (bufferFormat && bufferFormat !== "svg") {
|
|
79
|
+
logger.warn(`Astro expected an SVG for "${transform.src}" but the source is ${bufferFormat}. Passing it through as ${bufferFormat} instead.`);
|
|
80
|
+
return {
|
|
81
|
+
data: inputBuffer,
|
|
82
|
+
format: bufferFormat
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
return {
|
|
86
|
+
data: inputBuffer,
|
|
87
|
+
format: "svg"
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
if (!bufferFormat) throw new AstroError({
|
|
91
|
+
...NoImageMetadata,
|
|
92
|
+
message: NoImageMetadata.message(transform.src)
|
|
93
|
+
});
|
|
94
|
+
if (bufferFormat === "svg" && !config.dangerouslyProcessSVG) throw new AstroError({
|
|
95
|
+
...UnsupportedImageFormat,
|
|
96
|
+
message: `SVG image processing is disabled, but the source for "${transform.src}" is an SVG. Pass it through unchanged by setting \`format="svg"\` on the component, or set \`image.dangerouslyProcessSVG: true\` to rasterize SVG sources.`
|
|
97
|
+
});
|
|
98
|
+
const result = sharp(inputBuffer, {
|
|
99
|
+
failOn: "none",
|
|
100
|
+
pages: -1,
|
|
101
|
+
limitInputPixels: config.service.config.limitInputPixels
|
|
102
|
+
});
|
|
103
|
+
result.rotate();
|
|
104
|
+
if (transform.width && transform.height) {
|
|
105
|
+
const fit = transform.fit ? fitMap[transform.fit] ?? "inside" : void 0;
|
|
106
|
+
result.resize({
|
|
107
|
+
width: Math.round(transform.width),
|
|
108
|
+
height: Math.round(transform.height),
|
|
109
|
+
kernel,
|
|
110
|
+
fit,
|
|
111
|
+
position: transform.position,
|
|
112
|
+
withoutEnlargement: true
|
|
113
|
+
});
|
|
114
|
+
} else if (transform.height && !transform.width) result.resize({
|
|
115
|
+
height: Math.round(transform.height),
|
|
116
|
+
withoutEnlargement: true,
|
|
117
|
+
kernel
|
|
118
|
+
});
|
|
119
|
+
else if (transform.width) result.resize({
|
|
120
|
+
width: Math.round(transform.width),
|
|
121
|
+
withoutEnlargement: true,
|
|
122
|
+
kernel
|
|
123
|
+
});
|
|
124
|
+
if (transform.background) result.flatten({ background: transform.background });
|
|
125
|
+
const encoderOptions = resolveSharpEncoderOptions({
|
|
126
|
+
format: outputFormat,
|
|
127
|
+
quality: transform.quality
|
|
128
|
+
}, bufferFormat, config.service.config);
|
|
129
|
+
if (outputFormat === "webp") result.webp(encoderOptions);
|
|
130
|
+
else if (outputFormat === "png") result.png(encoderOptions);
|
|
131
|
+
else if (outputFormat === "avif") result.avif(encoderOptions);
|
|
132
|
+
else if (outputFormat === "jpeg" || outputFormat === "jpg") result.jpeg(encoderOptions);
|
|
133
|
+
else result.toFormat(outputFormat, encoderOptions);
|
|
134
|
+
let data;
|
|
135
|
+
let info;
|
|
136
|
+
try {
|
|
137
|
+
({data, info} = await result.toBuffer({ resolveWithObject: true }));
|
|
138
|
+
} catch {
|
|
139
|
+
logger.warn(`Astro could not optimize image "${transform.src}". Sharp doesn't support this format. The image will be used unoptimized. Consider converting to WebP or placing in the public/ folder.`);
|
|
140
|
+
return {
|
|
141
|
+
data: inputBuffer,
|
|
142
|
+
format: bufferFormat
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
data: "buffer" in data && data.buffer instanceof SharedArrayBuffer ? new Uint8Array(data) : data,
|
|
147
|
+
format: info.format
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
//#endregion
|
|
152
|
+
export { sharp_default as default, resolveSharpEncoderOptions };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Fragment, createElement } from "react";
|
|
2
|
+
import { DOCUMENT_NODE, ELEMENT_NODE, TEXT_NODE, parse } from "ultrahtml";
|
|
3
|
+
//#region node_modules/.pnpm/@astrojs+react@7.0.0_@types+node@22.20.4_@types+react-dom@19.3.0_@types+react@19.3.0__@_02aa85dceaccf3d763325676dd8540a8/node_modules/@astrojs/react/dist/vnode-children.js
|
|
4
|
+
var ids = 0;
|
|
5
|
+
function convert(children) {
|
|
6
|
+
let doc = parse(children.toString().trim());
|
|
7
|
+
let id = ids++;
|
|
8
|
+
let key = 0;
|
|
9
|
+
function createReactElementFromNode(node) {
|
|
10
|
+
const childVnodes = Array.isArray(node.children) && node.children.length ? node.children.map((child) => createReactElementFromNode(child)).filter(Boolean) : void 0;
|
|
11
|
+
if (node.type === DOCUMENT_NODE) return createElement(Fragment, {}, childVnodes);
|
|
12
|
+
else if (node.type === ELEMENT_NODE) {
|
|
13
|
+
const { class: className, ...props } = node.attributes;
|
|
14
|
+
return createElement(node.name, {
|
|
15
|
+
...props,
|
|
16
|
+
className,
|
|
17
|
+
key: `${id}-${key++}`
|
|
18
|
+
}, childVnodes);
|
|
19
|
+
} else if (node.type === TEXT_NODE) return node.value.trim() ? node.value : void 0;
|
|
20
|
+
}
|
|
21
|
+
return createReactElementFromNode(doc).props.children;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { convert as default };
|