@vendure/asset-server-plugin 2.0.0-next.8 → 2.0.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.
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.resizeToFocalPoint = exports.transformImage = void 0;
7
7
  const sharp_1 = __importDefault(require("sharp"));
8
+ const common_1 = require("./common");
8
9
  /**
9
10
  * Applies transforms to the given image according to the query params passed.
10
11
  */
@@ -14,6 +15,7 @@ async function transformImage(originalImage, queryParams, presets) {
14
15
  let mode = queryParams.mode || 'crop';
15
16
  const fpx = +queryParams.fpx || undefined;
16
17
  const fpy = +queryParams.fpy || undefined;
18
+ const imageFormat = (0, common_1.getValidFormat)(queryParams.format);
17
19
  if (queryParams.preset) {
18
20
  const matchingPreset = presets.find(p => p.name === queryParams.preset);
19
21
  if (matchingPreset) {
@@ -30,6 +32,7 @@ async function transformImage(originalImage, queryParams, presets) {
30
32
  options.fit = 'inside';
31
33
  }
32
34
  const image = (0, sharp_1.default)(originalImage);
35
+ applyFormat(image, imageFormat);
33
36
  if (fpx && fpy && targetWidth && targetHeight && mode === 'crop') {
34
37
  const metadata = await image.metadata();
35
38
  if (metadata.width && metadata.height) {
@@ -42,6 +45,21 @@ async function transformImage(originalImage, queryParams, presets) {
42
45
  return image.resize(targetWidth, targetHeight, options);
43
46
  }
44
47
  exports.transformImage = transformImage;
48
+ function applyFormat(image, format) {
49
+ switch (format) {
50
+ case 'jpg':
51
+ case 'jpeg':
52
+ return image.jpeg();
53
+ case 'png':
54
+ return image.png();
55
+ case 'webp':
56
+ return image.webp();
57
+ case 'avif':
58
+ return image.avif();
59
+ default:
60
+ return image;
61
+ }
62
+ }
45
63
  /**
46
64
  * Resize an image but keep it centered on the focal point.
47
65
  * Based on the method outlined in https://github.com/lovell/sharp/issues/1198#issuecomment-384591756
@@ -1 +1 @@
1
- {"version":3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AG,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;KAC3F;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAS,KAAK,CAAC,GAAW,EAAE,GAAW,EAAE,KAAa;IAClD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC"}
@@ -1,4 +1,5 @@
1
- import { AssetNamingStrategy, AssetStorageStrategy, RequestContext } from '@vendure/core';
1
+ import { AssetNamingStrategy, AssetPreviewStrategy, AssetStorageStrategy, RequestContext } from '@vendure/core';
2
+ export type ImageTransformFormat = 'jpg' | 'jpeg' | 'png' | 'webp' | 'avif';
2
3
  /**
3
4
  * @description
4
5
  * Specifies the way in which an asset preview image will be resized to fit in the
@@ -8,9 +9,9 @@ import { AssetNamingStrategy, AssetStorageStrategy, RequestContext } from '@vend
8
9
  * * resize: Preserving aspect ratio, resizes the image to be as large as possible
9
10
  * while ensuring its dimensions are less than or equal to both those specified.
10
11
  *
11
- * @docsCategory AssetServerPlugin
12
+ * @docsCategory core plugins/AssetServerPlugin
12
13
  */
13
- export declare type ImageTransformMode = 'crop' | 'resize';
14
+ export type ImageTransformMode = 'crop' | 'resize';
14
15
  /**
15
16
  * @description
16
17
  * A configuration option for an image size preset for the AssetServerPlugin.
@@ -25,7 +26,7 @@ export declare type ImageTransformMode = 'crop' | 'resize';
25
26
  *
26
27
  * `http://localhost:3000/assets/some-asset.jpg?w=50&h=50&mode=crop`
27
28
  *
28
- * @docsCategory AssetServerPlugin
29
+ * @docsCategory core plugins/AssetServerPlugin
29
30
  */
30
31
  export interface ImageTransformPreset {
31
32
  name: string;
@@ -33,11 +34,30 @@ export interface ImageTransformPreset {
33
34
  height: number;
34
35
  mode: ImageTransformMode;
35
36
  }
37
+ /**
38
+ * @description
39
+ * A configuration option for the Cache-Control header in the AssetServerPlugin asset response.
40
+ *
41
+ * @docsCategory core plugins/AssetServerPlugin
42
+ */
43
+ export type CacheConfig = {
44
+ /**
45
+ * @description
46
+ * The max-age=N response directive indicates that the response remains fresh until N seconds after the response is generated.
47
+ */
48
+ maxAge: number;
49
+ /**
50
+ * @description
51
+ * The `private` response directive indicates that the response can be stored only in a private cache (e.g. local caches in browsers).
52
+ * The `public` response directive indicates that the response can be stored in a shared cache.
53
+ */
54
+ restriction?: 'public' | 'private';
55
+ };
36
56
  /**
37
57
  * @description
38
58
  * The configuration options for the AssetServerPlugin.
39
59
  *
40
- * @docsCategory AssetServerPlugin
60
+ * @docsCategory core plugins/AssetServerPlugin
41
61
  */
42
62
  export interface AssetServerOptions {
43
63
  /**
@@ -66,6 +86,7 @@ export interface AssetServerOptions {
66
86
  * The max width in pixels of a generated preview image.
67
87
  *
68
88
  * @default 1600
89
+ * @deprecated Use `previewStrategy: new SharpAssetPreviewStrategy({ maxWidth })` instead
69
90
  */
70
91
  previewMaxWidth?: number;
71
92
  /**
@@ -73,6 +94,7 @@ export interface AssetServerOptions {
73
94
  * The max height in pixels of a generated preview image.
74
95
  *
75
96
  * @default 1600
97
+ * @deprecated Use `previewStrategy: new SharpAssetPreviewStrategy({ maxHeight })` instead
76
98
  */
77
99
  previewMaxHeight?: number;
78
100
  /**
@@ -87,6 +109,14 @@ export interface AssetServerOptions {
87
109
  * @default HashedAssetNamingStrategy
88
110
  */
89
111
  namingStrategy?: AssetNamingStrategy;
112
+ /**
113
+ * @description
114
+ * Defines how previews are generated for a given Asset binary. By default, this uses
115
+ * the {@link SharpAssetPreviewStrategy}
116
+ *
117
+ * @since 1.7.0
118
+ */
119
+ previewStrategy?: AssetPreviewStrategy;
90
120
  /**
91
121
  * @description
92
122
  * A function which can be used to configure an {@link AssetStorageStrategy}. This is useful e.g. if you wish to store your assets
@@ -95,4 +125,13 @@ export interface AssetServerOptions {
95
125
  * @default () => LocalAssetStorageStrategy
96
126
  */
97
127
  storageStrategyFactory?: (options: AssetServerOptions) => AssetStorageStrategy | Promise<AssetStorageStrategy>;
128
+ /**
129
+ * @description
130
+ * Configures the `Cache-Control` directive for response to control caching in browsers and shared caches (e.g. Proxies, CDNs).
131
+ * Defaults to publicly cached for 6 months.
132
+ *
133
+ * @default 'public, max-age=15552000'
134
+ * @since 1.9.3
135
+ */
136
+ cacheHeader?: CacheConfig | string;
98
137
  }
package/package.json CHANGED
@@ -1,41 +1,43 @@
1
1
  {
2
- "name": "@vendure/asset-server-plugin",
3
- "version": "2.0.0-next.8",
4
- "main": "lib/index.js",
5
- "types": "lib/index.d.ts",
6
- "files": [
7
- "lib/**/*"
8
- ],
9
- "license": "MIT",
10
- "scripts": {
11
- "watch": "tsc -p ./tsconfig.build.json --watch",
12
- "build": "rimraf lib && tsc -p ./tsconfig.build.json && node build.js",
13
- "lint": "tslint --fix --project ./",
14
- "test": "jest --config ./jest.config.js",
15
- "e2e": "jest --config ../../e2e-common/jest-config.js --package=asset-server-plugin"
16
- },
17
- "homepage": "https://www.vendure.io/",
18
- "funding": "https://github.com/sponsors/michaelbromley",
19
- "publishConfig": {
20
- "access": "public"
21
- },
22
- "devDependencies": {
23
- "@types/express": "^4.17.8",
24
- "@types/fs-extra": "^9.0.8",
25
- "@types/node-fetch": "^2.5.8",
26
- "@types/sharp": "^0.29.5",
27
- "@vendure/common": "^2.0.0-next.8",
28
- "@vendure/core": "^2.0.0-next.8",
29
- "aws-sdk": "^2.856.0",
30
- "express": "^4.17.1",
31
- "node-fetch": "^2.6.7",
32
- "rimraf": "^3.0.2",
33
- "typescript": "4.5.5"
34
- },
35
- "dependencies": {
36
- "file-type": "^16.5.3",
37
- "fs-extra": "^10.0.0",
38
- "sharp": "~0.30.1"
39
- },
40
- "gitHead": "817b49e80bbfe6f1feeda1cdab0be45d887e689f"
2
+ "name": "@vendure/asset-server-plugin",
3
+ "version": "2.0.0",
4
+ "main": "lib/index.js",
5
+ "types": "lib/index.d.ts",
6
+ "files": [
7
+ "lib/**/*"
8
+ ],
9
+ "license": "MIT",
10
+ "scripts": {
11
+ "watch": "tsc -p ./tsconfig.build.json --watch",
12
+ "build": "rimraf lib && tsc -p ./tsconfig.build.json && node build.js",
13
+ "lint": "eslint --fix .",
14
+ "test": "vitest --run",
15
+ "e2e": "cross-env PACKAGE=asset-server-plugin vitest --config ../../e2e-common/vitest.config.ts --run",
16
+ "e2e:watch": "cross-env PACKAGE=asset-server-plugin vitest --config ../../e2e-common/vitest.config.ts"
17
+ },
18
+ "homepage": "https://www.vendure.io/",
19
+ "funding": "https://github.com/sponsors/michaelbromley",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "devDependencies": {
24
+ "@aws-sdk/client-s3": "^3.312.0",
25
+ "@aws-sdk/lib-storage": "^3.312.0",
26
+ "@types/express": "^4.17.8",
27
+ "@types/fs-extra": "^9.0.8",
28
+ "@types/node-fetch": "^2.5.8",
29
+ "@types/sharp": "^0.30.4",
30
+ "@vendure/common": "^2.0.0",
31
+ "@vendure/core": "^2.0.0",
32
+ "express": "^4.17.1",
33
+ "node-fetch": "^2.6.7",
34
+ "rimraf": "^3.0.2",
35
+ "typescript": "4.9.5"
36
+ },
37
+ "dependencies": {
38
+ "file-type": "^16.5.3",
39
+ "fs-extra": "^10.0.0",
40
+ "sharp": "~0.31.2"
41
+ },
42
+ "gitHead": "302bd68796e0136f70dd199369616d362c920ea4"
41
43
  }