Socket
Socket
Sign inDemoInstall

ipx

Package Overview
Dependencies
132
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.3.0

dist/cli.d.cts

2

dist/cli.d.ts
export { }
export { }

@@ -1,2 +0,2 @@

import { Sharp, Color, SharpOptions } from 'sharp';
import { Sharp, Color, KernelEnum, SharpOptions } from 'sharp';
import { IncomingMessage, ServerResponse } from 'node:http';

@@ -23,2 +23,3 @@

enlarge?: boolean;
kernel?: keyof KernelEnum;
meta: ImageMeta;

@@ -37,2 +38,3 @@ }

declare const enlarge: Handler;
declare const kernel: Handler;
declare const width: Handler;

@@ -81,2 +83,3 @@ declare const height: Handler;

declare const Handlers_height: typeof height;
declare const Handlers_kernel: typeof kernel;
declare const Handlers_median: typeof median;

@@ -100,36 +103,3 @@ declare const Handlers_modulate: typeof modulate;

declare namespace Handlers {
export {
Handlers_b as b,
Handlers_background as background,
Handlers_blur as blur,
Handlers_crop as crop,
Handlers_enlarge as enlarge,
Handlers_extend as extend,
Handlers_extract as extract,
Handlers_fit as fit,
Handlers_flatten as flatten,
Handlers_flip as flip,
Handlers_flop as flop,
Handlers_gamma as gamma,
Handlers_grayscale as grayscale,
Handlers_h as h,
Handlers_height as height,
Handlers_median as median,
Handlers_modulate as modulate,
Handlers_negate as negate,
Handlers_normalize as normalize,
Handlers_pos as pos,
Handlers_position as position,
Handlers_q as q,
Handlers_quality as quality,
Handlers_resize as resize,
Handlers_rotate as rotate,
Handlers_s as s,
Handlers_sharpen as sharpen,
Handlers_threshold as threshold,
Handlers_tint as tint,
Handlers_trim as trim,
Handlers_w as w,
Handlers_width as width,
};
export { Handlers_b as b, Handlers_background as background, Handlers_blur as blur, Handlers_crop as crop, Handlers_enlarge as enlarge, Handlers_extend as extend, Handlers_extract as extract, Handlers_fit as fit, Handlers_flatten as flatten, Handlers_flip as flip, Handlers_flop as flop, Handlers_gamma as gamma, Handlers_grayscale as grayscale, Handlers_h as h, Handlers_height as height, Handlers_kernel as kernel, Handlers_median as median, Handlers_modulate as modulate, Handlers_negate as negate, Handlers_normalize as normalize, Handlers_pos as pos, Handlers_position as position, Handlers_q as q, Handlers_quality as quality, Handlers_resize as resize, Handlers_rotate as rotate, Handlers_s as s, Handlers_sharpen as sharpen, Handlers_threshold as threshold, Handlers_tint as tint, Handlers_trim as trim, Handlers_w as w, Handlers_width as width };
}

@@ -178,2 +148,2 @@

export { IPX, IPXCTX, IPXHRequest, IPXHResponse, IPXOptions, MiddlewareOptions, Source, SourceData, SourceFactory, createIPX, createIPXMiddleware, handleRequest };
export { type IPX, type IPXCTX, type IPXHRequest, type IPXHResponse, type IPXOptions, type MiddlewareOptions, type Source, type SourceData, type SourceFactory, createIPX, createIPXMiddleware, handleRequest };
{
"name": "ipx",
"version": "1.2.0",
"version": "1.3.0",
"repository": "unjs/ipx",

@@ -8,4 +8,10 @@ "license": "MIT",

".": {
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
"import": {
"types": "./dist/index.d.mts",
"default": "./dist/index.mjs"
},
"require": {
"types": "./dist/index.d.cts",
"default": "./dist/index.cjs"
}
}

@@ -23,3 +29,3 @@ },

"build": "unbuild",
"dev": "nodemon",
"dev": "listhen -w playground",
"lint": "eslint --ext .ts . && prettier -c src test",

@@ -34,12 +40,12 @@ "lint:fix": "eslint --ext .ts . --fix && prettier -w src test",

"@fastify/accept-negotiator": "^1.1.0",
"consola": "^3.1.0",
"consola": "^3.2.3",
"defu": "^6.1.2",
"destr": "^1.2.2",
"destr": "^2.0.1",
"etag": "^1.8.1",
"image-meta": "^0.1.1",
"listhen": "^1.0.4",
"node-fetch-native": "^1.1.1",
"listhen": "^1.4.4",
"node-fetch-native": "^1.4.0",
"pathe": "^1.1.1",
"sharp": "^0.32.1",
"ufo": "^1.1.2",
"sharp": "^0.32.5",
"ufo": "^1.3.0",
"xss": "^1.0.14"

