@deenruv/asset-server-plugin 1.0.6 → 1.0.10
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
package/lib/src/plugin.d.ts
CHANGED
|
@@ -37,7 +37,7 @@ import { AssetServerOptions } from "./types";
|
|
|
37
37
|
*
|
|
38
38
|
* Asset preview images can be transformed (resized & cropped) on the fly by appending query parameters to the url:
|
|
39
39
|
*
|
|
40
|
-
* `http://localhost:
|
|
40
|
+
* `http://localhost:6100/assets/some-asset.jpg?w=500&h=300&mode=resize`
|
|
41
41
|
*
|
|
42
42
|
* The above URL will return `some-asset.jpg`, resized to fit in the bounds of a 500px x 300px rectangle.
|
|
43
43
|
*
|
|
@@ -57,13 +57,13 @@ import { AssetServerOptions } from "./types";
|
|
|
57
57
|
* For example, let's say there is a very wide landscape image which we want to crop to be square. The main subject is a house to the far left of the
|
|
58
58
|
* image. The following query would crop it to a square with the house centered:
|
|
59
59
|
*
|
|
60
|
-
* `http://localhost:
|
|
60
|
+
* `http://localhost:6100/assets/landscape.jpg?w=150&h=150&mode=crop&fpx=0.2&fpy=0.7`
|
|
61
61
|
*
|
|
62
62
|
* ### Format
|
|
63
63
|
*
|
|
64
64
|
* Since v1.7.0, the image format can be specified by adding the `format` query parameter:
|
|
65
65
|
*
|
|
66
|
-
* `http://localhost:
|
|
66
|
+
* `http://localhost:6100/assets/some-asset.jpg?format=webp`
|
|
67
67
|
*
|
|
68
68
|
* This means that, no matter the format of your original asset files, you can use more modern formats in your storefront if the browser
|
|
69
69
|
* supports them. Supported values for `format` are:
|
|
@@ -79,7 +79,7 @@ import { AssetServerOptions } from "./types";
|
|
|
79
79
|
*
|
|
80
80
|
* Since v2.2.0, the image quality can be specified by adding the `q` query parameter:
|
|
81
81
|
*
|
|
82
|
-
* `http://localhost:
|
|
82
|
+
* `http://localhost:6100/assets/some-asset.jpg?q=75`
|
|
83
83
|
*
|
|
84
84
|
* This applies to the `jpg`, `webp` and `avif` formats. The default quality value for `jpg` and `webp` is 80, and for `avif` is 50.
|
|
85
85
|
*
|
|
@@ -103,11 +103,11 @@ import { AssetServerOptions } from "./types";
|
|
|
103
103
|
*
|
|
104
104
|
* means that a request to:
|
|
105
105
|
*
|
|
106
|
-
* `http://localhost:
|
|
106
|
+
* `http://localhost:6100/assets/some-asset.jpg?preset=my-preset`
|
|
107
107
|
*
|
|
108
108
|
* is equivalent to:
|
|
109
109
|
*
|
|
110
|
-
* `http://localhost:
|
|
110
|
+
* `http://localhost:6100/assets/some-asset.jpg?w=85&h=85&mode=crop`
|
|
111
111
|
*
|
|
112
112
|
* The AssetServerPlugin comes pre-configured with the following presets:
|
|
113
113
|
*
|
package/lib/src/plugin.js
CHANGED
|
@@ -64,7 +64,7 @@ async function getFileType(buffer) {
|
|
|
64
64
|
*
|
|
65
65
|
* Asset preview images can be transformed (resized & cropped) on the fly by appending query parameters to the url:
|
|
66
66
|
*
|
|
67
|
-
* `http://localhost:
|
|
67
|
+
* `http://localhost:6100/assets/some-asset.jpg?w=500&h=300&mode=resize`
|
|
68
68
|
*
|
|
69
69
|
* The above URL will return `some-asset.jpg`, resized to fit in the bounds of a 500px x 300px rectangle.
|
|
70
70
|
*
|
|
@@ -84,13 +84,13 @@ async function getFileType(buffer) {
|
|
|
84
84
|
* For example, let's say there is a very wide landscape image which we want to crop to be square. The main subject is a house to the far left of the
|
|
85
85
|
* image. The following query would crop it to a square with the house centered:
|
|
86
86
|
*
|
|
87
|
-
* `http://localhost:
|
|
87
|
+
* `http://localhost:6100/assets/landscape.jpg?w=150&h=150&mode=crop&fpx=0.2&fpy=0.7`
|
|
88
88
|
*
|
|
89
89
|
* ### Format
|
|
90
90
|
*
|
|
91
91
|
* Since v1.7.0, the image format can be specified by adding the `format` query parameter:
|
|
92
92
|
*
|
|
93
|
-
* `http://localhost:
|
|
93
|
+
* `http://localhost:6100/assets/some-asset.jpg?format=webp`
|
|
94
94
|
*
|
|
95
95
|
* This means that, no matter the format of your original asset files, you can use more modern formats in your storefront if the browser
|
|
96
96
|
* supports them. Supported values for `format` are:
|
|
@@ -106,7 +106,7 @@ async function getFileType(buffer) {
|
|
|
106
106
|
*
|
|
107
107
|
* Since v2.2.0, the image quality can be specified by adding the `q` query parameter:
|
|
108
108
|
*
|
|
109
|
-
* `http://localhost:
|
|
109
|
+
* `http://localhost:6100/assets/some-asset.jpg?q=75`
|
|
110
110
|
*
|
|
111
111
|
* This applies to the `jpg`, `webp` and `avif` formats. The default quality value for `jpg` and `webp` is 80, and for `avif` is 50.
|
|
112
112
|
*
|
|
@@ -130,11 +130,11 @@ async function getFileType(buffer) {
|
|
|
130
130
|
*
|
|
131
131
|
* means that a request to:
|
|
132
132
|
*
|
|
133
|
-
* `http://localhost:
|
|
133
|
+
* `http://localhost:6100/assets/some-asset.jpg?preset=my-preset`
|
|
134
134
|
*
|
|
135
135
|
* is equivalent to:
|
|
136
136
|
*
|
|
137
|
-
* `http://localhost:
|
|
137
|
+
* `http://localhost:6100/assets/some-asset.jpg?w=85&h=85&mode=crop`
|
|
138
138
|
*
|
|
139
139
|
* The AssetServerPlugin comes pre-configured with the following presets:
|
|
140
140
|
*
|
|
@@ -99,7 +99,7 @@ export interface S3Config {
|
|
|
99
99
|
* secretAccessKey: process.env.MINIO_SECRET_ACCESS_KEY,
|
|
100
100
|
* },
|
|
101
101
|
* nativeS3Configuration: {
|
|
102
|
-
* endpoint: process.env.MINIO_ENDPOINT ?? 'http://localhost:
|
|
102
|
+
* endpoint: process.env.MINIO_ENDPOINT ?? 'http://localhost:60900',
|
|
103
103
|
* forcePathStyle: true,
|
|
104
104
|
* signatureVersion: 'v4',
|
|
105
105
|
* // The `region` is required by the AWS SDK even when using MinIO,
|
|
@@ -93,7 +93,7 @@ const constants_1 = require("./constants");
|
|
|
93
93
|
* secretAccessKey: process.env.MINIO_SECRET_ACCESS_KEY,
|
|
94
94
|
* },
|
|
95
95
|
* nativeS3Configuration: {
|
|
96
|
-
* endpoint: process.env.MINIO_ENDPOINT ?? 'http://localhost:
|
|
96
|
+
* endpoint: process.env.MINIO_ENDPOINT ?? 'http://localhost:60900',
|
|
97
97
|
* forcePathStyle: true,
|
|
98
98
|
* signatureVersion: 'v4',
|
|
99
99
|
* // The `region` is required by the AWS SDK even when using MinIO,
|
package/lib/src/types.d.ts
CHANGED
|
@@ -20,11 +20,11 @@ export type ImageTransformMode = "crop" | "resize";
|
|
|
20
20
|
* the built-in "tiny" preset generates a 50px x 50px cropped preview, which can be accessed
|
|
21
21
|
* by appending the string `preset=tiny` to the asset url:
|
|
22
22
|
*
|
|
23
|
-
* `http://localhost:
|
|
23
|
+
* `http://localhost:6100/assets/some-asset.jpg?preset=tiny`
|
|
24
24
|
*
|
|
25
25
|
* is equivalent to:
|
|
26
26
|
*
|
|
27
|
-
* `http://localhost:
|
|
27
|
+
* `http://localhost:6100/assets/some-asset.jpg?w=50&h=50&mode=crop`
|
|
28
28
|
*
|
|
29
29
|
* @docsCategory core plugins/AssetServerPlugin
|
|
30
30
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deenruv/asset-server-plugin",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"node-fetch": "^2.7.0",
|
|
26
26
|
"rimraf": "^5.0.5",
|
|
27
27
|
"typescript": "5.3.3",
|
|
28
|
-
"@deenruv/
|
|
29
|
-
"@deenruv/
|
|
28
|
+
"@deenruv/common": "^1.0.10",
|
|
29
|
+
"@deenruv/core": "^1.0.10"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@aws-sdk/credential-provider-ini": "^3.664.0",
|