Skip to content

Commit 97d073b

Browse files
Update deps (#1319)
* update root deps * upgrade vitest * move folder * upgrade zod * fix build script * upgrade vitest browser * upgrade vite-plugin-node-polyfills * missed some tshy * upgrade playwright * upgrade png types * upgrade rollup deps * define engines * correct node types * ugrade docs deps * update pnpm * upgrade eslint
1 parent ba9de4d commit 97d073b

File tree

282 files changed

+2154
-2954
lines changed

Some content is hidden

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

282 files changed

+2154
-2954
lines changed

.all-contributorsrc

+149-455
Large diffs are not rendered by default.

.ncurc.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"reject": [
3+
// These deps are esm only
4+
"pixelmatch",
5+
"mime",
6+
"@types/mime",
7+
"file-type",
8+
// We support node 18 and above
9+
"@types/node"
10+
]
11+
}

.vscode/settings.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"prettier.prettierPath": "./node_modules/prettier/index.cjs",
3-
}
2+
"prettier.prettierPath": "./node_modules/prettier/index.cjs"
3+
}

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
#### Make brightness function behave like other implementations ([#1312](https://github.com/jimp-dev/jimp/pull/1312))
66

7-
This PR changes the `brightness` function to behave like the css brightness function and other implementations. Previously it was doing something odd. Instead of multiplying the color channel by the multiplier value, it multiplied against the inversion of the current color.
7+
This PR changes the `brightness` function to behave like the css brightness function and other implementations. Previously it was doing something odd. Instead of multiplying the color channel by the multiplier value, it multiplied against the inversion of the current color.
88

99
In the current version a value of `1` won't change the colors at all. Values above 1 will brighten the colors, values below 1 will darken the colors.
1010

lerna.json

+2-5
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,5 @@
33
"npmClient": "pnpm",
44
"registry": "https://registry.npmjs.org/",
55
"version": "1.1.2",
6-
"packages": [
7-
"packages/*",
8-
"plugins/*"
9-
]
10-
}
6+
"packages": ["packages/*", "plugins/*"]
7+
}

package.json

+11-14
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
2+
"name": "jimp-monorepo",
23
"private": true,
4+
"packageManager": "[email protected]",
35
"description": "The jimp monorepo.",
46
"repository": "jimp-dev/jimp",
5-
"author": "Andrew Lisowski <[email protected]>",
67
"engines": {
78
"node": ">=18"
89
},
10+
"author": "Andrew Lisowski <[email protected]>",
911
"scripts": {
10-
"build": "turbo run build build:browser --filter=!docs",
12+
"build": "turbo run build build:browser --filter=!@jimp/docs",
1113
"dev": "turbo run dev",
1214
"lint": "turbo run lint",
1315
"test": "turbo run test -- --watch=false",
@@ -16,24 +18,19 @@
1618
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
1719
"release": "pnpm build && auto shipit",
1820
"generate-package": "turbo gen package",
19-
"generate-plugin": "turbo gen plugin"
21+
"generate-plugin": "turbo gen plugin",
22+
"check-updates": "ncu --packageFile '{,*/**/}package.json'"
2023
},
2124
"devDependencies": {
2225
"@auto-it/all-contributors": "^11.2.1",
2326
"@auto-it/first-time-contributor": "^11.2.1",
2427
"@auto-it/released": "^11.2.1",
2528
"@jimp/config-eslint": "workspace:*",
2629
"@jimp/config-typescript": "workspace:*",
27-
"@turbo/gen": "^1.12.5",
28-
"any-base": "^1.1.0",
30+
"@turbo/gen": "^2.1.1",
2931
"auto": "^11.2.1",
30-
"prettier": "^3.2.5",
31-
"turbo": "^1.13.0"
32-
},
33-
"packageManager": "[email protected]",
34-
"publishConfig": {
35-
"registry": "https://registry.npmjs.org/",
36-
"access": "public"
37-
},
38-
"sideEffects": false
32+
"npm-check-updates": "^17.1.1",
33+
"prettier": "^3.3.3",
34+
"turbo": "^2.1.1"
35+
}
3936
}

packages/config-eslint/base.js

+24-40
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,28 @@
1-
const { resolve } = require("node:path");
1+
import js from "@eslint/js";
2+
import eslintConfigPrettier from "eslint-config-prettier";
3+
import turboPlugin from "eslint-plugin-turbo";
4+
import tseslint from "typescript-eslint";
25

