Skip to content

Commit f661f50

Browse files
authored
Create image optimization function in arm64 architecture (#37)
1 parent 265acef commit f661f50

File tree

722 files changed

+187351
-4228
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

722 files changed

+187351
-4228
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ public,max-age=0,s-maxage=31536000,must-revalidate
117117

118118
#### Image optimization function
119119

120-
Create a Lambda function using the code in the `.open-next/image-optimization-function` folder, with the handler `index.mjs`.
120+
Create a Lambda function using the code in the `.open-next/image-optimization-function` folder, with the handler `index.mjs`. Ensure that the **arm64** architecture is used.
121121

122-
This function handles image optimization requests when the Next.js `<Image>` component is used. The [sharp](https://www.npmjs.com/package/sharp) library, which is bundled with the function, is used to convert the image.
122+
This function handles image optimization requests when the Next.js `<Image>` component is used. The [sharp](https://www.npmjs.com/package/sharp) library, which is bundled with the function, is used to convert the image. The library is compiled against the `arm64` architecture and is intended to run on AWS Lamba Arm/Graviton2 architecture. [Learn about the better cost-performance offered by AWS Graviton2 processors.](https://aws.amazon.com/blogs/aws/aws-lambda-functions-powered-by-aws-graviton2-processor-run-your-functions-on-arm-and-get-up-to-34-better-price-performance/)
123123

124124
Note that the image optimization function responds with the `Cache-Control` header, so the image will be cached both at the CDN level and at the browser level.
125125

assets/sharp-node-modules/.package-lock.json

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

assets/sharp-node-modules/node-abi/.circleci/config.yml

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,9 @@ steps-test: &steps-test
1616
- run: yarn test
1717

1818
version: 2.1
19+
orbs:
20+
cfa: continuousauth/[email protected]
1921
jobs:
20-
test-linux-10:
21-
docker:
22-
- image: circleci/node:10
23-
<<: *steps-test
24-
test-linux-12:
25-
docker:
26-
- image: circleci/node:12
27-
<<: *steps-test
2822
test-linux-14:
2923
docker:
3024
- image: circleci/node:14
@@ -34,30 +28,18 @@ jobs:
3428
- image: circleci/node:16
3529
<<: *steps-test
3630

37-
release:
38-
docker:
39-
- image: circleci/node:14.15
40-
steps:
41-
- checkout
42-
- *step-restore-cache
43-
- run: yarn --frozen-lockfile
44-
- run: npx [email protected]
4531
workflows:
46-
version: 2
4732
test_and_release:
4833
# Run test jobs first, release only when all the test jobs are successful
4934
jobs:
50-
- test-linux-10
51-
- test-linux-12
5235
- test-linux-14
5336
- test-linux-16
54-
- release:
37+
- cfa/release:
5538
requires:
56-
- test-linux-10
57-
- test-linux-12
5839
- test-linux-14
5940
- test-linux-16
6041
filters:
6142
branches:
6243
only:
63-
- main
44+
- main
45+
context: cfa-release

assets/sharp-node-modules/node-abi/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Commit Message Guidelines
66

7-
This module uses [`semantic-release`](https://github.com/semantic-release/semantic-release) to automatically release new versions via Travis.
7+
This module uses [`semantic-release`](https://github.com/semantic-release/semantic-release) to automatically release new versions via [Continuous Auth](https://continuousauth.dev/).
88
Therefor we have very precise rules over how our git commit messages can be formatted.
99

1010
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special

assets/sharp-node-modules/node-abi/abi_registry.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,12 @@
227227
"lts": false,
228228
"runtime": "electron",
229229
"target": "22.0.0-alpha.1"
230+
},
231+
{
232+
"abi": "113",
233+
"future": true,
234+
"lts": false,
235+
"runtime": "electron",
236+
"target": "23.0.0-alpha.1"
230237
}
231238
]

assets/sharp-node-modules/node-abi/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{
22
"name": "node-abi",
3-
"version": "3.30.0",
3+
"version": "3.31.0",
44
"description": "Get the Node ABI for a given target and runtime, and vice versa.",
55
"main": "index.js",
66
"scripts": {
7-
"semantic-release": "semantic-release",
87
"test": "tape test/index.js",
98
"update-abi-registry": "node --unhandled-rejections=strict scripts/update-abi-registry.js"
109
},
@@ -26,7 +25,7 @@
2625
},
2726
"homepage": "https://github.com/lgeiger/node-abi#readme",
2827
"devDependencies": {
29-
"@continuous-auth/semantic-release-npm": "^2.0.0",
28+
"@continuous-auth/semantic-release-npm": "^3.0.0",
3029
"got": "^11.8.2",
3130
"tape": "^5.3.1"
3231
},

assets/sharp-node-modules/node-addon-api/README.md

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ provided by Node.js when using C++. It provides a C++ object model
1616
and exception handling semantics with low overhead.
1717

1818
There are three options for implementing addons: Node-API, nan, or direct
19-
use of internal V8, libuv and Node.js libraries. Unless there is a need for
20-
direct access to functionality which is not exposed by Node-API as outlined
19+
use of internal V8, libuv, and Node.js libraries. Unless there is a need for
20+
direct access to functionality that is not exposed by Node-API as outlined
2121
in [C/C++ addons](https://nodejs.org/dist/latest/docs/api/addons.html)
2222
in Node.js core, use Node-API. Refer to
2323
[C/C++ addons with Node-API](https://nodejs.org/dist/latest/docs/api/n-api.html)
2424
for more information on Node-API.
2525

2626
Node-API is an ABI stable C interface provided by Node.js for building native
27-
addons. It is independent from the underlying JavaScript runtime (e.g. V8 or ChakraCore)
27+
addons. It is independent of the underlying JavaScript runtime (e.g. V8 or ChakraCore)
2828
and is maintained as part of Node.js itself. It is intended to insulate
2929
native addons from changes in the underlying JavaScript engine and allow
3030
modules compiled for one version to run on later versions of Node.js without
@@ -46,7 +46,7 @@ provides an [ABI stability guide][] containing a detailed explanation of ABI
4646
stability in general, and the Node-API ABI stability guarantee in particular.
4747

4848
As new APIs are added to Node-API, node-addon-api must be updated to provide
49-
wrappers for those new APIs. For this reason node-addon-api provides
49+
wrappers for those new APIs. For this reason, node-addon-api provides
5050
methods that allow callers to obtain the underlying Node-API handles so
5151
direct calls to Node-API and the use of the objects/methods provided by
5252
node-addon-api can be used together. For example, in order to be able
@@ -56,7 +56,7 @@ APIs exposed by node-addon-api are generally used to create and
5656
manipulate JavaScript values. Concepts and operations generally map
5757
to ideas specified in the **ECMA262 Language Specification**.
5858

59-
The [Node-API Resource](https://nodejs.github.io/node-addon-examples/) offers an
59+
The [Node-API Resource](https://nodejs.github.io/node-addon-examples/) offers an
6060
excellent orientation and tips for developers just getting started with Node-API
6161
and node-addon-api.
6262

@@ -70,7 +70,7 @@ and node-addon-api.
7070
- **[Contributors](#contributors)**
7171
- **[License](#license)**
7272

73-
## **Current version: 5.0.0**
73+
## **Current version: 5.1.0**
7474

7575
(See [CHANGELOG.md](CHANGELOG.md) for complete Changelog)
7676

@@ -187,6 +187,28 @@ npm test --NAPI_VERSION=X
187187

188188
where X is the version of Node-API you want to target.
189189

190+
To run a specific unit test, filter conditions are available
191+
192+
**Example:**
193+
compile and run only tests on objectwrap.cc and objectwrap.js
194+
```
195+
npm run unit --filter=objectwrap
196+
```
197+
198+
Multiple unit tests cane be selected with wildcards
199+
200+
**Example:**
201+
compile and run all test files ending with "reference" -> function_reference.cc, object_reference.cc, reference.cc
202+
```
203+
npm run unit --filter=*reference
204+
```
205+
206+
Multiple filter conditions can be joined to broaden the test selection
207+
208+
**Example:**
209+
compile and run all tests under folders threadsafe_function and typed_threadsafe_function and also the objectwrap.cc file
210+
npm run unit --filter='*function objectwrap'
211+
190212
### **Debug**
191213

192214
To run the **node-addon-api** tests with `--debug` option:
@@ -195,7 +217,7 @@ To run the **node-addon-api** tests with `--debug` option:
195217
npm run-script dev
196218
```
197219

198-
If you want faster build, you might use the following option:
220+
If you want a faster build, you might use the following option:
199221

200222
```
201223
npm run-script dev:incremental
@@ -223,7 +245,7 @@ See [benchmark/README.md](benchmark/README.md) for more details about running an
223245

224246
As node-addon-api's core mission is to expose the plain C Node-API as C++
225247
wrappers, tools that facilitate n-api/node-addon-api providing more
226-
convenient patterns on developing a Node.js add-ons with n-api/node-addon-api
248+
convenient patterns for developing a Node.js add-on with n-api/node-addon-api
227249
can be published to NPM as standalone packages. It is also recommended to tag
228250
such packages with `node-addon-api` to provide more visibility to the community.
229251

@@ -269,19 +291,21 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for more details on our philosophy around
269291
| ------------------- | ----------------------------------------------------- |
270292
| Anna Henningsen | [addaleax](https://github.com/addaleax) |
271293
| Chengzhong Wu | [legendecas](https://github.com/legendecas) |
272-
| Gabriel Schulhof | [gabrielschulhof](https://github.com/gabrielschulhof) |
273-
| Jim Schlight | [jschlight](https://github.com/jschlight) |
294+
| Jack Xia | [JckXia](https://github.com/JckXia) |
295+
| Kevin Eady | [KevinEady](https://github.com/KevinEady) |
274296
| Michael Dawson | [mhdawson](https://github.com/mhdawson) |
275-
| Kevin Eady | [KevinEady](https://github.com/KevinEady)
276297
| Nicola Del Gobbo | [NickNaso](https://github.com/NickNaso) |
298+
| Vladimir Morozov | [vmoroz](https://github.com/vmoroz) |
277299

278300
### Emeritus
279301
| Name | GitHub Link |
280302
| ------------------- | ----------------------------------------------------- |
281303
| Arunesh Chandra | [aruneshchandra](https://github.com/aruneshchandra) |
282304
| Benjamin Byholm | [kkoopa](https://github.com/kkoopa) |
283-
| Jason Ginchereau | [jasongin](https://github.com/jasongin) |
305+
| Gabriel Schulhof | [gabrielschulhof](https://github.com/gabrielschulhof) |
284306
| Hitesh Kanwathirtha | [digitalinfinity](https://github.com/digitalinfinity) |
307+
| Jason Ginchereau | [jasongin](https://github.com/jasongin) |
308+
| Jim Schlight | [jschlight](https://github.com/jschlight) |
285309
| Sampson Gao | [sampsongao](https://github.com/sampsongao) |
286310
| Taylor Woll | [boingoing](https://github.com/boingoing) |
287311

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const path = require('path');
22

3-
const include_dir = path.relative('.', __dirname);
3+
const includeDir = path.relative('.', __dirname);
44

55
module.exports = {
66
include: `"${__dirname}"`, // deprecated, can be removed as part of 4.0.0
7-
include_dir,
8-
gyp: path.join(include_dir, 'node_api.gyp:nothing'),
7+
include_dir: includeDir,
8+
gyp: path.join(includeDir, 'node_api.gyp:nothing'),
99
isNodeApiBuiltin: true,
1010
needsFlag: false
1111
};

0 commit comments

Comments
 (0)