ipx 1.0.0 → 1.1.0
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.
package/README.md
CHANGED
|
@@ -68,6 +68,7 @@ Resize to `200x200px` using `embed` method and change format to `webp`:
|
|
|
68
68
|
| flop | [Docs](https://sharp.pixelplumbing.com/api-operation#flop) | `http://localhost:3000/flop/buffalo.png` |
|
|
69
69
|
| sharpen | [Docs](https://sharp.pixelplumbing.com/api-operation#sharpen) | `http://localhost:3000/sharpen_30/buffalo.png` |
|
|
70
70
|
| median | [Docs](https://sharp.pixelplumbing.com/api-operation#median) | `http://localhost:3000/median_10/buffalo.png` |
|
|
71
|
+
| blur | [Docs](https://sharp.pixelplumbing.com/api-operation#blur) | `http://localhost:3000/blur_5/buffalo.png` |
|
|
71
72
|
| gamma | [Docs](https://sharp.pixelplumbing.com/api-operation#gamma) | `http://localhost:3000/gamma_3/buffalo.png` |
|
|
72
73
|
| negate | [Docs](https://sharp.pixelplumbing.com/api-operation#negate) | `http://localhost:3000/negate/buffalo.png` |
|
|
73
74
|
| normalize | [Docs](https://sharp.pixelplumbing.com/api-operation#normalize) | `http://localhost:3000/normalize/buffalo.png` |
|
package/dist/cli.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const consola = require('consola');
|
|
4
4
|
const listhen = require('listhen');
|
|
5
|
-
const middleware = require('./shared/ipx.
|
|
5
|
+
const middleware = require('./shared/ipx.e9f7a9b5.cjs');
|
|
6
6
|
require('defu');
|
|
7
7
|
require('image-meta');
|
|
8
8
|
require('ufo');
|
|
@@ -15,6 +15,10 @@ require('destr');
|
|
|
15
15
|
require('etag');
|
|
16
16
|
require('xss');
|
|
17
17
|
|
|
18
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
19
|
+
|
|
20
|
+
const consola__default = /*#__PURE__*/_interopDefaultCompat(consola);
|
|
21
|
+
|
|
18
22
|
async function main() {
|
|
19
23
|
const ipx = middleware.createIPX({});
|
|
20
24
|
const middleware$1 = middleware.createIPXMiddleware(ipx);
|
|
@@ -23,6 +27,6 @@ async function main() {
|
|
|
23
27
|
});
|
|
24
28
|
}
|
|
25
29
|
main().catch((error) => {
|
|
26
|
-
|
|
30
|
+
consola__default.error(error);
|
|
27
31
|
process.exit(1);
|
|
28
32
|
});
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import consola from 'consola';
|
|
2
2
|
import { listen } from 'listhen';
|
|
3
|
-
import { c as createIPX, a as createIPXMiddleware } from './shared/ipx.
|
|
3
|
+
import { c as createIPX, a as createIPXMiddleware } from './shared/ipx.cc3515c9.mjs';
|
|
4
4
|
import 'defu';
|
|
5
5
|
import 'image-meta';
|
|
6
6
|
import 'ufo';
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -12,6 +12,14 @@ const destr = require('destr');
|
|
|
12
12
|
const getEtag = require('etag');
|
|
13
13
|
const xss = require('xss');
|
|
14
14
|
|
|
15
|
+
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
16
|
+
|
|
17
|
+
const http__default = /*#__PURE__*/_interopDefaultCompat(http);
|
|
18
|
+
const https__default = /*#__PURE__*/_interopDefaultCompat(https);
|
|
19
|
+
const destr__default = /*#__PURE__*/_interopDefaultCompat(destr);
|
|
20
|
+
const getEtag__default = /*#__PURE__*/_interopDefaultCompat(getEtag);
|
|
21
|
+
const xss__default = /*#__PURE__*/_interopDefaultCompat(xss);
|
|
22
|
+
|
|
15
23
|
const Handlers = {
|
|
16
24
|
__proto__: null,
|
|
17
25
|
get b () { return b; },
|
|
@@ -49,7 +57,7 @@ const Handlers = {
|
|
|
49
57
|
};
|
|
50
58
|
|
|
51
59
|
function getEnv(name, defaultValue) {
|
|
52
|
-
return
|
|
60
|
+
return destr__default(process.env[name]) ?? defaultValue;
|
|
53
61
|
}
|
|
54
62
|
function cachedPromise(function_) {
|
|
55
63
|
let p;
|
|
@@ -107,8 +115,8 @@ function isValidPath(fp) {
|
|
|
107
115
|
|
|
108
116
|
const HTTP_RE = /^https?:\/\//;
|
|
109
117
|
const createHTTPSource = (options) => {
|
|
110
|
-
const httpsAgent = new
|
|
111
|
-
const httpAgent = new
|
|
118
|
+
const httpsAgent = new https__default.Agent({ keepAlive: true });
|
|
119
|
+
const httpAgent = new http__default.Agent({ keepAlive: true });
|
|
112
120
|
let _domains = options.domains || [];
|
|
113
121
|
if (typeof _domains === "string") {
|
|
114
122
|
_domains = _domains.split(",").map((s) => s.trim());
|
|
@@ -166,7 +174,7 @@ const createHTTPSource = (options) => {
|
|
|
166
174
|
};
|
|
167
175
|
|
|
168
176
|
function VArg(argument) {
|
|
169
|
-
return
|
|
177
|
+
return destr__default(argument);
|
|
170
178
|
}
|
|
171
179
|
function parseArgs(arguments_, mappers) {
|
|
172
180
|
const vargs = arguments_.split("_");
|
|
@@ -338,8 +346,8 @@ const median = {
|
|
|
338
346
|
};
|
|
339
347
|
const blur = {
|
|
340
348
|
args: [VArg, VArg, VArg],
|
|
341
|
-
apply: (_context, pipe) => {
|
|
342
|
-
return pipe.blur();
|
|
349
|
+
apply: (_context, pipe, sigma) => {
|
|
350
|
+
return pipe.blur(sigma);
|
|
343
351
|
}
|
|
344
352
|
};
|
|
345
353
|
const flatten = {
|
|
@@ -553,7 +561,7 @@ async function _handleRequest(request, ipx) {
|
|
|
553
561
|
res.headers["Cache-Control"] = `max-age=${+source.maxAge}, public, s-maxage=${+source.maxAge}`;
|
|
554
562
|
}
|
|
555
563
|
const { data, format } = await img.data();
|
|
556
|
-
const etag =
|
|
564
|
+
const etag = getEtag__default(data);
|
|
557
565
|
res.headers.ETag = etag;
|
|
558
566
|
if (etag && request.headers["if-none-match"] === etag) {
|
|
559
567
|
res.statusCode = 304;
|
|
@@ -601,7 +609,7 @@ function sanetizeReponse(res) {
|
|
|
601
609
|
statusCode: res.statusCode || 200,
|
|
602
610
|
statusMessage: res.statusMessage ? safeString(res.statusMessage) : "OK",
|
|
603
611
|
headers: safeStringObject(res.headers || {}),
|
|
604
|
-
body: typeof res.body === "string" ?
|
|
612
|
+
body: typeof res.body === "string" ? xss__default(safeString(res.body)) : res.body || ""
|
|
605
613
|
};
|
|
606
614
|
}
|
|
607
615
|
function safeString(input) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ipx",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"repository": "unjs/ipx",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"exports": {
|
|
@@ -28,33 +28,32 @@
|
|
|
28
28
|
"test": "pnpm lint && vitest run --coverage"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"consola": "^
|
|
31
|
+
"consola": "^3.1.0",
|
|
32
32
|
"defu": "^6.1.2",
|
|
33
33
|
"destr": "^1.2.2",
|
|
34
34
|
"etag": "^1.8.1",
|
|
35
35
|
"image-meta": "^0.1.1",
|
|
36
36
|
"listhen": "^1.0.4",
|
|
37
|
-
"node-fetch-native": "^1.0
|
|
37
|
+
"node-fetch-native": "^1.1.0",
|
|
38
38
|
"pathe": "^1.1.0",
|
|
39
|
-
"sharp": "^0.32.
|
|
40
|
-
"ufo": "^1.1.
|
|
39
|
+
"sharp": "^0.32.1",
|
|
40
|
+
"ufo": "^1.1.2",
|
|
41
41
|
"xss": "^1.0.14"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/etag": "^1.8.1",
|
|
45
45
|
"@types/is-valid-path": "^0.1.0",
|
|
46
|
-
"@
|
|
47
|
-
"
|
|
48
|
-
"
|
|
49
|
-
"eslint": "^8.37.0",
|
|
46
|
+
"@vitest/coverage-c8": "^0.31.0",
|
|
47
|
+
"changelogen": "^0.5.3",
|
|
48
|
+
"eslint": "^8.39.0",
|
|
50
49
|
"eslint-config-unjs": "^0.1.0",
|
|
51
50
|
"jiti": "^1.18.2",
|
|
52
51
|
"nodemon": "^2.0.22",
|
|
53
|
-
"prettier": "^2.8.
|
|
52
|
+
"prettier": "^2.8.8",
|
|
54
53
|
"serve-handler": "^6.1.5",
|
|
55
|
-
"typescript": "^5.0.
|
|
56
|
-
"unbuild": "^1.1
|
|
57
|
-
"vitest": "^0.
|
|
54
|
+
"typescript": "^5.0.4",
|
|
55
|
+
"unbuild": "^1.2.1",
|
|
56
|
+
"vitest": "^0.31.0"
|
|
58
57
|
},
|
|
59
|
-
"packageManager": "pnpm@8.
|
|
58
|
+
"packageManager": "pnpm@8.4.0"
|
|
60
59
|
}
|