Skip to content

Commit

Permalink
Upgrade nearly-all dev deps (#799)
Browse files Browse the repository at this point in the history
* Upgrade nearly-all dev deps

* Revert node8 breaking change dep upgrade

* Fix issues with new `xo` version

* Revert 'auto' due to failing release

* 🙏

* run without cache
  • Loading branch information
crutchcorn authored and hipstersmoothie committed Sep 24, 2019
1 parent 3b58221 commit 29679fa
Show file tree
Hide file tree
Showing 26 changed files with 4,311 additions and 3,249 deletions.
10 changes: 0 additions & 10 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ jobs:
<<: *defaults
steps:
- checkout
- restore_cache:
keys:
# Find a cache corresponding to this specific package.json checksum
# when this file is changed, this key will fail
- jimp-{{ .Branch }}-{{ checksum "yarn.lock" }}-{{ checksum ".circleci/config.yml" }}
- jimp-{{ .Branch }}-{{ checksum "yarn.lock" }}
- jimp-{{ .Branch }}
# Find the most recent cache used from any branch
- jimp-master
- jimp-
- run:
name: Install Dependencies
command: yarn install --frozen-lockfile
Expand Down
59 changes: 30 additions & 29 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,40 @@
"tsTest:main": "dtslint packages/jimp/types --expectOnly"
},
"devDependencies": {
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-syntax-object-rest-spread": "^7.0.0",
"@babel/preset-env": "^7.1.0",
"@babel/register": "^7.0.0",
"auto": "^7.4.1",
"babel-eslint": "^9.0.0",
"babel-plugin-add-module-exports": "^1.0.0",
"babel-plugin-istanbul": "^5.0.1",
"babel-plugin-source-map-support": "^2.0.1",
"@babel/cli": "^7.6.0",
"@babel/core": "^7.6.0",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-syntax-object-rest-spread": "^7.2.0",
"@babel/preset-env": "^7.6.0",
"@babel/register": "^7.6.0",
"auto": "^7.6.0",
"babel-eslint": "^10.0.3",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-istanbul": "^5.2.0",
"babel-plugin-source-map-support": "^2.1.1",
"babel-plugin-transform-inline-environment-variables": "^0.4.3",
"cross-env": "^5.2.0",
"dtslint": "^0.9.6",
"eslint-plugin-prettier": "^2.6.2",
"express": "^4.16.3",
"husky": "^1.0.0-rc.15",
"karma": "^3.0.0",
"karma-browserify": "^5.3.0",
"karma-chrome-launcher": "^2.2.0",
"karma-firefox-launcher": "^1.1.0",
"cross-env": "^6.0.0",
"dtslint": "^0.9.8",
"eslint": "^6.4.0",
"eslint-config-prettier": "^6.3.0",
"express": "^4.17.1",
"husky": "^3.0.5",
"karma": "^4.3.0",
"karma-browserify": "^6.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^1.2.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"lerna": "^3.13.4",
"lerna-changelog": "^0.8.0",
"lint-staged": "^7.3.0",
"mocha": "^5.2.0",
"nyc": "^13.0.1",
"prettier": "^1.14.3",
"lerna": "^3.16.4",
"lerna-changelog": "^0.8.2",
"lint-staged": "^9.2.5",
"mocha": "^6.2.0",
"nyc": "^14.1.1",
"prettier": "^1.18.2",
"should": "^13.2.3",
"source-map-support": "^0.5.9",
"watchify": "^3.11.0",
"xo": "^0.23.0"
"source-map-support": "^0.5.13",
"watchify": "^3.11.1",
"xo": "^0.24.0"
},
"auto": {
"plugins": [
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@types/log-symbols": "^2.0.0",
"@types/mocha": "^5.2.5",
"@types/mocha": "^5.2.7",
"@types/yargs": "^11.1.1",
"ts-node": "^7.0.1",
"typescript": "^3.1.3"
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1125,6 +1125,7 @@ export function jimpEvMethod(methodName, evName, method) {

cb.apply(this, args);
};

args[args.length - 1] = wrappedCb;
} else {
wrappedCb = false;
Expand Down
62 changes: 32 additions & 30 deletions packages/core/src/modules/phash.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,24 @@ ImagePHash.prototype.distance = function(s1, s2) {
counter++;
}
}

return counter / s1.length;
};