3-
const project = resolve(process.cwd(), "tsconfig.json");
4-
5-
/** @type {import("eslint").Linter.Config} */
6-
module.exports = {
7-
extends: [
8-
"eslint:recommended",
9-
"prettier",
10-
"eslint-config-turbo",
11-
"plugin:@typescript-eslint/recommended",
12-
],
13-
plugins: ["only-warn"],
14-
globals: {
15-
React: true,
16-
JSX: true,
17-
},
18-
env: {
19-
node: true,
6+
export default [
7+
js.configs.recommended,
8+
eslintConfigPrettier,
9+
...tseslint.configs.recommended,
10+
{
11+
ignores: [
12+
// Ignore dotfiles
13+
".*.js",
14+
"node_modules/",
15+
"dist/",
16+
"**/browser.js",
17+
],
2018
},
21-
settings: {
22-
"import/resolver": {
23-
typescript: {
24-
project,
25-
},
19+
{
20+
name: "eslint-config-turbo (recreated flat)",
21+
plugins: {
22+
turbo: { rules: turboPlugin.rules },
2623
},
27-
},
28-
parser: "@typescript-eslint/parser",
29-
parserOptions: {
30-
project,
31-
},
32-
ignorePatterns: [
33-
// Ignore dotfiles
34-
".*.js",
35-
"node_modules/",
36-
"dist/",
37-
"**/browser.js",
38-
],
39-
overrides: [
40-
{
41-
files: ["*.js?(x)", "*.ts?(x)"],
24+
rules: {
25+
"turbo/no-undeclared-env-vars": "error",
4226
},
43-
],
44-
};
27+
},
28+
];

packages/config-eslint/package.json

+8-5
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,20 @@
44
"license": "MIT",
55
"private": true,
66
"main": "base.js",
7+
"type": "module",
78
"scripts": {
89
"clean": "rm -rf node_modules .tshy .tshy-build dist .turbo"
910
},
1011
"devDependencies": {
11-
"@typescript-eslint/eslint-plugin": "^7.2.0",
12-
"@typescript-eslint/parser": "^7.2.0",
1312
"eslint-config-prettier": "^9.1.0",
14-
"eslint-config-turbo": "^1.12.5",
15-
"eslint-plugin-only-warn": "^1.1.0",
13+
"eslint-config-turbo": "^2.1.1",
1614
"typescript": "^5.5.4"
1715
},
1816
"publishConfig": {},
19-
"sideEffects": false
17+
"sideEffects": false,
18+
"dependencies": {
19+
"@eslint/js": "^9.9.1",
20+
"@types/eslint__js": "^8.42.3",
21+
"typescript-eslint": "^8.3.0"
22+
}
2023
}

packages/config-typescript/base.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
"allowJs": true,
2020
"target": "ES2022"
2121
}
22-
}
22+
}

packages/config-vitest/browser.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { nodePolyfills } from "vite-plugin-node-polyfills";
66
const require = createRequire(import.meta.url);
77
const imagesFolder = path.join(
88
path.join(path.dirname(require.resolve("@jimp/test-utils")), "../../"),
9-
"images"
9+
"images",
1010
);
1111

