Skip to content

Commit

Permalink
fix: Decode types
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonjgardner committed Jul 15, 2024
1 parent 211f8e0 commit 10d73ed
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
},
"imports": {
"@hono/hono": "jsr:@hono/hono@^4.4.11",
"imagescript": "https://deno.land/x/imagescript@1.3.0/mod.ts",
"jszip": "https://esm.sh/jszip@3.10.1",
"imagescript": "npm:imagescript@1.3.0", //https://deno.land/x/imagescript@1.3.0/mod.ts",
"jszip": "npm:jszip@3.10.1",
"nanoid": "npm:nanoid@5.0.7",
"nbtify": "npm:nbtify@1.90.1",
"classix": "npm:classix@^2.1.38",
Expand Down
6 changes: 4 additions & 2 deletions src/_decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,13 @@ export default async function decode(
}

// Resize every frame above the max width/height
return img!.map((i: Image | GIF) =>
const frames = img?.map((i: imagescript.Image | imagescript.Frame) =>
i.height > MAX_HEIGHT
? i.resize(imagescript.Image.RESIZE_AUTO, MAX_HEIGHT)
: i.width > MAX_WIDTH
? i.resize(MAX_WIDTH, imagescript.Image.RESIZE_AUTO)
: i
) as DecodedFrames;
) ?? [];

return frames as DecodedFrames;
}

1 comment on commit 10d73ed

@deno-deploy
Copy link

@deno-deploy deno-deploy bot commented on 10d73ed Jul 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

UNCAUGHT_EXCEPTION

Error: unsupported arch/platform: Node API is not supported in this environment
    at Object.<anonymous> (file:///node_modules/.deno/imagescript@1.3.0/node_modules/imagescript/codecs/node/index.js:3:21)
    at Object.<anonymous> (file:///node_modules/.deno/imagescript@1.3.0/node_modules/imagescript/codecs/node/index.js:4:4)
    at Module._compile (node:module:729:34)
    at Object.Module._extensions..js (node:module:743:10)
    at Module.load (node:module:654:32)
    at Function.Module._load (node:module:522:12)
    at Module.require (node:module:673:19)
    at require (node:module:787:16)
    at Object.<anonymous> (file:///node_modules/.deno/imagescript@1.3.0/node_modules/imagescript/ImageScript.js:4:16)
    at Object.<anonymous> (file:///node_modules/.deno/imagescript@1.3.0/node_modules/imagescript/ImageScript.js:1671:4)

Please sign in to comment.