diff --git a/example/next-env.d.ts b/example/next-env.d.ts
index 9bc3dd4..4f11a03 100644
--- a/example/next-env.d.ts
+++ b/example/next-env.d.ts
@@ -1,5 +1,4 @@
///
-///
///
// NOTE: This file should not be edited
diff --git a/example/package.json b/example/package.json
index 20b9da2..b67bc51 100644
--- a/example/package.json
+++ b/example/package.json
@@ -7,17 +7,5 @@
"build": "next build",
"start": "NODE_ENV=production node server.js",
"lint": "next lint"
- },
- "dependencies": {
- "@bitpatty/imgproxy-url-builder": "^0.2.2",
- "next": "12.1.6",
- "react": "^17.0.2",
- "react-dom": "17.0.2"
- },
- "devDependencies": {
- "@types/react": "17.0.27",
- "eslint": "7.32.0",
- "eslint-config-next": "11.1.2",
- "typescript": "4.4.3"
}
}
diff --git a/example/pages/index.tsx b/example/pages/index.tsx
index 47d3610..c6c3b6c 100644
--- a/example/pages/index.tsx
+++ b/example/pages/index.tsx
@@ -32,8 +32,8 @@ const demoContent: {
proxyParams: pb()
.crop({
- width: 30,
- height: 30,
+ width: 100,
+ height: 100,
})
.build(),
},
@@ -43,8 +43,8 @@ const demoContent: {
proxyParams: pb()
.crop({
- width: 30,
- height: 30,
+ width: 200,
+ height: 200,
gravity: {
type: GravityType.NORTHEAST,
offset: {
diff --git a/example/tsconfig.json b/example/tsconfig.json
index 4fa631c..e6bb8eb 100644
--- a/example/tsconfig.json
+++ b/example/tsconfig.json
@@ -1,7 +1,11 @@
{
"compilerOptions": {
"target": "es5",
- "lib": ["dom", "dom.iterable", "esnext"],
+ "lib": [
+ "dom",
+ "dom.iterable",
+ "esnext"
+ ],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
@@ -12,8 +16,15 @@
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
- "jsx": "preserve"
+ "jsx": "preserve",
+ "incremental": true
},
- "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
- "exclude": ["node_modules"]
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx"
+ ],
+ "exclude": [
+ "node_modules"
+ ]
}
diff --git a/package-lock.json b/package-lock.json
index 462e62c..e58f5f9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,17 +1,18 @@
{
"name": "@bitpatty/next-image-s3-imgproxy-loader",
- "version": "0.7.1",
+ "version": "0.8.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@bitpatty/next-image-s3-imgproxy-loader",
- "version": "0.7.1",
+ "version": "0.8.0",
"license": "MIT",
"dependencies": {
- "@bitpatty/imgproxy-url-builder": "^0.4.1"
+ "@bitpatty/imgproxy-url-builder": "^0.6.0"
},
"devDependencies": {
+ "@types/node": "16.11.7",
"@types/react": "18.0.9",
"create-hmac": "1.1.7",
"next": "12.1.6",
@@ -27,9 +28,9 @@
}
},
"node_modules/@bitpatty/imgproxy-url-builder": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/@bitpatty/imgproxy-url-builder/-/imgproxy-url-builder-0.4.1.tgz",
- "integrity": "sha512-g8j4IseWmTHPe4lPG1EdEOp7gWj3SoP+959fZ8Ch+F/cwLk/ko/tB+TgS6NYr7RME+bx29Tvrwzh0vHQUgmdsw=="
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@bitpatty/imgproxy-url-builder/-/imgproxy-url-builder-0.6.0.tgz",
+ "integrity": "sha512-5adq9JqdRcCYUcdq/ephURbGuiljmmdl/qRg3azqgpmBYz0zdZJ4P6lN9elYnPC/W1WmylPqrplLN3maBDl4xQ=="
},
"node_modules/@next/env": {
"version": "12.1.6",
@@ -242,6 +243,12 @@
"node": ">= 8.0.0"
}
},
+ "node_modules/@types/node": {
+ "version": "16.11.7",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.7.tgz",
+ "integrity": "sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==",
+ "dev": true
+ },
"node_modules/@types/prop-types": {
"version": "15.7.5",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
@@ -1047,9 +1054,9 @@
},
"dependencies": {
"@bitpatty/imgproxy-url-builder": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/@bitpatty/imgproxy-url-builder/-/imgproxy-url-builder-0.4.1.tgz",
- "integrity": "sha512-g8j4IseWmTHPe4lPG1EdEOp7gWj3SoP+959fZ8Ch+F/cwLk/ko/tB+TgS6NYr7RME+bx29Tvrwzh0vHQUgmdsw=="
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@bitpatty/imgproxy-url-builder/-/imgproxy-url-builder-0.6.0.tgz",
+ "integrity": "sha512-5adq9JqdRcCYUcdq/ephURbGuiljmmdl/qRg3azqgpmBYz0zdZJ4P6lN9elYnPC/W1WmylPqrplLN3maBDl4xQ=="
},
"@next/env": {
"version": "12.1.6",
@@ -1151,6 +1158,12 @@
"picomatch": "^2.2.2"
}
},
+ "@types/node": {
+ "version": "16.11.7",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.7.tgz",
+ "integrity": "sha512-QB5D2sqfSjCmTuWcBWyJ+/44bcjO7VbjSbOE0ucoVbAsSNQc4Lt6QkgkVXkTDwkL4z/beecZNDvVX15D4P8Jbw==",
+ "dev": true
+ },
"@types/prop-types": {
"version": "15.7.5",
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz",
diff --git a/package.json b/package.json
index 3db5885..f52e018 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "@bitpatty/next-image-s3-imgproxy-loader",
- "version": "0.7.1",
+ "version": "0.8.0",
"description": "imgproxy S3 extension for next/image",
"author": "Matteias Collet ",
"main": "dist/index.js",
@@ -21,6 +21,7 @@
"types": "./dist/index.d.ts",
"homepage": "https://github.com/BitPatty/next-image-s3-imgproxy-loader#readme",
"devDependencies": {
+ "@types/node": "16.11.7",
"@types/react": "18.0.9",
"create-hmac": "1.1.7",
"next": "12.1.6",
@@ -35,6 +36,6 @@
"next": "^11.0.0 || ^12.0.0"
},
"dependencies": {
- "@bitpatty/imgproxy-url-builder": "^0.4.1"
+ "@bitpatty/imgproxy-url-builder": "^0.6.0"
}
}
diff --git a/scripts/minio-restore.sh b/scripts/minio-restore.sh
index 42e6cec..a95f2eb 100755
--- a/scripts/minio-restore.sh
+++ b/scripts/minio-restore.sh
@@ -2,7 +2,8 @@
set -e
SCRIPT_PATH=$(dirname "$0")
echo "Restoring minio files"
-cd $SCRIPT_PATH/../.devcontainer/minio-dump
+cd $SCRIPT_PATH/../.devcontainer/minio-dump/test-bucket
+echo $PWD
minio-cli mb --ignore-existing myminio/test-bucket
minio-cli rm --recursive --force myminio/test-bucket || true
minio-cli cp --recursive . myminio
\ No newline at end of file
diff --git a/src/index.tsx b/src/index.tsx
index 2993019..71276dc 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -23,9 +23,10 @@ const FORWARDED_HEADERS = [
/**
* Builds the final reuest path to retrieve
* an image from the imgproxy instance
- * @param src The source file
- * @param options The imgproxy options
- * @returns The imgproxy request path
+ *
+ * @param src The source file
+ * @param options The imgproxy options
+ * @returns The imgproxy request path
*/
const buildRequestPath = (
src: string,
@@ -40,7 +41,10 @@ const buildRequestPath = (
const { imgproxyParams, signature } = options ?? {};
const paramBuilder = pb();
- if (imgproxyParams) paramBuilder.modifiers.push(imgproxyParams);
+ if (imgproxyParams && imgproxyParams.includes(':')) {
+ // @ts-ignore
+ paramBuilder.modifiers.set('params', imgproxyParams);
+ }
return paramBuilder.build({
path: `s3://${src}`,
@@ -60,11 +64,11 @@ type ImageOptimizerOptions = {
/**
* Handles an image request
- * @param imgproxyBaseUrl The URL to the imgproxy instance
- * @param query The URL query generated by the {@link ImgProxyParamBuilder}
- * @param res The response to which the resulting file should be piped to
- * @param options Optional configuration options for the imgproxy connection
- * @returns
+ *
+ * @param imgproxyBaseUrl The URL to the imgproxy instance
+ * @param query The URL query generated by the {@link ImgProxyParamBuilder}
+ * @param res The response to which the resulting file should be piped to
+ * @param options Optional configuration options for the imgproxy connection
*/
const handle = (
imgproxyBaseUrl: URL,