@jimp/custom
Advanced tools
Comparing version 0.16.3-canary.1125.1580.0 to 0.16.3
@@ -0,1 +1,13 @@ | ||
# v0.16.3 (Sat Feb 04 2023) | ||
#### ⚠️ Pushed to `master` | ||
- upgrade prettier ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
#### Authors: 1 | ||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
--- | ||
# v0.11.0 (Fri May 15 2020) | ||
@@ -39,3 +51,3 @@ | ||
#### 🐛 Bug Fix | ||
#### 🐛 Bug Fix | ||
@@ -48,2 +60,2 @@ - `@jimp/cli`, `@jimp/core`, `@jimp/custom`, `jimp`, `@jimp/plugin-blit`, `@jimp/plugin-blur`, `@jimp/plugin-circle`, `@jimp/plugin-color`, `@jimp/plugin-contain`, `@jimp/plugin-cover`, `@jimp/plugin-crop`, `@jimp/plugin-displace`, `@jimp/plugin-dither`, `@jimp/plugin-fisheye`, `@jimp/plugin-flip`, `@jimp/plugin-gaussian`, `@jimp/plugin-invert`, `@jimp/plugin-mask`, `@jimp/plugin-normalize`, `@jimp/plugin-print`, `@jimp/plugin-resize`, `@jimp/plugin-rotate`, `@jimp/plugin-scale`, `@jimp/plugin-shadow`, `@jimp/plugin-threshold`, `@jimp/plugins`, `@jimp/test-utils`, `@jimp/bmp`, `@jimp/gif`, `@jimp/jpeg`, `@jimp/png`, `@jimp/tiff`, `@jimp/types`, `@jimp/utils` | ||
- Andrew Lisowski ([@hipstersmoothie](https://github.com/hipstersmoothie)) | ||
- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) | ||
- Corbin Crutchley ([@crutchcorn](https://github.com/crutchcorn)) |
{ | ||
"name": "@jimp/custom", | ||
"version": "0.16.3-canary.1125.1580.0", | ||
"version": "0.16.3", | ||
"description": "Interface to customize jimp configuration", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"@babel/runtime": "^7.7.2", | ||
"@jimp/core": "0.16.3-canary.1125.1580.0" | ||
"@jimp/core": "^0.16.3" | ||
}, | ||
@@ -27,3 +27,3 @@ "publishConfig": { | ||
}, | ||
"gitHead": "bfdb98aaf820272c06e332483b943d0ac58659db" | ||
"gitHead": "b9ac83d855d09deecde129a9c9b5b328ba7ea5b2" | ||
} |
@@ -13,11 +13,11 @@ <div align="center"> | ||
```js | ||
import configure from '@jimp/custom'; | ||
import configure from "@jimp/custom"; | ||
// all of jimp's default types | ||
import types from '@jimp/types'; | ||
import types from "@jimp/types"; | ||
// all of jimp's default types | ||
import plugins from '@jimp/plugins'; | ||
import plugins from "@jimp/plugins"; | ||
configure({ | ||
types: [types], | ||
plugins: [plugins] | ||
plugins: [plugins], | ||
}); | ||
@@ -58,3 +58,3 @@ ``` | ||
let jimp = configure({ | ||
types: [bmp] | ||
types: [bmp], | ||
}); | ||
@@ -64,3 +64,3 @@ | ||
{ | ||
types: [jpeg] | ||
types: [jpeg], | ||
}, | ||
@@ -173,3 +173,3 @@ jimp | ||
```js | ||
import { isNodePattern } from '@jimp/utils'; | ||
import { isNodePattern } from "@jimp/utils"; | ||
@@ -183,11 +183,13 @@ /** | ||
invert(cb) { | ||
this.scanQuiet(0, 0, this.bitmap.width, this.bitmap.height, function( | ||
x, | ||
y, | ||
idx | ||
) { | ||
this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; | ||
this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; | ||
this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; | ||
}); | ||
this.scanQuiet( | ||
0, | ||
0, | ||
this.bitmap.width, | ||
this.bitmap.height, | ||
function (x, y, idx) { | ||
this.bitmap.data[idx] = 255 - this.bitmap.data[idx]; | ||
this.bitmap.data[idx + 1] = 255 - this.bitmap.data[idx + 1]; | ||
this.bitmap.data[idx + 2] = 255 - this.bitmap.data[idx + 2]; | ||
} | ||
); | ||
@@ -199,4 +201,4 @@ if (isNodePattern(cb)) { | ||
return this; | ||
} | ||
}, | ||
}); | ||
``` |
@@ -5,4 +5,4 @@ import Jimp, { | ||
addConstants, | ||
jimpEvChange | ||
} from '@jimp/core'; | ||
jimpEvChange, | ||
} from "@jimp/core"; | ||
@@ -15,3 +15,3 @@ export default function configure(configuration, jimpInstance = Jimp) { | ||
class: {}, | ||
constants: {} | ||
constants: {}, | ||
}; | ||
@@ -23,3 +23,3 @@ | ||
...jimpConfig[key], | ||
...value | ||
...value, | ||
}; | ||
@@ -35,3 +35,3 @@ }); | ||
} else { | ||
Object.entries(type.mime).forEach(mimeType => addType(...mimeType)); | ||
Object.entries(type.mime).forEach((mimeType) => addType(...mimeType)); | ||
} | ||
@@ -58,11 +58,11 @@ | ||
...jimpInstance.decoders, | ||
...jimpConfig.decoders | ||
...jimpConfig.decoders, | ||
}; | ||
jimpInstance.encoders = { | ||
...jimpInstance.encoders, | ||
...jimpConfig.encoders | ||
...jimpConfig.encoders, | ||
}; | ||
jimpInstance.hasAlpha = { | ||
...jimpInstance.hasAlpha, | ||
...jimpConfig.hasAlpha | ||
...jimpConfig.hasAlpha, | ||
}; | ||
@@ -69,0 +69,0 @@ } |
@@ -10,4 +10,4 @@ // TypeScript Version: 3.1 | ||
GetIntersectionFromPluginsStatics, | ||
JimpConstructors | ||
} from '@jimp/core'; | ||
JimpConstructors, | ||
} from "@jimp/core"; | ||
@@ -18,5 +18,11 @@ type JimpInstance< | ||
J extends JimpConstructors | ||
> = J & GetIntersectionFromPluginsStatics<Exclude<TypesFuncArr | PluginFuncArr, undefined>> & { | ||
prototype: JimpType & GetIntersectionFromPlugins<Exclude<TypesFuncArr | PluginFuncArr, undefined>> | ||
}; | ||
> = J & | ||
GetIntersectionFromPluginsStatics< | ||
Exclude<TypesFuncArr | PluginFuncArr, undefined> | ||
> & { | ||
prototype: JimpType & | ||
GetIntersectionFromPlugins< | ||
Exclude<TypesFuncArr | PluginFuncArr, undefined> | ||
>; | ||
}; | ||
@@ -23,0 +29,0 @@ declare function configure< |
@@ -1,10 +0,10 @@ | ||
import configure from '@jimp/custom'; | ||
import gif from '@jimp/gif'; | ||
import png from '@jimp/png'; | ||
import displace from '@jimp/plugin-displace'; | ||
import resize from '@jimp/plugin-resize'; | ||
import scale from '@jimp/plugin-scale'; | ||
import types from '@jimp/types'; | ||
import plugins from '@jimp/plugins'; | ||
import * as Jimp from 'jimp'; | ||
import configure from "@jimp/custom"; | ||
import gif from "@jimp/gif"; | ||
import png from "@jimp/png"; | ||
import displace from "@jimp/plugin-displace"; | ||
import resize from "@jimp/plugin-resize"; | ||
import scale from "@jimp/plugin-scale"; | ||
import types from "@jimp/types"; | ||
import plugins from "@jimp/plugins"; | ||
import * as Jimp from "jimp"; | ||
@@ -14,16 +14,16 @@ // configure should return a valid Jimp type with addons | ||
types: [gif, png], | ||
plugins: [displace, resize] | ||
plugins: [displace, resize], | ||
}); | ||
test('should function the same as the `jimp` types', () => { | ||
test("should function the same as the `jimp` types", () => { | ||
const FullCustomJimp = configure({ | ||
types: [types], | ||
plugins: [plugins] | ||
plugins: [plugins], | ||
}); | ||
const jimpInst = new FullCustomJimp('test'); | ||
const jimpInst = new FullCustomJimp("test"); | ||
// Main Jimp export should already have all of these already applied | ||
// $ExpectError | ||
jimpInst.read('Test'); | ||
jimpInst.read("Test"); | ||
jimpInst.displace(jimpInst, 2); | ||
@@ -33,4 +33,4 @@ jimpInst.resize(40, 40); | ||
jimpInst.shadow((err, val, coords) => {}); | ||
jimpInst.fishEye({r: 12}); | ||
jimpInst.circle({radius: 12, x: 12, y: 12}); | ||
jimpInst.fishEye({ r: 12 }); | ||
jimpInst.circle({ radius: 12, x: 12, y: 12 }); | ||
// $ExpectError | ||
@@ -46,3 +46,3 @@ jimpInst.PNG_FILTER_NONE; | ||
// Main Jimp export should already have all of these already applied | ||
FullCustomJimp.read('Test'); | ||
FullCustomJimp.read("Test"); | ||
@@ -58,4 +58,4 @@ // $ExpectType 0 | ||
test('can clone properly', async () => { | ||
const baseImage = await FullCustomJimp.read('filename'); | ||
test("can clone properly", async () => { | ||
const baseImage = await FullCustomJimp.read("filename"); | ||
const cloneBaseImage = baseImage.clone(); | ||
@@ -66,8 +66,8 @@ | ||
test('can handle `this` returns on the core type properly', () => { | ||
test("can handle `this` returns on the core type properly", () => { | ||
// $ExpectType number | ||
cloneBaseImage.posterize(3)._quality | ||
cloneBaseImage.posterize(3)._quality; | ||
}); | ||
test('can handle `this` returns properly', () => { | ||
test("can handle `this` returns properly", () => { | ||
cloneBaseImage | ||
@@ -77,13 +77,12 @@ .resize(1, 1) | ||
.mask(cloneBaseImage, 2, 2) | ||
.print('a' as any, 2, 2, 'a' as any) | ||
.print("a" as any, 2, 2, "a" as any) | ||
.resize(1, 1) | ||
.quality(1) | ||
.deflateLevel(2) | ||
._filterType; | ||
.deflateLevel(2)._filterType; | ||
}); | ||
test('can handle imageCallbacks `this` properly', () => { | ||
test("can handle imageCallbacks `this` properly", () => { | ||
cloneBaseImage.rgba(false, (_, jimpCBIn) => { | ||
// $ExpectError | ||
jimpCBIn.read('Test'); | ||
jimpCBIn.read("Test"); | ||
jimpCBIn.displace(jimpInst, 2); | ||
@@ -99,7 +98,7 @@ jimpCBIn.resize(40, 40); | ||
jimpCBIn.func(); | ||
}) | ||
}) | ||
}); | ||
}); | ||
}); | ||
test('Can handle callback with constructor', () => { | ||
test("Can handle callback with constructor", () => { | ||
const myBmpBuffer: Buffer = {} as any; | ||
@@ -109,3 +108,3 @@ | ||
// $ExpectError | ||
cbJimpInst.read('Test'); | ||
cbJimpInst.read("Test"); | ||
cbJimpInst.displace(jimpInst, 2); | ||
@@ -123,12 +122,11 @@ cbJimpInst.resize(40, 40); | ||
}); | ||
}); | ||
test('can handle custom jimp', () => { | ||
test("can handle custom jimp", () => { | ||
// Constants from types should be applied | ||
// $ExpectType 0 | ||
CustomJimp.PNG_FILTER_NONE; | ||
// Core functions should still work from Jimp | ||
CustomJimp.read('Test'); | ||
CustomJimp.read("Test"); | ||
@@ -141,14 +139,14 @@ // Constants should not(?) be applied from ill-formed plugins | ||
// $ExpectError | ||
CustomJimp.resize(40, 40) | ||
CustomJimp.resize(40, 40); | ||
// Constants should be applied from well-formed plugins | ||
CustomJimp.RESIZE_NEAREST_NEIGHBOR | ||
CustomJimp.RESIZE_NEAREST_NEIGHBOR; | ||
// $ExpectError | ||
CustomJimp.test; | ||
// $ExpectError | ||
CustomJimp.func(); | ||
const Jiimp = new CustomJimp('test'); | ||
const Jiimp = new CustomJimp("test"); | ||
// Methods from types should be applied | ||
@@ -167,7 +165,7 @@ Jiimp.deflateLevel(4); | ||
// Methods should be applied from well-formed plugins | ||
Jiimp.resize(40, 40) | ||
Jiimp.resize(40, 40); | ||
// Constants should not be applied to the object | ||
// $ExpectError | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR; | ||
@@ -181,6 +179,9 @@ // $ExpectError | ||
test('can compose', () => { | ||
const OtherCustomJimp = configure({ | ||
plugins: [scale] | ||
}, CustomJimp); | ||
test("can compose", () => { | ||
const OtherCustomJimp = configure( | ||
{ | ||
plugins: [scale], | ||
}, | ||
CustomJimp | ||
); | ||
// Constants from types should be applied | ||
@@ -191,3 +192,3 @@ // $ExpectType 0 | ||
// Core functions should still work from Jimp | ||
OtherCustomJimp.read('Test'); | ||
OtherCustomJimp.read("Test"); | ||
@@ -210,4 +211,4 @@ // Constants should not be applied to the static instance from ill-formed plugins | ||
OtherCustomJimp.func(); | ||
const Jiimp = new OtherCustomJimp('test'); | ||
const Jiimp = new OtherCustomJimp("test"); | ||
// Methods from types should be applied | ||
@@ -232,7 +233,7 @@ Jiimp.deflateLevel(4); | ||
// Methods should be applied from well-formed plugins | ||
Jiimp.resize(40, 40) | ||
Jiimp.resize(40, 40); | ||
// Constants should not be applied from well-formed plugins to objects | ||
// $ExpectError | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR; | ||
@@ -246,9 +247,9 @@ // $ExpectError | ||
test('can handle only plugins', () => { | ||
test("can handle only plugins", () => { | ||
const PluginsJimp = configure({ | ||
plugins: [plugins] | ||
plugins: [plugins], | ||
}); | ||
// Core functions should still work from Jimp | ||
PluginsJimp.read('Test'); | ||
PluginsJimp.read("Test"); | ||
@@ -273,4 +274,4 @@ // Constants should not be applied from ill-formed plugins | ||
const Jiimp = new PluginsJimp('test'); | ||
const Jiimp = new PluginsJimp("test"); | ||
// Core functions should still work from Jimp | ||
@@ -283,7 +284,7 @@ Jiimp.getPixelColor(1, 1); | ||
// Methods should be applied from well-formed plugins | ||
Jiimp.resize(40, 40) | ||
Jiimp.resize(40, 40); | ||
// Constants should be not applied to objects from well-formed plugins | ||
// $ExpectError | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR; | ||
@@ -295,7 +296,7 @@ // $ExpectError | ||
Jiimp.func(); | ||
}) | ||
}); | ||
test('can handle only all types', () => { | ||
test("can handle only all types", () => { | ||
const TypesJimp = configure({ | ||
types: [types] | ||
types: [types], | ||
}); | ||
@@ -316,3 +317,3 @@ | ||
const Jiimp = new TypesJimp('test'); | ||
const Jiimp = new TypesJimp("test"); | ||
// Methods from types should be applied | ||
@@ -331,5 +332,5 @@ Jiimp.filterType(4); | ||
test('can handle only one type', () => { | ||
test("can handle only one type", () => { | ||
const PngJimp = configure({ | ||
types: [png] | ||
types: [png], | ||
}); | ||
@@ -344,3 +345,3 @@ | ||
PngJimp.PNG_FILTER_NONE; | ||
// $ExpectError | ||
@@ -352,4 +353,3 @@ PngJimp.test; | ||
const Jiimp = new PngJimp('test'); | ||
const Jiimp = new PngJimp("test"); | ||
// Constants from other types should be not applied | ||
@@ -370,6 +370,5 @@ // $ExpectError | ||
test('can handle only one plugin', () => { | ||
test("can handle only one plugin", () => { | ||
const ResizeJimp = configure({ | ||
plugins: [resize] | ||
plugins: [resize], | ||
}); | ||
@@ -394,4 +393,3 @@ | ||
const Jiimp: InstanceType<typeof ResizeJimp> = new ResizeJimp('test'); | ||
const Jiimp: InstanceType<typeof ResizeJimp> = new ResizeJimp("test"); | ||
// Constants from other plugins should be not applied | ||
@@ -414,10 +412,9 @@ // $ExpectError | ||
test('Can handle appendConstructorOption', () => { | ||
test("Can handle appendConstructorOption", () => { | ||
const AppendJimp = configure({}); | ||
AppendJimp.appendConstructorOption( | ||
'Name of Option', | ||
args => args.hasSomeCustomThing, | ||
function(resolve, reject, args) { | ||
"Name of Option", | ||
(args) => args.hasSomeCustomThing, | ||
function (resolve, reject, args) { | ||
// $ExpectError | ||
@@ -424,0 +421,0 @@ this.bitmap = 3; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199
27856
10
493
+ Added@babel/runtime@7.26.0(transitive)
+ Added@jimp/core@0.16.13(transitive)
+ Added@jimp/utils@0.16.13(transitive)
- Removed@babel/runtime@7.25.9(transitive)
- Removed@jimp/core@0.16.3-canary.1125.1580.0(transitive)
- Removed@jimp/utils@0.16.3-canary.1125.1580.0(transitive)
Updated@jimp/core@^0.16.3