@@ -50,16 +56,14 @@ },

"@types/is-valid-path": "^0.1.0",
"@vitest/coverage-c8": "^0.32.0",
"@vitest/coverage-v8": "^0.32.0",
"changelogen": "^0.5.3",
"eslint": "^8.42.0",
"@vitest/coverage-v8": "^0.34.3",
"changelogen": "^0.5.5",
"eslint": "^8.48.0",
"eslint-config-unjs": "^0.2.1",
"jiti": "^1.18.2",
"nodemon": "^2.0.22",
"prettier": "^2.8.8",
"jiti": "^1.19.3",
"prettier": "^3.0.3",
"serve-handler": "^6.1.5",
"typescript": "^5.1.3",
"unbuild": "^1.2.1",
"vitest": "^0.32.0"
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"vitest": "^0.34.3"
},
"packageManager": "pnpm@8.6.1"
"packageManager": "pnpm@8.7.1"
}

@@ -8,10 +8,8 @@ # 🖼️ IPX

## Usage
## Using CLI
### Quick Start
You can use `ipx` command to start server using:
```bash
$ npx ipx
npx ipx@latest
```

@@ -21,16 +19,47 @@

### Programatic Usage
## Programatic API
You can use IPX as a Connect/Express middleware or directly use ipx api.
You can use IPX as a middleware or directly use IPX interface.
```ts
import { createIPX, createIPXMiddleware } from "ipx";
const ipx = createIPX({ domains: ["unjs.io"] });
// (req, res) => void
const ipxMiddleware = createIPXMiddleware(ipx);
```
**Example**: Using with [unjs/h3](https://github.com/unjs/h3):
```js
import { createIPX, createIPXMiddleware } from "ipx";
import { listen } from "listhen";
import { createApp, fromNodeMiddleware, toNodeListener } from "h3";
const ipx = createIPX(/* options */);
const app = express();
app.use("/image", createIPXMiddleware(ipx));
const ipx = createIPX({});
const ipxMiddleware = createIPXMiddleware(ipx);
const app = createApp().use("/", fromNodeMiddleware(ipxMiddleware));
listen(toNodeListener(app));
```
### Examples
**Example:** Using [express](https://expressjs.com):
```js
import { createIPX, createIPXMiddleware } from "ipx";
import { listen } from "listhen";
import express from "express";
const ipx = createIPX({});
const ipxMiddleware = createIPXMiddleware(ipx);
const app = express().use("/", ipxMiddleware);
listen(app);
```
## Examples
Get original image:

@@ -52,3 +81,3 @@

### Modifiers
## Modifiers

@@ -60,2 +89,3 @@ | Property | Docs | Example | Comments |

| resize / s | [Docs](https://sharp.pixelplumbing.com/api-resize#resize) | `/s_200x200/buffalo.png` |
| kernel | [Docs](https://sharp.pixelplumbing.com/api-resize#resize) | `/s_200x200,kernel_nearest/buffalo.png` | Supported kernel: `nearest`, `cubic`, `mitchell`, `lanczos2` and `lanczos3` (default). |
| fit | [Docs](https://sharp.pixelplumbing.com/api-resize#resize) | `/s_200x200,fit_outside/buffalo.png` | Sets `fit` option for `resize`. |

@@ -65,2 +95,3 @@ | position / pos | [Docs](https://sharp.pixelplumbing.com/api-resize#resize) | `/s_200x200,pos_top/buffalo.png` | Sets `position` option for `resize`. |

| extend | [Docs](https://sharp.pixelplumbing.com/api-resize#extend) | `/extend_{top}_{right}_{bottom}_{left}/buffalo.png` | Extend / pad / extrude one or more edges of the image with either the provided background colour or pixels derived from the image. |
| background / b | \_ | `/r_45,b_00ff00/buffalo.png` |
| extract | [Docs](https://sharp.pixelplumbing.com/api-resize#extract) | `/extract_{left}_{top}_{width}_{height}/buffalo.png` | Extract/crop a region of the image. |

@@ -84,3 +115,3 @@ | format / f | [Docs](https://sharp.pixelplumbing.com/api-output#toformat) | `/format_webp/buffalo.png` | Supported format: `jpg`, `jpeg`, `png`, `webp`, `avif`, `gif`, `heif`, `tiff` and `auto` (experimental only with middleware) |

### Config
## Config

@@ -87,0 +118,0 @@ Config can be customized using `IPX_*` environment variables.

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc