ipx 3.0.3 → 3.1.1
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
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[![npm downloads][npm-downloads-src]][npm-downloads-href]
|
|
5
5
|
|
|
6
6
|
> [!NOTE]
|
|
7
|
-
> This is the active branch
|
|
7
|
+
> This is the active development branch. Check out [v2](https://github.com/unjs/ipx/tree/v2) and [v3](https://github.com/unjs/ipx/tree/v3) for older docs.
|
|
8
8
|
|
|
9
9
|
High performance, secure and easy-to-use image optimizer powered by [sharp](https://github.com/lovell/sharp) and [svgo](https://github.com/svg/svgo).
|
|
10
10
|
|
|
@@ -20,7 +20,7 @@ Using `npx`:
|
|
|
20
20
|
npx ipx serve --dir ./
|
|
21
21
|
```
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
Using `bun`
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
26
|
bun x npx ipx serve --dir ./
|
|
@@ -28,7 +28,7 @@ bun x npx ipx serve --dir ./
|
|
|
28
28
|
|
|
29
29
|
The default serve directory is the current working directory.
|
|
30
30
|
|
|
31
|
-
##
|
|
31
|
+
## Programmatic API
|
|
32
32
|
|
|
33
33
|
You can use IPX as a middleware or directly use IPX interface.
|
|
34
34
|
|
package/dist/cli.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const listhen = require('listhen');
|
|
4
4
|
const citty = require('citty');
|
|
5
5
|
const cli = require('listhen/cli');
|
|
6
|
-
const nodeFs = require('./shared/ipx.
|
|
6
|
+
const nodeFs = require('./shared/ipx.GUc23orS.cjs');
|
|
7
7
|
require('defu');
|
|
8
8
|
require('ufo');
|
|
9
9
|
require('h3');
|
|
@@ -15,7 +15,7 @@ require('ofetch');
|
|
|
15
15
|
require('pathe');
|
|
16
16
|
|
|
17
17
|
const name = "ipx";
|
|
18
|
-
const version = "3.
|
|
18
|
+
const version = "3.1.1";
|
|
19
19
|
const description = "High performance, secure and easy-to-use image optimizer.";
|
|
20
20
|
|
|
21
21
|
const serve = citty.defineCommand({
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { listen } from 'listhen';
|
|
2
2
|
import { defineCommand, runMain } from 'citty';
|
|
3
3
|
import { getArgs, parseArgs } from 'listhen/cli';
|
|
4
|
-
import { c as createIPX, i as ipxHttpStorage, g as ipxFSStorage, e as createIPXNodeServer } from './shared/ipx.
|
|
4
|
+
import { c as createIPX, i as ipxHttpStorage, g as ipxFSStorage, e as createIPXNodeServer } from './shared/ipx.CXJeaylD.mjs';
|
|
5
5
|
import 'defu';
|
|
6
6
|
import 'ufo';
|
|
7
7
|
import 'h3';
|
|
@@ -13,7 +13,7 @@ import 'ofetch';
|
|
|
13
13
|
import 'pathe';
|
|
14
14
|
|
|
15
15
|
const name = "ipx";
|
|
16
|
-
const version = "3.
|
|
16
|
+
const version = "3.1.1";
|
|
17
17
|
const description = "High performance, secure and easy-to-use image optimizer.";
|
|
18
18
|
|
|
19
19
|
const serve = defineCommand({
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as createIPX, b as createIPXH3App, a as createIPXH3Handler, e as createIPXNodeServer, f as createIPXPlainServer, d as createIPXWebServer, g as ipxFSStorage, i as ipxHttpStorage } from './shared/ipx.
|
|
1
|
+
export { c as createIPX, b as createIPXH3App, a as createIPXH3Handler, e as createIPXNodeServer, f as createIPXPlainServer, d as createIPXWebServer, g as ipxFSStorage, i as ipxHttpStorage } from './shared/ipx.CXJeaylD.mjs';
|
|
2
2
|
import { createError } from 'h3';
|
|
3
3
|
import 'defu';
|
|
4
4
|
import 'ufo';
|
|
@@ -413,7 +413,7 @@ function createIPX(userOptions) {
|
|
|
413
413
|
const { optimize } = await getSVGO();
|
|
414
414
|
const svg = optimize(sourceData.toString("utf8"), {
|
|
415
415
|
...options.svgo,
|
|
416
|
-
plugins: ["
|
|
416
|
+
plugins: ["removeScripts", ...options.svgo?.plugins || []]
|
|
417
417
|
}).data;
|
|
418
418
|
return {
|
|
419
419
|
data: svg,
|
|
@@ -695,7 +695,7 @@ function ipxFSStorage(_options = {}) {
|
|
|
695
695
|
const fs = await _getFS();
|
|
696
696
|
for (const dir of dirs) {
|
|
697
697
|
const filePath = join(dir, id);
|
|
698
|
-
if (!isValidPath(filePath) || !filePath.startsWith(dir)) {
|
|
698
|
+
if (!isValidPath(filePath) || !filePath.startsWith(dir + "/")) {
|
|
699
699
|
throw createError({
|
|
700
700
|
statusCode: 403,
|
|
701
701
|
statusText: `IPX_FORBIDDEN_PATH`,
|
|
@@ -420,7 +420,7 @@ function createIPX(userOptions) {
|
|
|
420
420
|
const { optimize } = await getSVGO();
|
|
421
421
|
const svg = optimize(sourceData.toString("utf8"), {
|
|
422
422
|
...options.svgo,
|
|
423
|
-
plugins: ["
|
|
423
|
+
plugins: ["removeScripts", ...options.svgo?.plugins || []]
|
|
424
424
|
}).data;
|
|
425
425
|
return {
|
|
426
426
|
data: svg,
|
|
@@ -702,7 +702,7 @@ function ipxFSStorage(_options = {}) {
|
|
|
702
702
|
const fs = await _getFS();
|
|
703
703
|
for (const dir of dirs) {
|
|
704
704
|
const filePath = pathe.join(dir, id);
|
|
705
|
-
if (!isValidPath(filePath) || !filePath.startsWith(dir)) {
|
|
705
|
+
if (!isValidPath(filePath) || !filePath.startsWith(dir + "/")) {
|
|
706
706
|
throw h3.createError({
|
|
707
707
|
statusCode: 403,
|
|
708
708
|
statusText: `IPX_FORBIDDEN_PATH`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ipx",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"repository": "unjs/ipx",
|
|
5
5
|
"description": "High performance, secure and easy-to-use image optimizer.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"lint:fix": "eslint . --fix && prettier -w src test",
|
|
33
33
|
"prepack": "pnpm build",
|
|
34
34
|
"release": "pnpm test && changelogen --release --push && npm publish",
|
|
35
|
-
"prerelease": "pnpm test && pnpm build && changelogen --release --push --publish --publishTag latest",
|
|
36
35
|
"start": "node bin/ipx.js",
|
|
37
36
|
"test": "pnpm lint && vitest run --coverage"
|
|
38
37
|
},
|
|
@@ -41,32 +40,32 @@
|
|
|
41
40
|
"citty": "^0.1.6",
|
|
42
41
|
"consola": "^3.4.2",
|
|
43
42
|
"defu": "^6.1.4",
|
|
44
|
-
"destr": "^2.0.
|
|
43
|
+
"destr": "^2.0.5",
|
|
45
44
|
"etag": "^1.8.1",
|
|
46
|
-
"h3": "^1.15.
|
|
45
|
+
"h3": "^1.15.3",
|
|
47
46
|
"image-meta": "^0.2.1",
|
|
48
47
|
"listhen": "^1.9.0",
|
|
49
48
|
"ofetch": "^1.4.1",
|
|
50
49
|
"pathe": "^2.0.3",
|
|
51
|
-
"sharp": "^0.
|
|
52
|
-
"svgo": "^
|
|
53
|
-
"ufo": "^1.
|
|
54
|
-
"unstorage": "^1.
|
|
50
|
+
"sharp": "^0.34.3",
|
|
51
|
+
"svgo": "^4.0.0",
|
|
52
|
+
"ufo": "^1.6.1",
|
|
53
|
+
"unstorage": "^1.16.1",
|
|
55
54
|
"xss": "^1.0.15"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
|
-
"@types/etag": "^1.8.
|
|
57
|
+
"@types/etag": "^1.8.4",
|
|
59
58
|
"@types/is-valid-path": "^0.1.2",
|
|
60
|
-
"@vitest/coverage-v8": "^3.
|
|
61
|
-
"changelogen": "^0.6.
|
|
62
|
-
"eslint": "^9.
|
|
63
|
-
"eslint-config-unjs": "^0.
|
|
59
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
60
|
+
"changelogen": "^0.6.2",
|
|
61
|
+
"eslint": "^9.31.0",
|
|
62
|
+
"eslint-config-unjs": "^0.5.0",
|
|
64
63
|
"jiti": "^2.4.2",
|
|
65
|
-
"prettier": "^3.
|
|
64
|
+
"prettier": "^3.6.2",
|
|
66
65
|
"serve-handler": "^6.1.6",
|
|
67
|
-
"typescript": "^5.8.
|
|
66
|
+
"typescript": "^5.8.3",
|
|
68
67
|
"unbuild": "^3.5.0",
|
|
69
|
-
"vitest": "^3.
|
|
68
|
+
"vitest": "^3.2.4"
|
|
70
69
|
},
|
|
71
|
-
"packageManager": "pnpm@10.
|
|
70
|
+
"packageManager": "pnpm@10.13.1"
|
|
72
71
|
}
|