Releases: neg4n/next-api-og-image
Ability to set custom chrome options
What's Changed
Explanation
This release is kinda continuation of https://github.com/neg4n/next-api-og-image/releases/tag/4.2.2, in other words - next-api-og-image
development heading towards start being able to be hosted on VPS or dedicated servers or any other non-serverless environment. This time we introduce option to set custom chrome parameters directly in next-api-og-image
options object!
New properties
// NOTE: Options within 'chrome' object only works when next-api-og-image is run in server (not serverless!!) environment.
chrome: {
// Custom command-line args passed to the browser start command
// by default, no arguments are provided.
args: null
// Custom executable provided. Useful when you e.g. have to run Chromium instead of Google Chrome
// by default, executable is retrieved automatically (it looks for Google Chrome in the filesystem)
executable: null,
}
Acknowledgements
Thanks to @vanniewelt and @njoguamos for contributing to the project ❤️
Full Changelog: 4.2.2...4.3.0
Add dynamic chrome options for lambda & non lambda
What's Changed
Explanation
The next-api-og-image
library was intended to be used only in cloud environments at the beginning. That is why it was not designed with mind of support for hosting on VPS / Dedicated servers. Recently, the #40 issue came up to the open and this was a opportunity to add support both server and serverless environments
From now on, the next-api-og-image
should work out of the box both on server (with chrome installed) and serverless environments. This also means that testing the application using next-api-og-image
locally with NODE_ENV
set to production will no longer throw an error regarding chrome 🚀
Acknowledgements
Thanks to @guhyeon, @mvandergrift and @kamenskiyyyy for contributing to the issue development 🤗
Full Changelog: 4.2.1...4.2.2
Fix chrome path on Windows 64bit
From now on issues related to invalid chrome executable path (while on local development environment) should not happen 😄
Full Changelog: 4.2.0...4.2.1
Ability to set custom headers
Added return value to hook
function passed in configuration object. From now on, this function can return Map
containing custom headers that will be set before sending response with open-graph image to client.
Example code:
import { withOGImage } from 'next-api-og-image'
export default withOGImage({
template: {
react: ({ myQueryParam }) => <div>🔥 {myQueryParam}</div>,
},
hook: () => {
const headers = new Map()
headers.set('X-My-Header', 'cool-thing')
return headers
},
})
Full Changelog: 4.1.0...4.2.0
Hook function
Move chrome-aws-lambda to peerDependencies
BREAKING CHANGE: From now on, next-api-og-image
has chrome-aws-lambda
in peerDependencies... but what does it mean?
When installing next-api-og-image >= 4.0.0
you also have to install appropriate chrome-aws-lambda
version.
In most cases, the
npm i next-api-og-image chrome-aws-lambda
# or
yarn add next-api-og-image chrome-aws-lambda
will be sufficient.
But when you'll encounter serverless function size exceed limit on Vercel:
npm i next-api-og-image [email protected]
# or
yarn add next-api-og-image [email protected]
The 6.0.0
version of chrome-aws-lambda
is smaller than the latest one (10.1.0
at the time of writing this release notes)
Acknowledgements
Gargantuan thanks to @transitive-bullshit for making research on this 🙏🏻
Full Changelog: 3.0.0...4.0.1
Configurable image type and quality
BREAKING CHANGE:
Removed contentType
option in next-api-og-image configuration object. From now on, the type
property is its successor. Available values for it are: png
, webp
, jpeg
.
If type
is set to jpeg
(works only for this particular type!!), the quality
option can be set. If the type will be different than jpeg, the quality option will simply do nothing.
Full Changelog: 2.2.1...3.0.0
Image file types and ability to adjust the quality
What's Changed
- Add support for jpeg images and custom quality by @transitive-bullshit in #30
New Contributors
- @transitive-bullshit made their first contribution in #30
Full Changelog: 2.2.0...2.2.1
Width and height options
What's Changed
- Styled components example by @bmstefanski in #17
- Fix typo in README by @snelsi in #21
- feat: support width and height options by @robrechtme in #26
New Contributors
- @bmstefanski made their first contribution in #17
- @snelsi made their first contribution in #21
- @robrechtme made their first contribution in #26
Full Changelog: 2.1.1...2.2.0
2.1.1
- Fix critical bug that leaded to error informing about invalid chromium executable in serverless environment. (it was related to invalid detection of
process.env.NODE_END
) - Fix lack of presence of
errorsInResponse
in query strategy checks - Remove throw if strategy is set to
query
and its empty. This was not an error behaviour.