From 4711fee7ad8db8c4a4db9038d2697f6cfa5f0fe2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Jun 2021 18:11:13 +0200 Subject: [PATCH 1/4] chore(deps): update all non-major dependencies (#310) Co-authored-by: Renovate Bot --- example/package.json | 4 +- example/yarn.lock | 158 ++++++++++++++++++++++--------------------- package.json | 4 +- yarn.lock | 156 +++++++++++++++++++++--------------------- 4 files changed, 162 insertions(+), 160 deletions(-) diff --git a/example/package.json b/example/package.json index 5984b101e..1853eba65 100644 --- a/example/package.json +++ b/example/package.json @@ -7,8 +7,8 @@ "start": "nuxt start" }, "devDependencies": { - "@nuxt/image": "^0.4.13", - "nuxt": "^2.15.6", + "@nuxt/image": "^0.4.17", + "nuxt": "^2.15.7", "nuxt-vite": "^0.1.1" } } diff --git a/example/yarn.lock b/example/yarn.lock index 4d5ee109e..c37e7b2ae 100644 --- a/example/yarn.lock +++ b/example/yarn.lock @@ -953,10 +953,10 @@ mkdirp "^1.0.4" rimraf "^3.0.2" -"@nuxt/babel-preset-app@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/babel-preset-app/-/babel-preset-app-2.15.6.tgz#cda22f236fcea30189982b75225747122e7b14a3" - integrity sha512-N5K5D3hSQhIrRBCvJDQHX3LaQIj98pmxg0Emoe6ZJG7NH4j2jcGjGeADLXh1KYl0JyOoyg46FpP/lxhQYcV3aQ== +"@nuxt/babel-preset-app@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/babel-preset-app/-/babel-preset-app-2.15.7.tgz#5f51b2f5f4aa604cc80d2a5698b97dd34e19d63b" + integrity sha512-iSdnacldHhIinWpzVpX4QfEFgNqn3VQAAB7y6iQ0JELUgfv7sPv3j3Klih+IStru4iCbUKOaSCdQ+A6mbQ0vNg== dependencies: "@babel/compat-data" "^7.14.0" "@babel/core" "^7.14.0" @@ -975,15 +975,15 @@ core-js-compat "^3.12.1" regenerator-runtime "^0.13.7" -"@nuxt/builder@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/builder/-/builder-2.15.6.tgz#61f6a0727d3af4672838e62627ceaba07f18d6d0" - integrity sha512-m5kdq5vXaW2AB/nVwXKEcqqFMJ1ydl1sOW2MvxO8eyrmKzJyiQ7D4TZQnjmERzVPj3FhAhPKgVCP2FPpacoBFw== +"@nuxt/builder@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/builder/-/builder-2.15.7.tgz#4703c9d21756128f4ebfbf14e7b099bee7463626" + integrity sha512-vVZvcgvhL05Omp9AuqdDz2zfhBOmCXpVyt1IBUqR99QaorLICGg2iIHC42exj9yN3rBrpURQwb1OrIgt5o5KDQ== dependencies: "@nuxt/devalue" "^1.2.5" - "@nuxt/utils" "2.15.6" - "@nuxt/vue-app" "2.15.6" - "@nuxt/webpack" "2.15.6" + "@nuxt/utils" "2.15.7" + "@nuxt/vue-app" "2.15.7" + "@nuxt/webpack" "2.15.7" chalk "^4.1.1" chokidar "^3.5.1" consola "^2.15.3" @@ -996,13 +996,13 @@ serialize-javascript "^5.0.1" upath "^2.0.1" -"@nuxt/cli@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/cli/-/cli-2.15.6.tgz#33f6c3add01477af60b8a93b73464c1f539d872b" - integrity sha512-vlFiF1444SqseMxhmOpm1sNgTdSuHth8YiMoxpIZr5RnKxjD523A04ozMFcEAkbQLELkKMlW3LttvDzulLC+hA== +"@nuxt/cli@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/cli/-/cli-2.15.7.tgz#21fb8a969bc5e222aa95289fcccc44f9ff7c5549" + integrity sha512-rbJqmHuN+ZftSpQNzgiaGP2L2pt45kCbWjCmLUF9pPYQ1pysl9GHVb+1LFf1Wn4wczJckH3Jc9Pl9r2KsLAteA== dependencies: - "@nuxt/config" "2.15.6" - "@nuxt/utils" "2.15.6" + "@nuxt/config" "2.15.7" + "@nuxt/utils" "2.15.7" boxen "^5.0.1" chalk "^4.1.1" compression "^1.7.4" @@ -1040,12 +1040,12 @@ upath "^2.0.1" vue-template-compiler "^2.6.12" -"@nuxt/config@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/config/-/config-2.15.6.tgz#8a476b08c0d55f441dcf704c7e8f59a9d731dfff" - integrity sha512-3HG7s3f5s5CfkoKNjCVBJA8v8mfej0EZ4pQ/NtH7Q11TAVOrpfQ7mlV1dy/syMMkQ6ykKIPOxRilpz1gc+fBjQ== +"@nuxt/config@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/config/-/config-2.15.7.tgz#960c6e85610f5aa63ab5e3bc6e3f611ad935df3b" + integrity sha512-XswQJOcxSR5CBLW5ZFtbyBAO2/yYrHjK5CE+5aaidzEgXjnmw3qnVOxxVHKWNpM42+35Ysu8RmZzRg4qw+Nxjw== dependencies: - "@nuxt/utils" "2.15.6" + "@nuxt/utils" "2.15.7" consola "^2.15.3" defu "^4.0.1" destr "^1.1.0" @@ -1055,14 +1055,14 @@ std-env "^2.3.0" ufo "^0.7.4" -"@nuxt/core@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/core/-/core-2.15.6.tgz#8532d3d389de3cef54c399fd48f1c9b76aa54376" - integrity sha512-f31dPCpMEHOQbWVOhcnXpC7pB4qo2PI3C9NkAkyFRhdMGw3+029T6oOHj+ZPWhR2f2hxwcIGonxOLFFmh/HBuw== +"@nuxt/core@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/core/-/core-2.15.7.tgz#fb0e56759da33a2bff322a5331cc44b3a4274bf0" + integrity sha512-+Drmkx+xp4WBpxRxAtMUpTUxystNV6nj6TuYInWvnhyFoCMJm0ES7ij8UfWOZo8FQjleBzVcucrTTh+AjRgmnQ== dependencies: - "@nuxt/config" "2.15.6" - "@nuxt/server" "2.15.6" - "@nuxt/utils" "2.15.6" + "@nuxt/config" "2.15.7" + "@nuxt/server" "2.15.7" + "@nuxt/utils" "2.15.7" consola "^2.15.3" fs-extra "^9.1.0" hable "^3.0.0" @@ -1086,12 +1086,12 @@ error-stack-parser "^2.0.0" string-width "^2.0.0" -"@nuxt/generator@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/generator/-/generator-2.15.6.tgz#309dbb1b70294c8939b5944364442b0998be9a6c" - integrity sha512-dIZEl0IuLOrpieLRIEAizjPE86EaptISyFuL4+wHr2aGsN/RK6x5EuaQPK3jV7FKUEluHAL3vnImkXRBT19ckA== +"@nuxt/generator@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/generator/-/generator-2.15.7.tgz#bac30a1cc277c12b6f61fa93bb4d9e731992e249" + integrity sha512-TlgWzVh7bTusaUCYqg6kZm62sr/TVWKU2V2ymhhLoiKaSP7dMK9PNVgnh9EXeIf5TD6zDzDOgo6j4eZOhO1dng== dependencies: - "@nuxt/utils" "2.15.6" + "@nuxt/utils" "2.15.7" chalk "^4.1.1" consola "^2.15.3" defu "^4.0.1" @@ -1115,11 +1115,12 @@ node-fetch "^2.6.1" web-streams-polyfill "^3.0.1" -"@nuxt/image@^0.4.13": - version "0.4.13" - resolved "https://registry.yarnpkg.com/@nuxt/image/-/image-0.4.13.tgz#41e5d2ff7b642e40fd867d6d62d94c8f07152d63" - integrity sha512-IKUlptS7AUpYLvd3r96BaFaZcjQcDJQBwuFZEzfZfk9F7Ckum/rLqc3l4RSLiX3Fhw1oDeUw2eqTftxmN8L1rA== +"@nuxt/image@^0.4.17": + version "0.4.17" + resolved "https://registry.yarnpkg.com/@nuxt/image/-/image-0.4.17.tgz#35eaf2de4c475839e9c7f12029510c2252998839" + integrity sha512-5eOGIpNHqugq0nKZzSM5BsYew9Akbx9RjIZdajxRU9J2CU//E43QY+fZh2BUCPQZkUYJWcDWo8qYexJyQzdMWg== dependencies: + consola "^2.15.3" defu "^5.0.0" fs-extra "^10.0.0" hasha "^5.2.2" @@ -1131,6 +1132,7 @@ p-limit "^3.1.0" rc9 "^1.2.0" requrl "^3.0.2" + semver "^7.3.5" ufo "^0.7.5" upath "^2.0.1" @@ -1154,13 +1156,13 @@ consola "^2.15.0" node-fetch "^2.6.1" -"@nuxt/server@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/server/-/server-2.15.6.tgz#d514c2f8f6d640fb97e785a7927103e751ebed05" - integrity sha512-lyqyHCBX5oMW3paHtTKC0flQddm1VhL/+itM+wkiJ4c5dh9peIcizKIVKG1xE9dS+8q0MwI48DqtO35Ogef53w== +"@nuxt/server@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/server/-/server-2.15.7.tgz#cd93b92d7256eaaa40794fd7ed997bdd9929ce54" + integrity sha512-VyE7SCB/mpaJKnOuEZTJD9LESELPGXqEXnoWnqYWbgn8mmZYafT5Yto/26T+1TZkxXl8CH23Qa2VWVJR/OOATg== dependencies: - "@nuxt/utils" "2.15.6" - "@nuxt/vue-renderer" "2.15.6" + "@nuxt/utils" "2.15.7" + "@nuxt/vue-renderer" "2.15.7" "@nuxtjs/youch" "^4.2.3" compression "^1.7.4" connect "^3.7.0" @@ -1201,10 +1203,10 @@ rc9 "^1.2.0" std-env "^2.3.0" -"@nuxt/utils@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/utils/-/utils-2.15.6.tgz#ec827f640f9a1a3dc5faa0d23191378759913205" - integrity sha512-PExDIbNRAc317pUwEEIKxSSdYiRLkgGNLu9GxrcVrwo4BxuRI+UIBoJdKXMRiIIc+FkTQdj+MiOFGHs6TQjJug== +"@nuxt/utils@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/utils/-/utils-2.15.7.tgz#686c8e06c30c02b2af3b15f8bdd48e10a813766b" + integrity sha512-C8K3DAzJ8+PMRDBnYBxJpZunwmmMWRry8JvyZO7RyLWoHTK/GFndaF4mLIXWiXK2cpIJ3v2PInz+hJXZHkWKTQ== dependencies: consola "^2.15.3" create-require "^1.1.1" @@ -1219,10 +1221,10 @@ ua-parser-js "^0.7.28" ufo "^0.7.4" -"@nuxt/vue-app@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/vue-app/-/vue-app-2.15.6.tgz#0be8b7bd9961eada3f1c7893229a310991f8dc0d" - integrity sha512-BI40rm5+LI/RdyKM/7+1fCZ8EAzbg8d1vXCwA/cPy04w1zwA6DEwBFkfYvmgTzbkHPPIPu7nN+0Uh0lfCiomBQ== +"@nuxt/vue-app@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/vue-app/-/vue-app-2.15.7.tgz#159908f1900e5bb7f6e1672dd9a407afb2d84396" + integrity sha512-TjJ3fkA6797/EzejFjkUbsDxwvI0SeoS5SiP19axLkSEJKHRv2ME4vIN7BbmMflCmot/wXHHUxH7gWPUFKKsUA== dependencies: node-fetch "^2.6.1" ufo "^0.7.4" @@ -1235,13 +1237,13 @@ vue-template-compiler "^2.6.12" vuex "^3.6.2" -"@nuxt/vue-renderer@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/vue-renderer/-/vue-renderer-2.15.6.tgz#26329bf50bbd479b8fa3ea93ba7e927774ddec46" - integrity sha512-MPs0oS99mQ7yUoc91HcvX46XjquHocrpvKVjVUia/dJGk2UFfb1/PZW3G4a69wOQOx2Xh9uibe0/NjjegZ+40g== +"@nuxt/vue-renderer@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/vue-renderer/-/vue-renderer-2.15.7.tgz#9a18a366d7602eed20b437f658e086e40ae79914" + integrity sha512-B3NL5VE0Y17+v55AX/h4SfcB8njVnUlC0KvOQTxem6HB0b01K9Un4zgVce1+p4yMKOI19v/K6B2dAWuSw6wCYA== dependencies: "@nuxt/devalue" "^1.2.5" - "@nuxt/utils" "2.15.6" + "@nuxt/utils" "2.15.7" consola "^2.15.3" defu "^4.0.1" fs-extra "^9.1.0" @@ -1252,15 +1254,15 @@ vue-meta "^2.4.0" vue-server-renderer "^2.6.12" -"@nuxt/webpack@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/webpack/-/webpack-2.15.6.tgz#694f236b47643deb704ddded8acc256524b68605" - integrity sha512-Ozy5jVeUzLITyL79520+Rf/s36X1cQezLFPzSMhUtiH4sT5oRvmb6TxP/2S1i7meKJhARkeBiVEzgX3M/K9TTw== +"@nuxt/webpack@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/webpack/-/webpack-2.15.7.tgz#79fe5e751e9cd90219160ecdd97a1ea801636092" + integrity sha512-cVWBDfFVsjfBX628wM6tubMzbX1AnNilJQb90XBb92Gbx9EKwKNqRQMONqerzW0CFtq4/mv8kUUUVg2fpUVzcw== dependencies: "@babel/core" "^7.14.0" - "@nuxt/babel-preset-app" "2.15.6" + "@nuxt/babel-preset-app" "2.15.7" "@nuxt/friendly-errors-webpack-plugin" "^2.5.1" - "@nuxt/utils" "2.15.6" + "@nuxt/utils" "2.15.7" babel-loader "^8.2.2" cache-loader "^4.1.0" caniuse-lite "^1.0.30001228" @@ -5997,26 +5999,26 @@ nuxt-vite@^0.1.1: vite "^2.3.4" vite-plugin-vue2 "^1.5.1" -nuxt@^2.15.6: - version "2.15.6" - resolved "https://registry.yarnpkg.com/nuxt/-/nuxt-2.15.6.tgz#628ff86d57c1d4671802777635ce7fd2c24f9091" - integrity sha512-smhzRJPdqg+coUfZwMyuUGKULbIkdawrFcypya15ByKAceWIhLjkOls64dnH574wpZQxA8bugFjGn3ih26eSFg== +nuxt@^2.15.7: + version "2.15.7" + resolved "https://registry.yarnpkg.com/nuxt/-/nuxt-2.15.7.tgz#45332e3b00ba5c1cf04688d42373c8ed7ef4dca7" + integrity sha512-opxIwaiX4/MvPD5yHEHvtPSEkQKPxg4WPscstnvWC8zX2n74/3DzlNQQAbxtLngW7tze9wsWavxgSMtJXsA8Uw== dependencies: - "@nuxt/babel-preset-app" "2.15.6" - "@nuxt/builder" "2.15.6" - "@nuxt/cli" "2.15.6" + "@nuxt/babel-preset-app" "2.15.7" + "@nuxt/builder" "2.15.7" + "@nuxt/cli" "2.15.7" "@nuxt/components" "^2.1.8" - "@nuxt/config" "2.15.6" - "@nuxt/core" "2.15.6" - "@nuxt/generator" "2.15.6" + "@nuxt/config" "2.15.7" + "@nuxt/core" "2.15.7" + "@nuxt/generator" "2.15.7" "@nuxt/loading-screen" "^2.0.3" "@nuxt/opencollective" "^0.3.2" - "@nuxt/server" "2.15.6" + "@nuxt/server" "2.15.7" "@nuxt/telemetry" "^1.3.3" - "@nuxt/utils" "2.15.6" - "@nuxt/vue-app" "2.15.6" - "@nuxt/vue-renderer" "2.15.6" - "@nuxt/webpack" "2.15.6" + "@nuxt/utils" "2.15.7" + "@nuxt/vue-app" "2.15.7" + "@nuxt/vue-renderer" "2.15.7" + "@nuxt/webpack" "2.15.7" object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" diff --git a/package.json b/package.json index 68114632e..a068e7690 100755 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "fs-extra": "^10.0.0", "hasha": "^5.2.2", "image-meta": "^0.0.1", - "ipx": "^0.6.1", + "ipx": "^0.6.2", "is-https": "^4.0.0", "lru-cache": "^6.0.0", "node-fetch": "^2.6.1", @@ -62,7 +62,7 @@ "jsdom": "latest", "jsdom-global": "latest", "mkdist": "latest", - "nuxt": "^2.15.6", + "nuxt": "^2.15.7", "playwright": "latest", "siroc": "latest", "standard-version": "latest", diff --git a/yarn.lock b/yarn.lock index 4c464b0b2..b1784f6ad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1220,10 +1220,10 @@ mkdirp "^1.0.4" rimraf "^3.0.2" -"@nuxt/babel-preset-app@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/babel-preset-app/-/babel-preset-app-2.15.6.tgz#cda22f236fcea30189982b75225747122e7b14a3" - integrity sha512-N5K5D3hSQhIrRBCvJDQHX3LaQIj98pmxg0Emoe6ZJG7NH4j2jcGjGeADLXh1KYl0JyOoyg46FpP/lxhQYcV3aQ== +"@nuxt/babel-preset-app@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/babel-preset-app/-/babel-preset-app-2.15.7.tgz#5f51b2f5f4aa604cc80d2a5698b97dd34e19d63b" + integrity sha512-iSdnacldHhIinWpzVpX4QfEFgNqn3VQAAB7y6iQ0JELUgfv7sPv3j3Klih+IStru4iCbUKOaSCdQ+A6mbQ0vNg== dependencies: "@babel/compat-data" "^7.14.0" "@babel/core" "^7.14.0" @@ -1242,15 +1242,15 @@ core-js-compat "^3.12.1" regenerator-runtime "^0.13.7" -"@nuxt/builder@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/builder/-/builder-2.15.6.tgz#61f6a0727d3af4672838e62627ceaba07f18d6d0" - integrity sha512-m5kdq5vXaW2AB/nVwXKEcqqFMJ1ydl1sOW2MvxO8eyrmKzJyiQ7D4TZQnjmERzVPj3FhAhPKgVCP2FPpacoBFw== +"@nuxt/builder@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/builder/-/builder-2.15.7.tgz#4703c9d21756128f4ebfbf14e7b099bee7463626" + integrity sha512-vVZvcgvhL05Omp9AuqdDz2zfhBOmCXpVyt1IBUqR99QaorLICGg2iIHC42exj9yN3rBrpURQwb1OrIgt5o5KDQ== dependencies: "@nuxt/devalue" "^1.2.5" - "@nuxt/utils" "2.15.6" - "@nuxt/vue-app" "2.15.6" - "@nuxt/webpack" "2.15.6" + "@nuxt/utils" "2.15.7" + "@nuxt/vue-app" "2.15.7" + "@nuxt/webpack" "2.15.7" chalk "^4.1.1" chokidar "^3.5.1" consola "^2.15.3" @@ -1263,13 +1263,13 @@ serialize-javascript "^5.0.1" upath "^2.0.1" -"@nuxt/cli@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/cli/-/cli-2.15.6.tgz#33f6c3add01477af60b8a93b73464c1f539d872b" - integrity sha512-vlFiF1444SqseMxhmOpm1sNgTdSuHth8YiMoxpIZr5RnKxjD523A04ozMFcEAkbQLELkKMlW3LttvDzulLC+hA== +"@nuxt/cli@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/cli/-/cli-2.15.7.tgz#21fb8a969bc5e222aa95289fcccc44f9ff7c5549" + integrity sha512-rbJqmHuN+ZftSpQNzgiaGP2L2pt45kCbWjCmLUF9pPYQ1pysl9GHVb+1LFf1Wn4wczJckH3Jc9Pl9r2KsLAteA== dependencies: - "@nuxt/config" "2.15.6" - "@nuxt/utils" "2.15.6" + "@nuxt/config" "2.15.7" + "@nuxt/utils" "2.15.7" boxen "^5.0.1" chalk "^4.1.1" compression "^1.7.4" @@ -1307,12 +1307,12 @@ upath "^2.0.1" vue-template-compiler "^2.6.12" -"@nuxt/config@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/config/-/config-2.15.6.tgz#8a476b08c0d55f441dcf704c7e8f59a9d731dfff" - integrity sha512-3HG7s3f5s5CfkoKNjCVBJA8v8mfej0EZ4pQ/NtH7Q11TAVOrpfQ7mlV1dy/syMMkQ6ykKIPOxRilpz1gc+fBjQ== +"@nuxt/config@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/config/-/config-2.15.7.tgz#960c6e85610f5aa63ab5e3bc6e3f611ad935df3b" + integrity sha512-XswQJOcxSR5CBLW5ZFtbyBAO2/yYrHjK5CE+5aaidzEgXjnmw3qnVOxxVHKWNpM42+35Ysu8RmZzRg4qw+Nxjw== dependencies: - "@nuxt/utils" "2.15.6" + "@nuxt/utils" "2.15.7" consola "^2.15.3" defu "^4.0.1" destr "^1.1.0" @@ -1322,14 +1322,14 @@ std-env "^2.3.0" ufo "^0.7.4" -"@nuxt/core@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/core/-/core-2.15.6.tgz#8532d3d389de3cef54c399fd48f1c9b76aa54376" - integrity sha512-f31dPCpMEHOQbWVOhcnXpC7pB4qo2PI3C9NkAkyFRhdMGw3+029T6oOHj+ZPWhR2f2hxwcIGonxOLFFmh/HBuw== +"@nuxt/core@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/core/-/core-2.15.7.tgz#fb0e56759da33a2bff322a5331cc44b3a4274bf0" + integrity sha512-+Drmkx+xp4WBpxRxAtMUpTUxystNV6nj6TuYInWvnhyFoCMJm0ES7ij8UfWOZo8FQjleBzVcucrTTh+AjRgmnQ== dependencies: - "@nuxt/config" "2.15.6" - "@nuxt/server" "2.15.6" - "@nuxt/utils" "2.15.6" + "@nuxt/config" "2.15.7" + "@nuxt/server" "2.15.7" + "@nuxt/utils" "2.15.7" consola "^2.15.3" fs-extra "^9.1.0" hable "^3.0.0" @@ -1353,12 +1353,12 @@ error-stack-parser "^2.0.0" string-width "^2.0.0" -"@nuxt/generator@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/generator/-/generator-2.15.6.tgz#309dbb1b70294c8939b5944364442b0998be9a6c" - integrity sha512-dIZEl0IuLOrpieLRIEAizjPE86EaptISyFuL4+wHr2aGsN/RK6x5EuaQPK3jV7FKUEluHAL3vnImkXRBT19ckA== +"@nuxt/generator@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/generator/-/generator-2.15.7.tgz#bac30a1cc277c12b6f61fa93bb4d9e731992e249" + integrity sha512-TlgWzVh7bTusaUCYqg6kZm62sr/TVWKU2V2ymhhLoiKaSP7dMK9PNVgnh9EXeIf5TD6zDzDOgo6j4eZOhO1dng== dependencies: - "@nuxt/utils" "2.15.6" + "@nuxt/utils" "2.15.7" chalk "^4.1.1" consola "^2.15.3" defu "^4.0.1" @@ -1388,13 +1388,13 @@ consola "^2.15.0" node-fetch "^2.6.1" -"@nuxt/server@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/server/-/server-2.15.6.tgz#d514c2f8f6d640fb97e785a7927103e751ebed05" - integrity sha512-lyqyHCBX5oMW3paHtTKC0flQddm1VhL/+itM+wkiJ4c5dh9peIcizKIVKG1xE9dS+8q0MwI48DqtO35Ogef53w== +"@nuxt/server@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/server/-/server-2.15.7.tgz#cd93b92d7256eaaa40794fd7ed997bdd9929ce54" + integrity sha512-VyE7SCB/mpaJKnOuEZTJD9LESELPGXqEXnoWnqYWbgn8mmZYafT5Yto/26T+1TZkxXl8CH23Qa2VWVJR/OOATg== dependencies: - "@nuxt/utils" "2.15.6" - "@nuxt/vue-renderer" "2.15.6" + "@nuxt/utils" "2.15.7" + "@nuxt/vue-renderer" "2.15.7" "@nuxtjs/youch" "^4.2.3" compression "^1.7.4" connect "^3.7.0" @@ -1489,10 +1489,10 @@ ts-node "^9.1.1" typescript "~4.2" -"@nuxt/utils@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/utils/-/utils-2.15.6.tgz#ec827f640f9a1a3dc5faa0d23191378759913205" - integrity sha512-PExDIbNRAc317pUwEEIKxSSdYiRLkgGNLu9GxrcVrwo4BxuRI+UIBoJdKXMRiIIc+FkTQdj+MiOFGHs6TQjJug== +"@nuxt/utils@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/utils/-/utils-2.15.7.tgz#686c8e06c30c02b2af3b15f8bdd48e10a813766b" + integrity sha512-C8K3DAzJ8+PMRDBnYBxJpZunwmmMWRry8JvyZO7RyLWoHTK/GFndaF4mLIXWiXK2cpIJ3v2PInz+hJXZHkWKTQ== dependencies: consola "^2.15.3" create-require "^1.1.1" @@ -1507,10 +1507,10 @@ ua-parser-js "^0.7.28" ufo "^0.7.4" -"@nuxt/vue-app@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/vue-app/-/vue-app-2.15.6.tgz#0be8b7bd9961eada3f1c7893229a310991f8dc0d" - integrity sha512-BI40rm5+LI/RdyKM/7+1fCZ8EAzbg8d1vXCwA/cPy04w1zwA6DEwBFkfYvmgTzbkHPPIPu7nN+0Uh0lfCiomBQ== +"@nuxt/vue-app@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/vue-app/-/vue-app-2.15.7.tgz#159908f1900e5bb7f6e1672dd9a407afb2d84396" + integrity sha512-TjJ3fkA6797/EzejFjkUbsDxwvI0SeoS5SiP19axLkSEJKHRv2ME4vIN7BbmMflCmot/wXHHUxH7gWPUFKKsUA== dependencies: node-fetch "^2.6.1" ufo "^0.7.4" @@ -1523,13 +1523,13 @@ vue-template-compiler "^2.6.12" vuex "^3.6.2" -"@nuxt/vue-renderer@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/vue-renderer/-/vue-renderer-2.15.6.tgz#26329bf50bbd479b8fa3ea93ba7e927774ddec46" - integrity sha512-MPs0oS99mQ7yUoc91HcvX46XjquHocrpvKVjVUia/dJGk2UFfb1/PZW3G4a69wOQOx2Xh9uibe0/NjjegZ+40g== +"@nuxt/vue-renderer@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/vue-renderer/-/vue-renderer-2.15.7.tgz#9a18a366d7602eed20b437f658e086e40ae79914" + integrity sha512-B3NL5VE0Y17+v55AX/h4SfcB8njVnUlC0KvOQTxem6HB0b01K9Un4zgVce1+p4yMKOI19v/K6B2dAWuSw6wCYA== dependencies: "@nuxt/devalue" "^1.2.5" - "@nuxt/utils" "2.15.6" + "@nuxt/utils" "2.15.7" consola "^2.15.3" defu "^4.0.1" fs-extra "^9.1.0" @@ -1540,15 +1540,15 @@ vue-meta "^2.4.0" vue-server-renderer "^2.6.12" -"@nuxt/webpack@2.15.6": - version "2.15.6" - resolved "https://registry.yarnpkg.com/@nuxt/webpack/-/webpack-2.15.6.tgz#694f236b47643deb704ddded8acc256524b68605" - integrity sha512-Ozy5jVeUzLITyL79520+Rf/s36X1cQezLFPzSMhUtiH4sT5oRvmb6TxP/2S1i7meKJhARkeBiVEzgX3M/K9TTw== +"@nuxt/webpack@2.15.7": + version "2.15.7" + resolved "https://registry.yarnpkg.com/@nuxt/webpack/-/webpack-2.15.7.tgz#79fe5e751e9cd90219160ecdd97a1ea801636092" + integrity sha512-cVWBDfFVsjfBX628wM6tubMzbX1AnNilJQb90XBb92Gbx9EKwKNqRQMONqerzW0CFtq4/mv8kUUUVg2fpUVzcw== dependencies: "@babel/core" "^7.14.0" - "@nuxt/babel-preset-app" "2.15.6" + "@nuxt/babel-preset-app" "2.15.7" "@nuxt/friendly-errors-webpack-plugin" "^2.5.1" - "@nuxt/utils" "2.15.6" + "@nuxt/utils" "2.15.7" babel-loader "^8.2.2" cache-loader "^4.1.0" caniuse-lite "^1.0.30001228" @@ -6619,10 +6619,10 @@ ip@^1.1.5: resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.5.tgz#bdded70114290828c0a039e72ef25f5aaec4354a" integrity sha1-vd7XARQpCCjAoDnnLvJfWq7ENUo= -ipx@^0.6.1: - version "0.6.1" - resolved "https://registry.yarnpkg.com/ipx/-/ipx-0.6.1.tgz#e3319399b94221d51b1e7b6978b8b4a2cfdf8200" - integrity sha512-DL6V+ZrwqFqwgAMUV5dKATUQrXPzFbmeCykmvRLp8ih5WwnNjDOS8yMkCzdRXJgp3PRP0A9CbnYg/Hl4yWBW8w== +ipx@^0.6.2: + version "0.6.2" + resolved "https://registry.yarnpkg.com/ipx/-/ipx-0.6.2.tgz#2e831e6632a46f336794fb60d28b63f6db3483c9" + integrity sha512-yrX/zI2rNJPIM3F84KuIJ5GhLsrEYBi2P50uXMD23HhF9DTndsnj4TrtoKFknqc+FAd8krZ9RAdJFWIEgnCq1w== dependencies: consola "^2.15.3" defu "^5.0.0" @@ -8723,26 +8723,26 @@ number-is-nan@^1.0.0: resolved "https://registry.yarnpkg.com/number-is-nan/-/number-is-nan-1.0.1.tgz#097b602b53422a522c1afb8790318336941a011d" integrity sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0= -nuxt@^2.15.6: - version "2.15.6" - resolved "https://registry.yarnpkg.com/nuxt/-/nuxt-2.15.6.tgz#628ff86d57c1d4671802777635ce7fd2c24f9091" - integrity sha512-smhzRJPdqg+coUfZwMyuUGKULbIkdawrFcypya15ByKAceWIhLjkOls64dnH574wpZQxA8bugFjGn3ih26eSFg== +nuxt@^2.15.7: + version "2.15.7" + resolved "https://registry.yarnpkg.com/nuxt/-/nuxt-2.15.7.tgz#45332e3b00ba5c1cf04688d42373c8ed7ef4dca7" + integrity sha512-opxIwaiX4/MvPD5yHEHvtPSEkQKPxg4WPscstnvWC8zX2n74/3DzlNQQAbxtLngW7tze9wsWavxgSMtJXsA8Uw== dependencies: - "@nuxt/babel-preset-app" "2.15.6" - "@nuxt/builder" "2.15.6" - "@nuxt/cli" "2.15.6" + "@nuxt/babel-preset-app" "2.15.7" + "@nuxt/builder" "2.15.7" + "@nuxt/cli" "2.15.7" "@nuxt/components" "^2.1.8" - "@nuxt/config" "2.15.6" - "@nuxt/core" "2.15.6" - "@nuxt/generator" "2.15.6" + "@nuxt/config" "2.15.7" + "@nuxt/core" "2.15.7" + "@nuxt/generator" "2.15.7" "@nuxt/loading-screen" "^2.0.3" "@nuxt/opencollective" "^0.3.2" - "@nuxt/server" "2.15.6" + "@nuxt/server" "2.15.7" "@nuxt/telemetry" "^1.3.3" - "@nuxt/utils" "2.15.6" - "@nuxt/vue-app" "2.15.6" - "@nuxt/vue-renderer" "2.15.6" - "@nuxt/webpack" "2.15.6" + "@nuxt/utils" "2.15.7" + "@nuxt/vue-app" "2.15.7" + "@nuxt/vue-renderer" "2.15.7" + "@nuxt/webpack" "2.15.7" nwsapi@^2.2.0: version "2.2.0" From bee00400837b4276bacf73731d56374e3f5ce3a0 Mon Sep 17 00:00:00 2001 From: Ahad Birang Date: Tue, 29 Jun 2021 21:08:33 +0430 Subject: [PATCH 2/4] feat: validate external domains (#343) Co-authored-by: pooya parsa --- src/module.ts | 7 ++++++- src/provider.ts | 3 +-- src/runtime/image.ts | 12 ++++++++++++ src/runtime/providers/ipx.ts | 14 ++++---------- src/runtime/providers/vercel.ts | 2 ++ src/types/image.ts | 3 ++- 6 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/module.ts b/src/module.ts index a25d65b0b..910a4849e 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1,6 +1,6 @@ import { resolve } from 'upath' import defu from 'defu' - +import { parseURL } from 'ufo' import type { Module } from '@nuxt/types' import { setupStaticGeneration } from './generate' import { resolveProviders, detectProvider } from './provider' @@ -34,6 +34,11 @@ const imageModule: Module = async function imageModule (moduleOpt const options: ModuleOptions = defu(moduleOptions, nuxt.options.image, defaults) + // Normalize domains to hostname + options.domains = options.domains + .map(domain => parseURL(domain, 'https://').host) + .filter(Boolean) as string[] + options.provider = detectProvider(options.provider, nuxt.options.target === 'static') options[options.provider] = options[options.provider] || {} diff --git a/src/provider.ts b/src/provider.ts index 171514caf..5f9f3d526 100644 --- a/src/provider.ts +++ b/src/provider.ts @@ -1,6 +1,5 @@ import { normalize, resolve, dirname } from 'upath' import { writeJson, mkdirp } from 'fs-extra' -import { parseURL } from 'ufo' import { hash } from './utils' import type { ModuleOptions, InputProvider, ImageModuleProvider, ProviderSetup } from './types' import { ipxSetup } from './ipx' @@ -31,7 +30,7 @@ export const providerSetup: Record = { const imagesConfig = resolve(nuxt.options.rootDir, '.vercel_build_output/config/images.json') await mkdirp(dirname(imagesConfig)) await writeJson(imagesConfig, { - domains: moduleOptions.domains.map(domain => parseURL(domain, 'https://').host), + domains: moduleOptions.domains, sizes: Array.from(new Set(Object.values(moduleOptions.screens || {}))) }) } diff --git a/src/runtime/image.ts b/src/runtime/image.ts index 505a78397..eca37fad6 100644 --- a/src/runtime/image.ts +++ b/src/runtime/image.ts @@ -1,4 +1,5 @@ import defu from 'defu' +import { hasProtocol, parseURL } from 'ufo' import type { ImageOptions, ImageSizesOptions, CreateImageOptions, ResolvedImage, MapToStatic, ImageCTX, $Img } from '../types/image' import { imageMeta } from './utils/meta' import { parseSize } from './utils' @@ -98,6 +99,17 @@ function resolveImage (ctx: ImageCTX, input: string, options: ImageOptions): Res const { provider, defaults } = getProvider(ctx, options.provider || ctx.options.provider) const preset = getPreset(ctx, options.preset) + // Externalize remote images if domain does not match with `domains` + if (provider.validateDomains && hasProtocol(input)) { + const inputHost = parseURL(input).host + // Domains are normalized to hostname in module + if (!ctx.options.domains.find(d => d === inputHost)) { + return { + url: input + } + } + } + const _options: ImageOptions = defu(options, preset, defaults) _options.modifiers = { ..._options.modifiers } const expectedFormat = _options.modifiers.format diff --git a/src/runtime/providers/ipx.ts b/src/runtime/providers/ipx.ts index ffe56880e..eecac935d 100644 --- a/src/runtime/providers/ipx.ts +++ b/src/runtime/providers/ipx.ts @@ -1,5 +1,5 @@ import { ProviderGetImage } from 'src' -import { joinURL, encodeQueryItem, encodePath, hasProtocol } from 'ufo' +import { joinURL, encodeQueryItem, encodePath } from 'ufo' import { createOperationsGenerator } from '~image' const operationsGenerator = createOperationsGenerator({ @@ -16,7 +16,7 @@ const operationsGenerator = createOperationsGenerator({ formatter: (key, val) => encodeQueryItem(key, val) }) -export const getImage: ProviderGetImage = (src, { modifiers = {}, baseURL = '/_ipx' } = {}, { options: { domains = [] } }) => { +export const getImage: ProviderGetImage = (src, { modifiers = {}, baseURL = '/_ipx' } = {}) => { if (modifiers.width && modifiers.height) { modifiers.resize = `${modifiers.width}_${modifiers.height}` delete modifiers.width @@ -25,15 +25,9 @@ export const getImage: ProviderGetImage = (src, { modifiers = {}, baseURL = '/_i const params = operationsGenerator(modifiers) - if (hasProtocol(src)) { - if (!domains.find((d: string) => src.startsWith(d))) { - return { - url: src - } - } - } - return { url: joinURL(baseURL, encodePath(src) + (params ? '?' + params : '')) } } + +export const validateDomains = true diff --git a/src/runtime/providers/vercel.ts b/src/runtime/providers/vercel.ts index 4b91d043f..68e6b02a1 100644 --- a/src/runtime/providers/vercel.ts +++ b/src/runtime/providers/vercel.ts @@ -34,3 +34,5 @@ export const getImage: ProviderGetImage = (src, { modifiers, baseURL = '/_vercel }) } } + +export const validateDomains = true diff --git a/src/types/image.ts b/src/types/image.ts index 30669cf79..5faf341f7 100644 --- a/src/types/image.ts +++ b/src/types/image.ts @@ -23,6 +23,7 @@ export type ProviderGetImage = (src: string, options: ImageOptions, ctx: ImageCT export interface ImageProvider { defaults?: any getImage: ProviderGetImage + validateDomains?: Boolean } export interface CreateImageOptions { @@ -35,7 +36,7 @@ export interface CreateImageOptions { presets: { [name: string]: ImageOptions } provider: string screens?: Record, - domains?: string[] + domains: string[] } export interface ImageInfo { From 22d5de2c839981da80ad3e05148c62aff0e31413 Mon Sep 17 00:00:00 2001 From: fgiraud Date: Tue, 29 Jun 2021 13:16:02 -0400 Subject: [PATCH 3/4] docs: document where to put static images (#341) Co-authored-by: Pooya Parsa --- docs/pages/en/1.getting-started/2.providers.md | 14 ++++++++++++++ docs/pages/en/2.components/1.nuxt-img.md | 12 +++--------- docs/pages/en/4.providers/ipx.md | 14 +++++++++----- 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/docs/pages/en/1.getting-started/2.providers.md b/docs/pages/en/1.getting-started/2.providers.md index ae2e7eaf7..de1f065e6 100644 --- a/docs/pages/en/1.getting-started/2.providers.md +++ b/docs/pages/en/1.getting-started/2.providers.md @@ -17,6 +17,20 @@ The default provider for Nuxt Image is [ipx](/providers/ipx) or [static](/gettin [Learn more about Nuxt deployment targets](https://nuxtjs.org/docs/2.x/features/deployment-targets) +### Local Images + +Images should be stored in the `static/` directory of your project. + +For example, when using ``, it should be placed in `static/` folder under the path `static/nuxt-icon.png`. + +Image stored in the `assets/` directory are **not** proccessed with Nuxt Image because those images are managed by webpack. + +For more information, you can learn more about the [static directory here](https://nuxtjs.org/docs/2.x/directory-structure/static). + +### Remote Images + +Using default provider, you can also optimize external URLs. For this, you need to add them to [`domains`](/api/options#domains) option. + ### Environment Detection You can set default provider using `NUXT_IMAGE_PROVIDER` environment variable. Providers below, are automatically detected: diff --git a/docs/pages/en/2.components/1.nuxt-img.md b/docs/pages/en/2.components/1.nuxt-img.md index 68f9f9124..ef3846fe1 100644 --- a/docs/pages/en/2.components/1.nuxt-img.md +++ b/docs/pages/en/2.components/1.nuxt-img.md @@ -25,15 +25,9 @@ Will result in: ``` -### File Location - -Images should be stored in the `static` directory. - -For example, the `nuxt-icon.png` referred to in the previous example should be placed in `static` folder under the path `/static/nuxt-icon.png`. - -In other words, image stored in the `assets` directory are not compatible with Nuxt Image because those images are managed by webpack. - -For more information, you can learn more about the [static directory here](https://nuxtjs.org/docs/2.x/directory-structure/static). +:::alert{type="info"} +With [default provider](/getting-started/providers#default-provider), you should put `/nuxt-icon.png` inside `static/` directory for making above example working. +::: ## Props diff --git a/docs/pages/en/4.providers/ipx.md b/docs/pages/en/4.providers/ipx.md index 67914f509..11e54d1dd 100644 --- a/docs/pages/en/4.providers/ipx.md +++ b/docs/pages/en/4.providers/ipx.md @@ -5,7 +5,7 @@ navigation: title: IPX --- -Nuxt Image comes with a preconfigured instance of [ipx](https://github.com/unjs/ipx). An open source, self-hosted image optimizer based on [sharp](https://github.com/lovell/sharp). +Nuxt Image comes with a [preconfigured instance](/getting-started/providers#default-provider) of [ipx](https://github.com/unjs/ipx). An open source, self-hosted image optimizer based on [sharp](https://github.com/lovell/sharp). ## Using `ipx` in production @@ -15,14 +15,13 @@ Use IPX for self-hosting as an alternative to use service providers for producti You don't need to follow this section if using `target: 'static'`. ::: - ### Runtime Module Just add `@nuxt/image` to `modules` (instead of `buildModules`) in `nuxt.config`. This will ensure that the `/_ipx` endpoint continues to work in production. -### Alternative: serverMiddleware +### Advanced: Custom ServerMiddleware -If you have an advanced use case, you may instead create a custom server middleware that handles the `/_ipx` endpoint: +If you have an usecase of a custom IPX instance serving other that `static/` dir, you may instead create a server Middleware that handles the `/_ipx` endpoint: 1. Add `ipx` as a dependency: @@ -49,7 +48,12 @@ If you have an advanced use case, you may instead create a custom server middlew import { createIPX, createIPXMiddleware } from 'ipx' // https://github.com/unjs/ipx -const ipx = createIPX(/* options */) +const ipx = createIPX({ + dir: '', // absolute path to images dir + domains: [], // allowed external domains (should match domains option in nuxt.config) + alias: {}, // base alias + sharp: {}, // sharp options +}) export default createIPXMiddleware(ipx) ``` From 58dd744d39dc6a0e1f0c2dc89ea13f50efa7c91f Mon Sep 17 00:00:00 2001 From: Blake Kostner Date: Tue, 29 Jun 2021 10:45:29 -0700 Subject: [PATCH 4/4] fix(static): url encoded name included in generated ext (#340) Co-authored-by: Pooya Parsa --- src/generate.ts | 10 +++++----- src/runtime/image.ts | 2 +- src/types/image.ts | 2 +- src/utils.ts | 8 ++++++++ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/generate.ts b/src/generate.ts index 2d33bc83c..cd848ad7c 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -3,12 +3,12 @@ import { createWriteStream } from 'fs' import { promisify } from 'util' import stream from 'stream' import { mkdirp } from 'fs-extra' -import { dirname, join, relative, extname, basename, trimExt } from 'upath' +import { dirname, join, relative, basename, trimExt } from 'upath' import fetch from 'node-fetch' import { joinURL, hasProtocol, parseURL, withoutTrailingSlash } from 'ufo' import pLimit from 'p-limit' import { ModuleOptions, MapToStatic, ResolvedImage } from './types' -import { hash, logger } from './utils' +import { hash, logger, guessExt } from './utils' const pipeline = promisify(stream.pipeline) @@ -17,12 +17,12 @@ export function setupStaticGeneration (nuxt: any, options: ModuleOptions) { nuxt.hook('vue-renderer:ssr:prepareContext', (renderContext: any) => { renderContext.image = renderContext.image || {} - renderContext.image.mapToStatic = function ({ url, format }: ResolvedImage) { + renderContext.image.mapToStatic = function ({ url, format }: ResolvedImage, input: string) { if (!staticImages[url]) { - const { pathname } = parseURL(url) + const { pathname } = parseURL(input) const params: any = { name: trimExt(basename(pathname)), - ext: (format && `.${format}`) || extname(pathname) || '.png', + ext: (format && `.${format}`) || guessExt(input), hash: hash(url), // TODO: pass from runtimeConfig to mapStatic as param publicPath: withoutTrailingSlash(nuxt.options.build.publicPath) diff --git a/src/runtime/image.ts b/src/runtime/image.ts index eca37fad6..e18c104c1 100644 --- a/src/runtime/image.ts +++ b/src/runtime/image.ts @@ -47,7 +47,7 @@ export function createImage (globalOptions: CreateImageOptions, nuxtContext: any } const mapToStatic: MapToStatic = ssrContext.image?.mapToStatic if (typeof mapToStatic === 'function') { - const mappedURL = mapToStatic(image) + const mappedURL = mapToStatic(image, input) if (mappedURL) { staticImages[image.url] = mappedURL image.url = mappedURL diff --git a/src/types/image.ts b/src/types/image.ts index 5faf341f7..93f77d143 100644 --- a/src/types/image.ts +++ b/src/types/image.ts @@ -107,4 +107,4 @@ export interface OperationGeneratorConfig { } } -export type MapToStatic = (image: ResolvedImage) => string +export type MapToStatic = (image: ResolvedImage, input: string) => string diff --git a/src/utils.ts b/src/utils.ts index aedb532a6..7f0a9ed80 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -17,3 +17,11 @@ export function pick, K extends keyof O> (obj: O, key } return newobj } + +export function guessExt (input: string = '') { + const ext = input.split('.').pop()?.split('?')[0] + if (ext && /^[\w0-9]+$/.test(ext)) { + return '.' + ext + } + return '' +}