revojs 0.0.50 → 0.0.51
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/index.js +8 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -569,8 +569,15 @@ const createRuntime = async () => {
|
|
|
569
569
|
const assets = await import("#virtual/assets").then((module) => module.assets);
|
|
570
570
|
for (const path in assets) radix.insert("GET/" + path, defineRoute({ fetch: async (scope) => {
|
|
571
571
|
const { response } = useRuntime(scope);
|
|
572
|
+
let content = await assets[path]?.();
|
|
573
|
+
if (content) {
|
|
574
|
+
if (path.endsWith(".png")) {
|
|
575
|
+
const [_, base64] = content.split(",");
|
|
576
|
+
content = Buffer.from(base64, "base64url");
|
|
577
|
+
}
|
|
578
|
+
}
|
|
572
579
|
response.headers.set("Content-Type", mimeType(path));
|
|
573
|
-
return new Response(
|
|
580
|
+
return new Response(content, response);
|
|
574
581
|
} }));
|
|
575
582
|
const invoke = (scope, route, index) => {
|
|
576
583
|
return middlewares.at(index)?.fetch(scope, () => invoke(scope, route, index + 1)) ?? route.fetch(scope);
|