revojs 0.0.50 → 0.0.52

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.
Files changed (2) hide show
  1. package/dist/index.js +11 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -569,8 +569,18 @@ 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
+ const binary = atob(base64.replace(/-/g, "+").replace(/_/g, "/"));
577
+ const bytes = new Uint8Array(binary.length);
578
+ for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index);
579
+ content = bytes;
580
+ }
581
+ }
572
582
  response.headers.set("Content-Type", mimeType(path));
573
- return new Response(await assets[path]?.(), response);
583
+ return new Response(content, response);
574
584
  } }));
575
585
  const invoke = (scope, route, index) => {
576
586
  return middlewares.at(index)?.fetch(scope, () => invoke(scope, route, index + 1)) ?? route.fetch(scope);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "revojs",
3
- "version": "0.0.50",
3
+ "version": "0.0.52",
4
4
  "type": "module",
5
5
  "repository": "coverbase/revojs",
6
6
  "license": "MIT",