// Returns a 'binary string' (like. 001010111011100010) which is easy to do a hamming distance on.
ImagePHash.prototype.getHash = function(img) {
/* 1. Reduce size.
* Like Average Hash, pHash starts with a small image.
* However, the image is larger than 8x8; 32x32 is a good size.
* This is really done to simplify the DCT computation and not
* because it is needed to reduce the high frequencies.
*/
* Like Average Hash, pHash starts with a small image.
* However, the image is larger than 8x8; 32x32 is a good size.
* This is really done to simplify the DCT computation and not
* because it is needed to reduce the high frequencies.
*/
img = img.clone().resize(this.size, this.size);

/* 2. Reduce color.
* The image is reduced to a grayscale just to further simplify
* the number of computations.
*/
* The image is reduced to a grayscale just to further simplify
* the number of computations.
*/
img.grayscale();

const vals = [];
Expand All @@ -74,23 +75,23 @@ ImagePHash.prototype.getHash = function(img) {
}

/* 3. Compute the DCT.
* The DCT separates the image into a collection of frequencies
* and scalars. While JPEG uses an 8x8 DCT, this algorithm uses
* a 32x32 DCT.
*/
* The DCT separates the image into a collection of frequencies
* and scalars. While JPEG uses an 8x8 DCT, this algorithm uses
* a 32x32 DCT.
*/
const dctVals = applyDCT(vals, this.size);

/* 4. Reduce the DCT.
* This is the magic step. While the DCT is 32x32, just keep the
* top-left 8x8. Those represent the lowest frequencies in the
* picture.
*/
* This is the magic step. While the DCT is 32x32, just keep the
* top-left 8x8. Those represent the lowest frequencies in the
* picture.
*/
/* 5. Compute the average value.
* Like the Average Hash, compute the mean DCT value (using only
* the 8x8 DCT low-frequency values and excluding the first term
* since the DC coefficient can be significantly different from
* the other values and will throw off the average).
*/
* Like the Average Hash, compute the mean DCT value (using only
* the 8x8 DCT low-frequency values and excluding the first term
* since the DC coefficient can be significantly different from
* the other values and will throw off the average).
*/
let total = 0;

for (let x = 0; x < this.smallerSize; x++) {
Expand All @@ -102,15 +103,15 @@ ImagePHash.prototype.getHash = function(img) {
const avg = total / (this.smallerSize * this.smallerSize);

/* 6. Further reduce the DCT.
* This is the magic step. Set the 64 hash bits to 0 or 1
* depending on whether each of the 64 DCT values is above or
* below the average value. The result doesn't tell us the
* actual low frequencies; it just tells us the very-rough
* relative scale of the frequencies to the mean. The result
* will not vary as long as the overall structure of the image
* remains the same; this can survive gamma and color histogram
* adjustments without a problem.
*/
* This is the magic step. Set the 64 hash bits to 0 or 1
* depending on whether each of the 64 DCT values is above or
* below the average value. The result doesn't tell us the
* actual low frequencies; it just tells us the very-rough
* relative scale of the frequencies to the mean. The result
* will not vary as long as the overall structure of the image
* remains the same; this can survive gamma and color histogram
* adjustments without a problem.
*/
let hash = '';

for (let x = 0; x < this.smallerSize; x++) {
Expand Down Expand Up @@ -169,6 +170,7 @@ function applyDCT(f, size) {
f[i][j];
}
}

sum *= (c[u] * c[v]) / 4;
F[u][v] = sum;
}
Expand Down
35 changes: 32 additions & 3 deletions packages/jimp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,42 @@
"regenerator-runtime": "^0.13.3"
},
"devDependencies": {
"@babel/cli": "^7.6.0",
"@babel/core": "^7.6.0",
"@babel/plugin-proposal-class-properties": "^7.5.5",
"@babel/plugin-syntax-object-rest-spread": "^7.2.0",
"@babel/preset-env": "^7.6.0",
"@babel/register": "^7.6.0",
"@jimp/test-utils": "^0.8.4",
"auto": "^7.6.0",
"babel-eslint": "^10.0.3",
"babel-plugin-add-module-exports": "^1.0.2",
"babel-plugin-istanbul": "^5.2.0",
"babel-plugin-source-map-support": "^2.1.1",
"babelify": "^10.0.0",
"browserify": "^16.2.2",
"browserify": "^16.5.0",
"cross-env": "^6.0.0",
"dtslint": "^0.9.8",
"envify": "^4.1.0",
"express": "^4.16.3",
"eslint": "^6.4.0",
"eslint-plugin-prettier": "^3.1.1",
"express": "^4.17.1",
"husky": "^3.0.5",
"karma": "^4.3.0",
"karma-browserify": "^6.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-firefox-launcher": "^1.2.0",
"lerna": "^3.16.4",
"lerna-changelog": "^0.8.2",
"lint-staged": "^9.2.5",
"mocha": "^6.2.0",
"nyc": "^14.1.1",
"prettier": "^1.18.2",
"source-map-support": "^0.5.13",
"tfilter": "^1.0.1",
"uglify-js": "^3.4.9"
"uglify-js": "^3.6.0",
"watchify": "^3.11.1",
"xo": "^0.24.0"
},
"xo": false,
"nyc": {
Expand Down
1 change: 1 addition & 0 deletions packages/jimp/test/callbacks.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ describe('Callbacks', () => {
image.getJGDSync().should.be.sameJGD(result);
done();
}

targetImg.clone()[op](...args.concat(save));
});
}
Expand Down
2 changes: 0 additions & 2 deletions packages/jimp/test/filetypes.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-control-regex */

