Skip to content
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

3.0.0 - TypeScript, Testing, and Modernization #111

Draft
wants to merge 137 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
137 commits
Select commit Hold shift + click to select a range
096afb5
Update imgix schema
Mosnar Apr 18, 2022
e6c1497
Added check for undefined multiValueQueryStringParameters
Mosnar Apr 18, 2022
10fa7f0
Update dependencies
Mosnar Apr 18, 2022
2a82f99
Sharp 0.30.3*
Mosnar Apr 18, 2022
136b35d
Minor tidying and fix potential bugs
Mosnar Apr 18, 2022
1665930
Added esbuild
Mosnar Apr 19, 2022
fb6603a
Refactor to esm
Mosnar Apr 19, 2022
a904e55
Include sourmaps for easier debugging
Mosnar Apr 19, 2022
e78d0d0
Apparently default exports are bad
Mosnar Apr 19, 2022
8fd0a42
Initial work on typescript migration
Mosnar Apr 20, 2022
af122e9
Remove unused imports
Mosnar Apr 20, 2022
274c103
Update eslint config
Mosnar Apr 23, 2022
eea8a89
Code clean-up
Mosnar Apr 23, 2022
8bdb7da
Added Makefile and Dockerfile for building Sharp for Lambda
Mosnar Apr 24, 2022
76aca6e
Rename helpers directory to utils
Mosnar Apr 24, 2022
9334e9a
Improve types and naming conventions
Mosnar Apr 25, 2022
808e11a
Added "offline" command and update dependencies
Mosnar Apr 30, 2022
e139a75
Improve typechecking
Mosnar Apr 30, 2022
7087165
Improve typechecking
Mosnar May 1, 2022
0a01752
Extract input value processing logic to inputValueProcessor
Mosnar May 2, 2022
496a8b4
Normalize input request
Mosnar May 15, 2022
73e44c6
Streamlining logic
Mosnar May 16, 2022
c1cf5e9
WIP: Refactor image pipeline & update AWS SDK to v3
Mosnar May 23, 2022
6e3b3fc
Added 500KB test image and test case
Mosnar May 24, 2022
8029915
Added image handler tests
Mosnar May 25, 2022
82c6284
Additional tests
Mosnar May 25, 2022
f15ac82
Merge pull request #113 from venveo/enhancement/refactor-pipelines
Mosnar May 25, 2022
32828a4
Added tests for getAutoFormat
Mosnar May 25, 2022
3ecc0ee
Update Sharp from 0.30.4 to 0.30.5
Mosnar May 25, 2022
be25c23
Added avif test
Mosnar May 26, 2022
7558e4c
Added png tests and fixed a variety of potential bugs
Mosnar May 26, 2022
378b9b9
Added tests for non-transparent png format coercion
Mosnar May 26, 2022
3590900
Fix blur out of range bugs
Mosnar May 27, 2022
c3c359f
Docblock
Mosnar May 27, 2022
0e8fd55
Always toString header input
Mosnar May 27, 2022
2cc11b1
Redundant
Mosnar May 27, 2022
784d361
Clean up & normalize image formats
Mosnar May 27, 2022
d058e65
Relocate getResponseHeaders to httpRequestProcessor
Mosnar May 27, 2022
0df1501
Adjust typecasting
Mosnar May 27, 2022
a0b21ee
Added check for null width and height in size adjustment
Mosnar May 27, 2022
ecdf029
Remove todos
Mosnar May 27, 2022
0ff348b
Increase test timeout
Mosnar May 28, 2022
31bf056
Increase test timeout (attempt 2)
Mosnar May 28, 2022
75adf0a
Increase test timeout (attempt 3)
Mosnar May 28, 2022
0234763
npm update
Mosnar May 29, 2022
a460c9b
Ensure schema parser drops empty parameters
Mosnar May 29, 2022
756ba0d
Image operations now return async sharp objects
Mosnar May 29, 2022
8774934
Added fill=blur mode
Mosnar May 30, 2022
64a5f05
Added fillmax & optimize blur
Mosnar May 30, 2022
b768385
Better changelog
Mosnar May 30, 2022
250a093
Docs
Mosnar May 30, 2022
365c9ca
Update sharp to 0.30.6
Mosnar May 30, 2022
e42693e
Remove winston and update deps
Mosnar May 31, 2022
785fbcb
Ease up on console logs
Mosnar May 31, 2022
c04a1a8
Tidy up exceptions
Mosnar May 31, 2022
51c6255
Ensure headers & queryParams are always defined
Mosnar May 31, 2022
3cd5aa0
More specific parameter type for processString
Mosnar May 31, 2022
3fcae60
Clean up security utils
Mosnar May 31, 2022
9667cf4
Move color parsing to valueNormalization
Mosnar May 31, 2022
52ff4bc
Add some enums for Imgix modes we use
Mosnar May 31, 2022
8af746f
Fix type
Mosnar May 31, 2022
ff09984
Fix types and ensure adjustment returns a sharp object
Mosnar May 31, 2022
35b2f0c
Tidy up httpRequestProcessor test suite
Mosnar Jun 11, 2022
84c1689
Add public to default cache control header
Mosnar Jun 11, 2022
d6e07b2
Fix last modified time format (thanks @bs-thomas)
Mosnar Jun 11, 2022
f80efc7
Update dependencies
Mosnar Jun 11, 2022
440ffc0
Use enums for AutoMode
Mosnar Jun 11, 2022
1e10e59
Use .json extension
Mosnar Jun 11, 2022
33017ed
Normalize imageOps interface
Mosnar Jun 11, 2022
35b08c2
Comments
Mosnar Jun 11, 2022
2575118
Update Sharp to 0.30.7
Mosnar Jul 2, 2022
d1d2ec1
Added eslint-plugin-tsdoc
Mosnar Jul 3, 2022
29fe7b5
Update to node 16
Mosnar Jul 4, 2022
3b80ebe
Cleaning and documentation
Mosnar Sep 3, 2022
b4648fc
Add middy for middelware & http error handling
Mosnar Sep 3, 2022
dd954ec
Move normalization and path validation to middlewares
Mosnar Sep 3, 2022
15f3300
Cleaner
Mosnar Sep 4, 2022
3fc784a
Fix incorrect runtime
Mosnar Sep 4, 2022
750ffba
Move hash checking procedure from ImageRequest to middleware
Mosnar Sep 4, 2022
f254b36
Replace custom error exceptions with standardized http errors
Mosnar Sep 4, 2022
604c3e0
Remove try/catch from entrypoint since it's handled by middleware now
Mosnar Sep 5, 2022
de2f783
Improve comments & typedefs
Mosnar Sep 5, 2022
9a3bbee
Improve comments, typedefs, and fix output format bug
Mosnar Sep 6, 2022
5edf7d1
Update Sharp and add powertools logging
Mosnar Sep 6, 2022
9d42a9f
Fixed auto format issues
Mosnar Sep 6, 2022
8eabd2d
Fix avif quality issues
Mosnar Sep 6, 2022
6f56446
Fix some tests that relied on header normalization
Mosnar Sep 8, 2022
7ccff19
Various updates
Mosnar Oct 22, 2022
edced5c
Added header with size difference
Mosnar Oct 22, 2022
ea8d08b
Update dependencies
Mosnar Nov 18, 2022
d48edc0
Initial work migrating to docusaurus
Mosnar Nov 19, 2022
02ead48
Update powertools logger
Mosnar Nov 19, 2022
df2ca55
Add lerna and move directories
Mosnar Nov 25, 2022
7e60257
Merge branch 'enhancement/better-docs' into enhancement/add-lerna
Mosnar Nov 25, 2022
21ae96d
Adjust docs package name
Mosnar Nov 25, 2022
1d8e2cf
Initial work on monorepo
Mosnar Nov 26, 2022
b3134d3
Added root script for test
Mosnar Nov 26, 2022
8733b18
Fix paths to test images
Mosnar Nov 26, 2022
6056cd9
Unnecessary ci step
Mosnar Nov 26, 2022
621c222
Update docs homepage to remove boilerplate
Mosnar Nov 27, 2022
f72e961
Merge pull request #127 from venveo/enhancement/add-lerna
Mosnar Nov 27, 2022
18ad7ca
Merge branch 'enhancement/add-lerna' into enhancement/modernize
Mosnar Nov 27, 2022
3a64a6c
Update to Node 18 and resolve type issues
Mosnar Nov 27, 2022
3a55397
Tidy up some types
Mosnar Nov 28, 2022
e762f67
Fix incorrect output directory for nx
Mosnar Nov 28, 2022
f466dc1
Remove redundant slashes
Mosnar Jan 1, 2023
939d8a9
Updates
Mosnar Jan 1, 2023
6efb74b
Update Sharp
Mosnar Jan 1, 2023
75ce7ab
Minor optimizations
Mosnar Jan 2, 2023
d508571
Minor optimizations to image format utility
Mosnar Jan 2, 2023
0b37f92
Added neverthrow package
Mosnar Jan 2, 2023
c5ec904
Rename ParameterType to ParameterDefinition
Mosnar Jan 3, 2023
8bbe114
Rename ExpectedValueDefinition to ParameterValueRule
Mosnar Jan 3, 2023
03283ea
Added tests for formats.ts
Mosnar Jan 3, 2023
9092c8f
Added some notes/warnings
Mosnar Jan 3, 2023
b3735cd
Added explicit tests for getSchemaForQueryParams
Mosnar Jan 3, 2023
d94f17f
Remove unused message property
Mosnar Jan 3, 2023
a3492f9
Simplify some logic and naming conventions
Mosnar Jan 4, 2023
b4066c8
Improve error message and autoformat
Mosnar Jan 4, 2023
564be68
Added schema helper & additional tests for clamping
Mosnar Jan 4, 2023
1b5322b
Improve color normalization logic and added test cases
Mosnar Jan 4, 2023
5af5cc4
Simply processDefaults and added test cases
Mosnar Jan 4, 2023
af93971
Refactoring and testing
Mosnar Jan 4, 2023
e0e6cb6
Wrap normalizeAndValidateSchema with Result
Mosnar Jan 4, 2023
f2bee7b
Fix doc block
Mosnar Jan 4, 2023
94954af
Readonly
Mosnar Jan 5, 2023
c0ee055
Improve httpRequestProcessor and its tests
Mosnar Jan 5, 2023
bd938cb
Use node 18 in GitHub Actions
Mosnar Jan 5, 2023
bf96a18
Use kebab case for util filenames
Mosnar Jan 8, 2023
daec0f8
Switch from nx/lerna to turborepo
Mosnar Jan 15, 2023
f5e7888
Switch jest with vitest
Mosnar Jan 15, 2023
1eda0e4
Import types more carefully
Mosnar Jan 15, 2023
99a5e00
Added benchmark files to tsconfig
Mosnar Jan 15, 2023
5927744
Hardening types
Mosnar Jan 16, 2023
7d15e2d
Increase avif timeout
Mosnar Jan 19, 2023
35c7a8b
No multithreading allowed during tests
Mosnar Jan 19, 2023
a531147
No multithreading allowed during tests
Mosnar Jan 19, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
28 changes: 28 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"root": true,
"env": {
"es6": true,
"node": true,
"jest": true
},
"parser": "@typescript-eslint/parser",
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"plugins": [
"@typescript-eslint",
"eslint-plugin-tsdoc",
"eslint-plugin-neverthrow"
],
"parserOptions": {
"project": "./tsconfig.eslint.json"
},
"rules": {
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"no-console": "off",
"indent": ["error", 2],
"tsdoc/syntax": "warn"
}
}
8 changes: 0 additions & 8 deletions .github/main.workflow

