Comparing version 2.0.0-1 to 2.0.0
import { Color, KernelEnum, Sharp, SharpOptions } from 'sharp'; | ||
import { ImageMeta } from 'image-meta'; | ||
import { Config } from 'svgo'; | ||
import * as h3 from 'h3'; | ||
@@ -30,8 +32,2 @@ import { Storage, Driver } from 'unstorage'; | ||
} | ||
interface ImageMeta { | ||
width: number; | ||
height: number; | ||
type: string; | ||
mimeType: string; | ||
} | ||
@@ -118,5 +114,5 @@ declare const quality: Handler; | ||
process: () => Promise<{ | ||
data: Buffer; | ||
meta: ImageMeta; | ||
format: string; | ||
data: Buffer | string; | ||
meta?: ImageMeta; | ||
format?: string; | ||
}>; | ||
@@ -130,10 +126,11 @@ }; | ||
httpStorage?: IPXStorage; | ||
svgo?: false | Config; | ||
}; | ||
declare function createIPX(userOptions: IPXOptions): IPX; | ||
declare function createIPXH3Handler(ipx: IPX): h3.EventHandler<h3.EventHandlerRequest, Promise<Buffer | { | ||
declare function createIPXH3Handler(ipx: IPX): h3.EventHandler<h3.EventHandlerRequest, Promise<string | void | Buffer | { | ||
error: { | ||
message: string; | ||
}; | ||
} | null>>; | ||
}>>; | ||
declare function createIPXH3App(ipx: IPX): h3.App; | ||
@@ -149,2 +146,3 @@ declare function createIPXWebServer(ipx: IPX): h3.WebHandler; | ||
allowAllDomains?: boolean; | ||
ignoreCacheControl?: boolean; | ||
}; | ||
@@ -161,2 +159,2 @@ declare function ipxHttpStorage(_options?: HTTPStorageOptions): IPXStorage; | ||
export { type HTTPStorageOptions, type Handler, type HandlerContext, type IPX, type IPXOptions, type IPXStorage, type IPXStorageMeta, type IPXStorageOptions, type ImageMeta, type NodeFSSOptions, createIPX, createIPXH3App, createIPXH3Handler, createIPXNodeServer, createIPXPlainServer, createIPXWebServer, ipxFSStorage, ipxHttpStorage, unstorageToIPXStorage }; | ||
export { type HTTPStorageOptions, type Handler, type HandlerContext, type IPX, type IPXOptions, type IPXStorage, type IPXStorageMeta, type IPXStorageOptions, type NodeFSSOptions, createIPX, createIPXH3App, createIPXH3Handler, createIPXNodeServer, createIPXPlainServer, createIPXWebServer, ipxFSStorage, ipxHttpStorage, unstorageToIPXStorage }; |
{ | ||
"name": "ipx", | ||
"version": "2.0.0-1", | ||
"version": "2.0.0", | ||
"repository": "unjs/ipx", | ||
@@ -47,3 +47,3 @@ "description": "High performance, secure and easy-to-use image optimizer.", | ||
"h3": "^1.8.2", | ||
"image-meta": "^0.1.1", | ||
"image-meta": "^0.2.0", | ||
"listhen": "^1.5.5", | ||
@@ -53,4 +53,6 @@ "ofetch": "^1.3.3", | ||
"sharp": "^0.32.6", | ||
"ufo": "^1.3.0", | ||
"unstorage": "^1.9.0" | ||
"svgo": "^3.0.2", | ||
"ufo": "^1.3.1", | ||
"unstorage": "^1.9.0", | ||
"xss": "^1.0.14" | ||
}, | ||
@@ -60,5 +62,5 @@ "devDependencies": { | ||
"@types/is-valid-path": "^0.1.0", | ||
"@vitest/coverage-v8": "^0.34.5", | ||
"@vitest/coverage-v8": "^0.34.6", | ||
"changelogen": "^0.5.5", | ||
"eslint": "^8.50.0", | ||
"eslint": "^8.51.0", | ||
"eslint-config-unjs": "^0.2.1", | ||
@@ -70,5 +72,5 @@ "jiti": "^1.20.0", | ||
"unbuild": "^2.0.0", | ||
"vitest": "^0.34.5" | ||
"vitest": "^0.34.6" | ||
}, | ||
"packageManager": "pnpm@8.8.0" | ||
} |
@@ -6,8 +6,8 @@ # 🖼️ IPX | ||
High performance, secure and easy-to-use image optimizer. | ||
> [!NOTE] | ||
> This is the active branch for IPX v2. Check out [ipx/v1](https://github.com/unjs/ipx/tree/v1) for v1 docs. | ||
Powered by [sharp](https://github.com/lovell/sharp) and [libvips](https://github.com/libvips/libvips). | ||
High performance, secure and easy-to-use image optimizer powered by [sharp](https://github.com/lovell/sharp) and [svgo](https://github.com/svg/svgo). | ||
> [!IMPORTANT] | ||
> This is the development branch for IPX v2. Check out [ipx/v1](https://github.com/unjs/ipx/tree/v1) for latest stable docs and [#71](https://github.com/unjs/ipx/issues/171) for v2 roadmap. | ||
Used by [Nuxt Image](https://image.nuxt.com/) and [Netlify](https://www.npmjs.com/package/@netlify/ipx) and open to everyone! | ||
@@ -21,3 +21,3 @@ ## Using CLI | ||
```bash | ||
npx ipx@next-2 serve --dir ./ | ||
npx ipx serve --dir ./ | ||
``` | ||
@@ -28,3 +28,3 @@ | ||
```bash | ||
bun x npx ipx@next-2 serve --dir ./ | ||
bun x npx ipx serve --dir ./ | ||
``` | ||
@@ -39,8 +39,3 @@ | ||
```ts | ||
import { | ||
createIPX, | ||
createIPXMiddleware, | ||
ipxFSStorage, | ||
ipxHttpStorage, | ||
} from "ipx"; | ||
import { createIPX, ipxFSStorage, ipxHttpStorage } from "ipx"; | ||
@@ -51,4 +46,2 @@ const ipx = createIPX({ | ||
}); | ||
const ipxMiddleware = createIPXMiddleware(ipx); | ||
``` | ||
@@ -59,7 +52,18 @@ | ||
```js | ||
import { createIPX, createIPXMiddleware } from "ipx"; | ||
import { listen } from "listhen"; | ||
import { createApp, toNodeListener } from "h3"; | ||
import { | ||
createIPX, | ||
ipxFSStorage, | ||
ipxHttpStorage, | ||
createIPXH3Handler, | ||
} from "ipx"; | ||
const app = createApp().use("/", fromNodeMiddleware(ipxMiddleware)); | ||
const ipx = createIPX({ | ||
storage: ipxFSStorage({ dir: "./public" }), | ||
httpStorage: ipxHttpStorage({ domains: ["picsum.photos"] }), | ||
}); | ||
const app = createApp().use("/", createIPXH3Handler(ipx)); | ||
listen(toNodeListener(app)); | ||
@@ -73,5 +77,16 @@ ``` | ||
import express from "express"; | ||
import { | ||
createIPX, | ||
ipxFSStorage, | ||
ipxHttpStorage, | ||
createIPXNodeServer, | ||
} from "ipx"; | ||
const app = express().use("/", ipxMiddleware); | ||
const ipx = createIPX({ | ||
storage: ipxFSStorage({ dir: "./public" }), | ||
httpStorage: ipxHttpStorage({ domains: ["picsum.photos"] }), | ||
}); | ||
const app = express().use("/", createIPXNodeServer(ipx)); | ||
listen(app); | ||
@@ -78,0 +93,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
82206
18
2027
1
195
16
+ Addedsvgo@^3.0.2
+ Addedxss@^1.0.14
+ Added@trysound/sax@0.2.0(transitive)
+ Addedboolbase@1.0.0(transitive)
+ Addedcommander@2.20.37.2.0(transitive)
+ Addedcss-select@5.1.0(transitive)
+ Addedcss-tree@2.2.12.3.1(transitive)
+ Addedcss-what@6.1.0(transitive)
+ Addedcssfilter@0.0.10(transitive)
+ Addedcsso@5.0.5(transitive)
+ Addeddom-serializer@2.0.0(transitive)
+ Addeddomelementtype@2.3.0(transitive)
+ Addeddomhandler@5.0.3(transitive)
+ Addeddomutils@3.1.0(transitive)
+ Addedentities@4.5.0(transitive)
+ Addedimage-meta@0.2.1(transitive)
+ Addedmdn-data@2.0.282.0.30(transitive)
+ Addednth-check@2.1.1(transitive)
+ Addedpicocolors@1.1.0(transitive)
+ Addedsource-map-js@1.2.1(transitive)
+ Addedsvgo@3.3.2(transitive)
+ Addedxss@1.0.15(transitive)
- Removedimage-meta@0.1.1(transitive)
Updatedimage-meta@^0.2.0
Updatedufo@^1.3.1