1212
export default defineConfig({

packages/config-vitest/package.json

+7-4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "1.1.2",
44
"private": true,
55
"repository": "jimp-dev/jimp",
6+
"engines": {
7+
"node": ">=18"
8+
},
69
"scripts": {
710
"dev": "tshy --watch",
811
"clean": "rm -rf node_modules .tshy .tshy-build dist .turbo"
@@ -12,14 +15,14 @@
1215
"devDependencies": {
1316
"@jimp/config-typescript": "workspace:*",
1417
"@jimp/test-utils": "workspace:*",
15-
"eslint": "^8.57.0",
18+
"eslint": "^9.9.1",
1619
"typescript": "^5.5.4",
17-
"vitest": "^1.4.0"
20+
"vitest": "^2.0.5"
1821
},
1922
"dependencies": {
2023
"@esbuild-plugins/node-globals-polyfill": "^0.2.3",
21-
"playwright": "^1.42.1",
22-
"vite-plugin-node-polyfills": "^0.21.0"
24+
"playwright": "^1.46.1",
25+
"vite-plugin-node-polyfills": "^0.22.0"
2326
},
2427
"type": "module",
2528
"publishConfig": {

packages/core/.eslintrc.cjs

-5
This file was deleted.

packages/core/eslint.config.mjs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import shared from "@jimp/config-eslint/base.js";
2+
export default [
3+
...shared,
4+
{
5+
rules: {
6+
"@typescript-eslint/no-explicit-any": "off",
7+
},
8+
},
9+
];

packages/core/package.json

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@jimp/core",
33
"version": "1.1.2",
44
"repository": "jimp-dev/jimp",
5+
"engines": {
6+
"node": ">=18"
7+
},
58
"scripts": {
69
"lint": "eslint .",
710
"test-off": "vitest",
@@ -26,11 +29,11 @@
2629
"@jimp/test-utils": "workspace:*",
2730
"@types/file-type": "^10.9.1",
2831
"@types/mime": "^3.0.4",
29-
"@types/node": "^20.12.5",
30-
"eslint": "^8.57.0",
32+
"@types/node": "^18.19.48",
33+
"eslint": "^9.9.1",
3134
"tshy": "^3.0.2",
3235
"typescript": "^5.5.4",
33-
"vitest": "^1.4.0"
36+
"vitest": "^2.0.5"
3437
},
3538
"tshy": {
3639
"exclude": [

packages/core/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ export function createJimp<
386386
let outputImage: Jimp;
387387

388388
if (format.hasAlpha) {
389+
// eslint-disable-next-line @typescript-eslint/no-this-alias
389390
outputImage = this;
390391
} else {
391392
outputImage = new CustomJimp({

packages/core/src/utils/composite.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Edge, JimpClass } from "@jimp/types";
22

33
import { BlendMode } from "./constants.js";
44
import * as compositeModes from "./composite-modes.js";
5-
import { limit255, scan } from "@jimp/utils";
5+
import { limit255 } from "@jimp/utils";
66

77
export function composite<I extends JimpClass>(
88
baseImage: I,
@@ -23,11 +23,8 @@ export function composite<I extends JimpClass>(
2323
throw new Error("x and y must be numbers");
2424
}
2525

26-
let {
27-
mode = BlendMode.SRC_OVER,
28-
opacitySource = 1.0,
29-
opacityDest = 1.0,
30-
} = options;
26+
const { mode = BlendMode.SRC_OVER } = options;
27+
let { opacitySource = 1.0, opacityDest = 1.0 } = options;
3128

3229
if (
3330
typeof opacitySource !== "number" ||
@@ -41,7 +38,6 @@ export function composite<I extends JimpClass>(
4138
opacityDest = 1.0;
4239
}
4340

44-
// eslint-disable-next-line import/namespace
4541
const blendmode = compositeModes[mode];
4642

4743
// round input

packages/core/src/utils/image-bitmap.ts

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
import EXIFParser, { ExifData } from "exif-parser";
22
import { JimpClass } from "@jimp/types";
33

4-
const EXIF_TAGS = {
5-
ORIENTATION: 0x0112, // decimal: 274
6-
IMAGE_WIDTH: 0x0100, // decimal: 256
7-
IMAGE_HEIGHT: 0x0101, // decimal: 257
8-
};
9-
104
/**
115
* Obtains image orientation from EXIF metadata.
126
*
@@ -120,7 +114,7 @@ function transformBitmap<I extends JimpClass>(
120114
img.bitmap.width = width;
121115
img.bitmap.height = height;
122116

123-
// @ts-ignore
117+
// @ts-expect-error Accessing private property
124118
img._exif.tags.Orientation = 1;
125119
}
126120

@@ -154,6 +148,6 @@ export async function attemptExifRotate<I extends JimpClass>(
154148

155149
exifRotate(image); // EXIF data
156150
} catch (error) {
157-
/* meh */
151+
console.error(error);
158152
}
159153
}

packages/diff/.eslintrc.cjs

-5
This file was deleted.

packages/diff/eslint.config.mjs

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import shared from "@jimp/config-eslint/base.js";
2+
export default [...shared];

packages/diff/package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
"name": "@jimp/diff",
33
"version": "1.1.2",
44
"repository": "jimp-dev/jimp",
5+
"engines": {
6+
"node": ">=18"
7+
},
58
"scripts": {
69
"lint": "eslint .",
710
"test": "vitest",
@@ -23,10 +26,10 @@
2326
"@jimp/core": "workspace:*",
2427
"@jimp/test-utils": "workspace:*",
2528
"@types/pixelmatch": "^5.2.6",
26-
"eslint": "^8.57.0",
29+
"eslint": "^9.9.1",
2730
"tshy": "^3.0.2",
2831
"typescript": "^5.5.4",
29-
"vitest": "^1.4.0"
32+
"vitest": "^2.0.5"
3033
},
3134
"tshy": {
3235
"exclude": [

packages/diff/src/index.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ describe("Compare image difference", () => {
4444

4545
test("throws an error if threshold is invalid", () => {
4646
expect(() => diff(imgs[0], imgs[3], -1)).toThrow(
47-
"threshold must be a number between 0 and 1"
47+
"threshold must be a number between 0 and 1",
4848
);
4949
});
5050

5151
test("should resize image before diffing", () => {
5252
expect(diff(imgs[3], imgs[4]).percent).toStrictEqual(
53-
diff(imgs[4], imgs[3]).percent
53+
diff(imgs[4], imgs[3]).percent,
5454
);
5555
});
5656
});

packages/diff/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export function diff<I extends JimpClass>(img1: I, img2: I, threshold = 0.1) {
4848
throw new Error("threshold must be a number between 0 and 1");
4949
}
5050

51+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
5152
const diff = new (img1 as any).constructor({
5253
width: bmp1.width,
5354
height: bmp1.height,

0 commit comments

Comments
 (0)