@dreamonkey/responsive-image-loader
Advanced tools
Comparing version 0.3.3 to 0.4.0
# Changelog | ||
## 0.3.4 | ||
- Chore: update deps | ||
- Feat: add `thumbor-docker` transformer | ||
- Chore: deprecate `thumbor` transformer | ||
- Feat: support Windows and Mac using docker to run Thumbor | ||
## 0.3.3 | ||
@@ -4,0 +11,0 @@ |
@@ -8,2 +8,4 @@ "use strict"; | ||
const path_1 = require("path"); | ||
// eslint-disable-next-line @typescript-eslint/unbound-method | ||
const { join: posixJoin } = path_1.posix; | ||
let _pathAliases; | ||
@@ -45,4 +47,4 @@ let _outputDir; | ||
exports.guardAgainstDefaultAlias = guardAgainstDefaultAlias; | ||
const TEMP_DIR = 'dist/temp'; | ||
const TEMP_IMAGES_DIR = `${TEMP_DIR}/images`; | ||
const TEMP_DIR = path_1.join('dist', 'temp'); | ||
const TEMP_IMAGES_DIR = path_1.join(TEMP_DIR, 'images'); | ||
function existsOrCreateDirectory(dir) { | ||
@@ -74,3 +76,4 @@ if (!fs_1.existsSync(dir)) { | ||
const { name: filename, ext: extension } = path_1.parse(path); | ||
const uriStart = path_1.join(getOuputDir(), filename); | ||
// The URI is a relative URL, and as such must always use posix style separators ("/") | ||
const uriStart = posixJoin(getOuputDir(), filename); | ||
const uriBody = uriBodyGenerator(); | ||
@@ -77,0 +80,0 @@ return { |
@@ -7,3 +7,4 @@ "use strict"; | ||
const helpers_1 = require("./helpers"); | ||
const thumbor_1 = require("./transformers/thumbor"); | ||
const thumbor_1 = require("./transformers/thumbor/thumbor"); | ||
const thumbor_docker_1 = require("./transformers/thumbor-docker/thumbor-docker"); | ||
function isCustomTransformation(transformation) { | ||
@@ -113,2 +114,3 @@ return lodash_1.has(transformation, 'path'); | ||
thumbor: thumbor_1.thumborTransformer, | ||
'thumbor-docker': thumbor_docker_1.thumborDockerTransformer, | ||
}); | ||
@@ -115,0 +117,0 @@ function transformImage(imagePath, transformations, transformer) { |
{ | ||
"name": "@dreamonkey/responsive-image-loader", | ||
"version": "0.3.3", | ||
"version": "0.4.0", | ||
"description": "A webpack loader to automagically bring your website images to a whole new level of responsiveness!", | ||
@@ -24,3 +24,3 @@ "keywords": [ | ||
"test:debug": "node --inspect node_modules/.bin/jest --runInBand", | ||
"build": "tsc && copyfiles -f src/transformers/thumbor.conf dist/src/transformers && webpack", | ||
"build": "tsc && copyfiles -f src/transformers/thumbor/thumbor.conf dist/src/transformers/thumbor && copyfiles -f src/transformers/thumbor-docker/.thumbor-env dist/src/transformers/thumbor-docker && webpack", | ||
"//": "'--tag latest' cannot be managed with publishConfig because of https://github.com/yarnpkg/yarn/issues/5310", | ||
@@ -38,13 +38,13 @@ "deploy": "yarn build && yarn publish --tag latest" | ||
"dependencies": { | ||
"@types/sharp": "^0.25.1", | ||
"@types/webpack": "^4.41.0", | ||
"file-type": "^14.6.2", | ||
"@types/sharp": "^0.26.0", | ||
"@types/webpack": "^4.41.22", | ||
"file-type": "^15.0.0", | ||
"lodash-es": "^4.17.15", | ||
"request": "^2.88.0", | ||
"schema-utils": "^2.6.6", | ||
"sharp": "^0.25.4" | ||
"schema-utils": "^2.7.1", | ||
"sharp": "^0.26.0" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "26.0.7", | ||
"@types/json-schema": "7.0.5", | ||
"@types/jest": "26.0.13", | ||
"@types/json-schema": "7.0.6", | ||
"@types/loader-utils": "1.1.3", | ||
@@ -55,15 +55,15 @@ "@types/lodash-es": "4.17.3", | ||
"@types/request": "2.48.5", | ||
"@typescript-eslint/eslint-plugin": "3.7.1", | ||
"@typescript-eslint/parser": "3.7.1", | ||
"@typescript-eslint/eslint-plugin": "4.1.0", | ||
"@typescript-eslint/parser": "4.1.0", | ||
"copyfiles": "2.3.0", | ||
"eslint": "7.5.0", | ||
"eslint": "7.8.1", | ||
"eslint-config-prettier": "6.11.0", | ||
"eslint-plugin-jest": "23.19.0", | ||
"jest": "26.1.0", | ||
"eslint-plugin-jest": "24.0.0", | ||
"jest": "26.4.2", | ||
"memory-fs": "0.5.0", | ||
"raw-loader": "4.0.1", | ||
"ts-essentials": "^7.0.0", | ||
"ts-jest": "26.1.4", | ||
"typescript": "^3.9.7", | ||
"webpack": "^4.42.1", | ||
"ts-jest": "26.3.0", | ||
"typescript": "^4.0.2", | ||
"webpack": "^4.44.1", | ||
"webpack-cli": "^3.3.11" | ||
@@ -76,3 +76,4 @@ }, | ||
"os": [ | ||
"linux" | ||
"linux", | ||
"win32" | ||
], | ||
@@ -79,0 +80,0 @@ "publishConfig": { |
@@ -159,13 +159,29 @@ # responsive-image-loader | ||
#### [`thumbor`](https://github.com/thumbor/thumbor) (art direction) | ||
#### [`thumbor`](https://github.com/thumbor/thumbor) (art direction, **Linux-only**) | ||
Installation is currently a pain in the ass and docs are out-of-sync, but it's still the best open source tool for art-direction out in the wild right now. You can check [here](https://github.com/thumbor/thumbor/issues/1221#issuecomment-550424664) how I managed to make it work. | ||
Local installation of thumbor is currently a pain in the ass and docs are out-of-sync, we highly suggest you to use `thumbor-docker` engine instead. | ||
If you still want to install it locally, you can check [here](https://github.com/thumbor/thumbor/issues/1221#issuecomment-550424664) how I managed to make it work. | ||
**Thumbor adapter is currently the most messed up adapter and only works under Linux.** | ||
It ships with a preset configuration, but you can overwrite string config options [via environment variables](https://thumbor.readthedocs.io/en/latest/configuration.html#override-config-through-environment-variable). | ||
This adapter ships with a preset configuration, but you can overwrite string config options [via environment variables](https://thumbor.readthedocs.io/en/latest/configuration.html#override-config-through-environment-variable). | ||
We also didn't found an elegant solution to abstract most of the transformation adapter code into common code and to start `thumbor` instance just once per build process, so if you can think of a solution for this which **is self contained and doesn't require external configuration**, we'd like to get in touch with you. | ||
This engine leverage Thumbor cache and as such build time will decrease on subsequent runs. | ||
This engine will be deprecated when a custom cache mechanism will be added on the loader. | ||
That's a lot of limitations, we know, any help with this part of the loader (and support for an equivalent software, even if paid and closed source) will be greatly appreciated. | ||
#### [`thumbor-docker`](https://github.com/thumbor/thumbor) (art direction, **cross-platform**) | ||
This engine is the same as `thumbor` one, but it works cross-platform and it's installation is much more easier, thanks to the usage of docker. | ||
When releasing v1, this loader will be renamed as `thumbor` and will be the default one. | ||
First setup Docker on your system: | ||
- [Linux](https://docs.docker.com/engine/install/ubuntu/) (we suggest to use ["rootless" mode](https://docs.docker.com/engine/security/rootless)) | ||
- [Windows](https://docs.docker.com/docker-for-windows/install/) | ||
- [Mac](https://docs.docker.com/docker-for-mac/install/) | ||
Then pull [docker Thumbor image](https://github.com/MinimalCompact/thumbor) running `docker pull minimalcompact/thumbor`. | ||
This engine ships with a preset configuration, unlike `thumbor` engine you currently **cannot overwrite** string config options via environment variables. If needed, we will take into consideration adding this feature. | ||
Due to its nature of spawning a brand new container for every build cycle, using `thumbor-docker` will not leverage Thumbor cache mechanism as `thumbor` engine does, meaning build time will not decrease on subsequent runs. | ||
## <span id="usage"></span> Usage | ||
@@ -539,3 +555,3 @@ | ||
Specify the adapter to use for image transformations. | ||
You can provide the name of a preset adapter (only `thumbor` for now) **after you [installed it](#engines) properly on your system**. | ||
You can provide the name of a preset adapter **after you [installed it](#engines) properly on your system**. | ||
Providing `null` disables art direction. | ||
@@ -542,0 +558,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
169561
44
1506
779
5
3
+ Added@types/sharp@0.26.1(transitive)
+ Addedarray-flatten@3.0.0(transitive)
+ Addedfile-type@15.0.1(transitive)
+ Addedprebuild-install@6.1.4(transitive)
+ Addedsharp@0.26.3(transitive)
- Removed@types/sharp@0.25.1(transitive)
- Removedchownr@2.0.0(transitive)
- Removedfile-type@14.7.1(transitive)
- Removedfs-minipass@2.1.0(transitive)
- Removedminipass@3.3.65.0.0(transitive)
- Removedminizlib@2.1.2(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removednoop-logger@0.1.1(transitive)
- Removedprebuild-install@5.3.6(transitive)
- Removedsharp@0.25.4(transitive)
- Removedtar@6.2.1(transitive)
- Removedwhich-pm-runs@1.1.0(transitive)
- Removedyallist@4.0.0(transitive)
Updated@types/sharp@^0.26.0
Updated@types/webpack@^4.41.22
Updatedfile-type@^15.0.0
Updatedschema-utils@^2.7.1
Updatedsharp@^0.26.0