import fs from 'fs';
import should from 'should';
import { Jimp, getTestDir } from '@jimp/test-utils';
Expand Down
2 changes: 0 additions & 2 deletions packages/jimp/test/hash.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-control-regex */

import { Jimp, getTestDir } from '@jimp/test-utils';
import configure from '@jimp/custom';
import types from '@jimp/types';
Expand Down
1 change: 1 addition & 0 deletions packages/jimp/tools/browser-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ if (!module.parent) {
config = {};
baseFiles = process.argv.slice(3);
}

if (baseFiles.length === 0) throw new Error('No file given.');
bundle(baseFiles, config, (err, code) => {
if (err) throw err;
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-blit/test/blit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ describe('Blit over image', function() {
imgHeight
);
}

newImage.blit(
head,
butt.bitmap.width + fuzz.bitmap.width * longCat,
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-blur/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default () => ({

yi++;
}

yw += this.bitmap.width << 2;
}

Expand Down
1 change: 1 addition & 0 deletions packages/plugin-color/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function applyKernel(im, kernel, x, y) {
value[2] += im.bitmap.data[idx + 2] * kernel[kx][ky];
}
}

return value;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/plugin-crop/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ export default function pluginCrop(event) {
break north;
}
}

// this row contains all pixels with the same color: increment this side pixels to crop
northPixelsToCrop++;
}
Expand All @@ -159,6 +160,7 @@ export default function pluginCrop(event) {
break east;
}
}

// this column contains all pixels with the same color: increment this side pixels to crop
eastPixelsToCrop++;
}
Expand All @@ -179,6 +181,7 @@ export default function pluginCrop(event) {
break south;
}
}

// this row contains all pixels with the same color: increment this side pixels to crop
southPixelsToCrop++;
}
Expand All @@ -199,6 +202,7 @@ export default function pluginCrop(event) {
break west;
}
}

// this column contains all pixels with the same color: increment this side pixels to crop
westPixelsToCrop++;
}
Expand Down
2 changes: 0 additions & 2 deletions packages/plugin-normalize/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable no-labels */

import { isNodePattern } from '@jimp/utils';

/**
Expand Down
7 changes: 7 additions & 0 deletions packages/plugin-resize/src/modules/resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function Resize(
this.interpolationPass = Boolean(interpolationPass);
this.resizeCallback =
typeof resizeCallback === 'function' ? resizeCallback : function() {};

this.targetWidthMultipliedByChannels = this.targetWidth * this.colorChannels;
this.originalWidthMultipliedByChannels =
this.widthOriginal * this.colorChannels;
Expand Down Expand Up @@ -63,6 +64,7 @@ Resize.prototype.configurePasses = function() {
this.colorChannels === 4 ? this.resizeWidthRGBA : this.resizeWidthRGB;
}
}

if (this.heightOriginal === this.targetHeight) {
// Bypass the height resizer pass:
this.resizeHeight = this.bypassResizer;
Expand Down Expand Up @@ -114,6 +116,7 @@ Resize.prototype._resizeWidthInterpolatedRGBChannels = function(
outputBuffer[finalOffset + 3] = buffer[pixelOffset + 3];
}
}

// Adjust for overshoot of the last pass's counter:
weight -= 1 / 3;
let interpolationWidthSourceReadStop;
Expand Down Expand Up @@ -234,6 +237,7 @@ Resize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {
trustworthyColorsCount[line / channelsNum - 1] += a ? multiplier : 0;
}
}

if (weight >= amountToNext) {
actualPosition += channelsNum;
currentPosition = actualPosition;
Expand Down Expand Up @@ -267,6 +271,7 @@ Resize.prototype._resizeWidthRGBChannels = function(buffer, fourthChannel) {

outputOffset += channelsNum;
} while (outputOffset < this.targetWidthMultipliedByChannels);

return outputBuffer;
};

Expand Down Expand Up @@ -442,6 +447,7 @@ Resize.prototype.resizeHeightInterpolated = function(buffer) {
);
}
}

// Handle for only one interpolation input being valid for end calculation:
while (finalOffset < this.finalResultSize) {
for (
Expand All @@ -457,6 +463,7 @@ Resize.prototype.resizeHeightInterpolated = function(buffer) {
);
}
}

return outputBuffer;
};

Expand Down

0 comments on commit 29679fa

Please sign in to comment.