This file was deleted.

9 changes: 4 additions & 5 deletions .github/workflows/nodejs.yml → .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI
name: Tests

on: [push, pull_request]

Expand All @@ -12,14 +12,13 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [18.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
- run: cp settings.example.yml settings.yml
15 changes: 14 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@
.idea
.nyc_output/
coverage
/node_modules/*
node_modules
.env

# package directories
jspm_packages

# Serverless directories
.serverless
settings.yml
settings.*.yml
!settings.example.yml

.esbuild

dist
lib
*.tsbuildinfo
.turbo

build/**
dist/**
lib/**
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 120,
"useTabs": true,
"singleQuote": true,
"quoteProps": "as-needed",
"trailingComma": "all",
"endOfLine": "lf"
}
31 changes: 30 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,37 @@
# Changelog

## Unreleased
## [3.0.0] - Unreleased
### Added
- Added support for AVIF output with `auto=format`
- Added esbuild for bundling build
- Added "offline" npm command for local testing
- Added image generation tests for common use-cases
- Added support for brightness via `bri=<number>`
- Added support for pixelate via `px=<number>`
- Added `fit=fill`
- Added `fit=fillmax`
- Added `fill=blur`

### Fixed
- Fixed bug that could result in pngs being larger than inputs
- Fixed potential errors caused by rounding during cropping
- Fixed potential bugs around input request formatting and schema parsing
- Fixed blur out of range issues
- Fixed schema parser not removing query parameters with empty values (use defaults)
- Fixed Last-Modified date not being the correct format (Thanks, @bs-thomas)

### Changed
- Added Lerna & convert to monorepo
- Move core code into packages/core as @serverless-sharp/core
- Migrate docs to Docusaurus
- Fix potential error with undefined multiValueQueryStringParameters
- Updated Imgix schema
- Updated to Serverless framework 3
- Updated Sharp to 0.31.2
- Added Makefile for building Sharp Lambda layer
- checkHash has become ensureHash
- The default Cache-Control header now includes 'public'
- Update to Node 18 runtime

### Fixed
- Fix quality parameter (`q`) not being respected with `auto=format`
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: buildsharplayer
SHELL = /bin/sh

buildsharplayer:
docker build -t sharp-layer --platform=linux/amd64 ./lambdaLayers/SharpLayer
docker run \
--platform=linux/amd64 \
-v `pwd`/lambdaLayers/SharpLayer:/app \
--name sharp-layer --rm sharp-layer
Loading