Skip to content

Node 22 + Sharp 0.34.1 + upstream changes #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ AWS Lambda Layer providing [sharp](https://github.com/lovell/sharp) with HEIC (a

* Docker
* [SAM v1.33.0 or higher](https://github.com/awsdocs/aws-sam-developer-guide/blob/master/doc_source/serverless-sam-cli-install.md)
* Node v20 (for v4.x)
* Node v22 (for v5.x)

## Usage

Expand Down Expand Up @@ -77,12 +77,14 @@ The following table lists the release version of this repo together with the ver
| 4.1.0 | 0.33.3 | 8.15.2 | 1.17.6 | 1.4.0 | 1.0.15 | 3.6 | | 20 |
| 4.1.3 | 0.33.3 | 8.15.2 | 1.17.6 | 1.4.0 | 1.0.15 | 3.6 | | 20 |
| 4.2.0 | 0.33.5 | 8.15.3 | 1.18.2 | 1.4.0 | 1.0.15 | 3.6 | 3.9.1 | 20 |
| upstream | 0.34.2 | 8.16.1 | 1.19.8 | 1.5.0 | 1.0.16 | 4.1 | 3.12.1 | 22 |

### CompatibleRuntimes
- `nodejs12.x` (v1.x)
- `nodejs14.x` (v2.x)
- `nodejs16.x` (v3.x)
- `nodejs20.x` (v4.x)
- `nodejs22.x` (upstream)

## Contributions
If you would like to contribute to this repository, please open an issue or submit a PR.
Expand Down
4 changes: 2 additions & 2 deletions buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:
phases:
install:
runtime-versions:
nodejs: 20
nodejs: 22
pre_build:
commands:
- NODE_ENV=development npm ci
Expand All @@ -27,4 +27,4 @@ artifacts:
- .aws-sam/**/*
cache:
paths:
- '/root/.npm/**/*'
- "/root/.npm/**/*"
2 changes: 1 addition & 1 deletion examples/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"author": "Andreas Zoellner",
"license": "MIT",
"engines": {
"node": ">=20.0"
"node": ">=22.11"
}
}
2 changes: 1 addition & 1 deletion examples/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Resources:
Properties:
CodeUri: ./src/
Handler: index.handler
Runtime: nodejs20.x
Runtime: nodejs22.x
Timeout: 10
MemorySize: 1024
Layers:
Expand Down
27 changes: 16 additions & 11 deletions layer/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
# Library Versions
WEBP_VERSION=1.4.0
LIBDE265_VERSION=1.0.15
LIBAOM_VERSION=3.9.1
X265_VERSION=3.6
LIBHEIF_VERSION=1.18.2
VIPS_VERSION=8.15.3
SHARP_VERSION=0.33.5
WEBP_VERSION=1.5.0
LIBDE265_VERSION=1.0.16
LIBAOM_VERSION=3.12.0
X265_VERSION=4.1
LIBHEIF_VERSION=1.19.8
VIPS_VERSION=8.16.1
SHARP_VERSION=0.34.2

PREFIX_PATH=/usr/local
LIB_PATH=$(PREFIX_PATH)/lib
Expand All @@ -22,8 +22,13 @@ build-SharpHEICLayer: libvips
# sharp uses several of the libs we installed or compiled. extract the full list and copy all of those into $(ARTIFACTS_DIR)/lib
# extract list with ldd from sharp.node, manipulate a bit to only get the absolute paths, then copy

export SHARP_FORCE_GLOBAL_LIBVIPS=1

# install
npm install --save --prefix "$(ARTIFACTS_DIR)/nodejs/" node-addon-api node-gyp

pkg-config --modversion vips-cpp

npm install --build-from-source --prefix "$(ARTIFACTS_DIR)/nodejs/" --verbose --foreground-scripts --platform=linux --arch=x64 sharp@$(SHARP_VERSION)

# debug logs
Expand All @@ -50,11 +55,11 @@ x265:
curl -L https://bitbucket.org/multicoreware/x265_git/downloads/x265_$(X265_VERSION).tar.gz | tar zx
cd x265_$(X265_VERSION) && cd build/linux && cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(PREFIX_PATH) ../../source && make && make install

libaom:
curl -L https://storage.googleapis.com/aom-releases/libaom-${LIBAOM_VERSION}.tar.gz | tar zx && \
cd libaom-${LIBAOM_VERSION} && cd build && cmake -DCONFIG_AV1_ENCODER=1 -DBUILD_SHARED_LIBS=1 -DENABLE_TESTS=0 -DENABLE_DOCS=0 -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH} -DCMAKE_INSTALL_LIBDIR=${PREFIX_PATH}/lib .. && make V=1 && make install
# libaom:
# curl -L https://storage.googleapis.com/aom-releases/libaom-${LIBAOM_VERSION}.tar.gz | tar zx && \
# cd libaom-${LIBAOM_VERSION} && cd build && cmake -DCONFIG_AV1_ENCODER=1 -DBUILD_SHARED_LIBS=1 -DENABLE_TESTS=0 -DENABLE_DOCS=0 -DCMAKE_INSTALL_PREFIX=${PREFIX_PATH} -DCMAKE_INSTALL_LIBDIR=${PREFIX_PATH}/lib .. && make V=1 && make install

libheif: x265 libde265 libaom
libheif: x265 libde265 #libaom
# libheif
curl -L https://github.com/strukturag/libheif/releases/download/v$(LIBHEIF_VERSION)/libheif-$(LIBHEIF_VERSION).tar.gz | tar zx
cd libheif-$(LIBHEIF_VERSION) && mkdir build && cd build && cmake -DCMAKE_INSTALL_LIBDIR=$(LIB_PATH) --preset=release-noplugins .. && make V=0 && make install
Expand Down
4 changes: 2 additions & 2 deletions layer/src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"license": "MIT",
"devDependencies": {},
"engines": {
"node": ">=20.3"
"node": ">=22.11"
},
"dependencies": {
"sharp": "^0.33.4"
"sharp": "0.34.2"
}
}
Loading