unjs / ipx

๐Ÿ–ผ๏ธ High performance, secure and easy-to-use image optimizer.
MIT License
1.87k stars 63 forks source link

refactor!: rewrite storage system #164

Closed pi0 closed 1 year ago

pi0 commented 1 year ago

๐Ÿ”— Linked issue

โ“ Type of change

๐Ÿ“š Description

This PR rewrites ipx storage API for two goals:

Configuration migration:

++ import { ipxFSStorage, ipxHttpStorage } from "ipx";
--  dir: "./images",
--  domains: ["http://localhost:3000"],
++ storage: ipxFSStorage({ dir: "./images" }),
++ httpStorage: ipxHttpStorage({ domains: ["localhost:3000"] })

Testing:

pnpm dev

http://localhost:3000/w_800/bliss.jpg

http://localhost:3000/rotate_25/https://picsum.photos/500/500

๐Ÿ“ Checklist

pi0 commented 1 year ago

More changes need to be on top of this but i guess better to iterate in main and have smaller changelogs for next steps.