@jimp/custom
Advanced tools
Comparing version 0.9.8 to 0.9.9-canary.867.792.0
{ | ||
"name": "@jimp/custom", | ||
"version": "0.9.8", | ||
"version": "0.9.9-canary.867.792.0", | ||
"description": "Interface to customize jimp configuration", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"@babel/runtime": "^7.7.2", | ||
"@jimp/core": "^0.9.8", | ||
"@jimp/core": "0.9.9-canary.867.792.0", | ||
"core-js": "^3.4.1" | ||
@@ -28,3 +28,3 @@ }, | ||
}, | ||
"gitHead": "3a3df33f1fcf11899075ba87811d7c3d4f9bed21" | ||
"gitHead": "e05689ace8f60a7f4d031924f06d8ccdfa5bd05b" | ||
} |
@@ -9,2 +9,3 @@ // TypeScript Version: 3.1 | ||
GetIntersectionFromPlugins, | ||
GetIntersectionFromPluginsStatics, | ||
JimpConstructors | ||
@@ -16,6 +17,6 @@ } from '@jimp/core'; | ||
PluginFuncArr extends FunctionRet<JimpPlugin> | undefined, | ||
J extends Jimp | ||
> = Exclude<J, undefined> & | ||
GetIntersectionFromPlugins<Exclude<TypesFuncArr | PluginFuncArr, undefined>> & | ||
JimpConstructors; | ||
J extends JimpConstructors | ||
> = J & GetIntersectionFromPluginsStatics<Exclude<TypesFuncArr | PluginFuncArr, undefined>> & { | ||
prototype: JimpType & GetIntersectionFromPlugins<Exclude<TypesFuncArr | PluginFuncArr, undefined>> | ||
}; | ||
@@ -25,3 +26,3 @@ declare function configure< | ||
PluginFuncArr extends FunctionRet<JimpPlugin> | undefined = undefined, | ||
J extends Jimp = Jimp | ||
J extends JimpConstructors = JimpConstructors | ||
>( | ||
@@ -28,0 +29,0 @@ configuration: { |
@@ -26,6 +26,11 @@ import configure from '@jimp/custom'; | ||
// Main Jimp export should already have all of these already applied | ||
// $ExpectError | ||
jimpInst.read('Test'); | ||
jimpInst.displace(jimpInst, 2); | ||
jimpInst.resize(40, 40); | ||
// $ExpectType 0 | ||
jimpInst.displace(jimpInst, 2); | ||
jimpInst.shadow((err, val, coords) => {}); | ||
jimpInst.fishEye({r: 12}); | ||
jimpInst.circle({radius: 12, x: 12, y: 12}); | ||
// $ExpectError | ||
jimpInst.PNG_FILTER_NONE; | ||
@@ -41,4 +46,3 @@ | ||
FullCustomJimp.read('Test'); | ||
FullCustomJimp.displace(FullCustomJimp, 2); | ||
FullCustomJimp.resize(40, 40); | ||
// $ExpectType 0 | ||
@@ -57,8 +61,8 @@ FullCustomJimp.PNG_FILTER_NONE; | ||
// $ExpectType -1 | ||
cloneBaseImage.PNG_FILTER_AUTO; | ||
// $ExpectType number | ||
cloneBaseImage._deflateLevel; | ||
test('can handle `this` returns on the core type properly', () => { | ||
// $ExpectType -1 | ||
cloneBaseImage.diff(jimpInst, jimpInst).image.PNG_FILTER_AUTO | ||
// $ExpectType number | ||
cloneBaseImage.posterize(3)._quality | ||
}); | ||
@@ -75,3 +79,3 @@ | ||
.deflateLevel(2) | ||
.PNG_FILTER_AUTO; | ||
._filterType; | ||
}); | ||
@@ -81,7 +85,8 @@ | ||
cloneBaseImage.rgba(false, (_, jimpCBIn) => { | ||
// $ExpectError | ||
jimpCBIn.read('Test'); | ||
jimpCBIn.displace(jimpInst, 2); | ||
jimpCBIn.resize(40, 40); | ||
// $ExpectType 0 | ||
jimpCBIn.PNG_FILTER_NONE; | ||
// $ExpectType number | ||
jimpCBIn._filterType; | ||
@@ -96,7 +101,25 @@ // $ExpectError | ||
}); | ||
test('Can handle callback with constructor', () => { | ||
const myBmpBuffer: Buffer = {} as any; | ||
Jimp.read(myBmpBuffer, (err, cbJimpInst) => { | ||
// $ExpectError | ||
cbJimpInst.read('Test'); | ||
cbJimpInst.displace(jimpInst, 2); | ||
cbJimpInst.resize(40, 40); | ||
// $ExpectType number | ||
cbJimpInst._filterType; | ||
// $ExpectError | ||
cbJimpInst.test; | ||
// $ExpectError | ||
cbJimpInst.func(); | ||
}); | ||
}); | ||
}); | ||
test('can handle custom jimp', () => { | ||
// Methods from types should be applied | ||
CustomJimp.deflateLevel(4); | ||
// Constants from types should be applied | ||
@@ -108,7 +131,9 @@ // $ExpectType 0 | ||
CustomJimp.read('Test'); | ||
// Constants should be applied from ill-formed plugins | ||
// Constants should not(?) be applied from ill-formed plugins | ||
// $ExpectError | ||
CustomJimp.displace(CustomJimp, 2); | ||
// Methods should be applied from well-formed plugins | ||
// Methods should be applied from well-formed plugins only to the instance | ||
// $ExpectError | ||
CustomJimp.resize(40, 40) | ||
@@ -128,8 +153,8 @@ | ||
Jiimp.deflateLevel(4); | ||
// Constants from types should be applied | ||
// $ExpectType 0 | ||
// Constants from types should be applied to the static only | ||
// $ExpectError | ||
Jiimp.PNG_FILTER_NONE; | ||
// Core functions should still work from Jimp | ||
Jiimp.read('Test'); | ||
Jiimp.getPixelColor(1, 1); | ||
@@ -142,3 +167,4 @@ // Constants should be applied from ill-formed plugins | ||
// Constants should be applied from well-formed plugins | ||
// Constants should not be applied to the object | ||
// $ExpectError | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR | ||
@@ -157,8 +183,2 @@ | ||
}, CustomJimp); | ||
// Methods from new plugins should be applied | ||
OtherCustomJimp.scale(3); | ||
// Methods from types should be applied | ||
OtherCustomJimp.filterType(4); | ||
// Constants from types should be applied | ||
@@ -171,6 +191,8 @@ // $ExpectType 0 | ||
// Constants should be applied from ill-formed plugins | ||
// Constants should not be applied to the static instance from ill-formed plugins | ||
// $ExpectError | ||
OtherCustomJimp.displace(OtherCustomJimp, 2); | ||
// Methods should be applied from well-formed plugins | ||
// Methods should not be applied to the static instance from well-formed plugins | ||
// $ExpectError | ||
OtherCustomJimp.resize(40, 40); | ||
@@ -190,8 +212,14 @@ | ||
Jiimp.deflateLevel(4); | ||
// Constants from types should be applied | ||
// $ExpectType 0 | ||
// Constants from types should not be applied to objects | ||
// $ExpectError | ||
Jiimp.PNG_FILTER_NONE; | ||
// Methods from new plugins should be applied | ||
Jiimp.scale(3); | ||
// Methods from types should be applied | ||
Jiimp.filterType(4); | ||
// Core functions should still work from Jimp | ||
Jiimp.read('Test'); | ||
Jiimp.getPixelColor(1, 1); | ||
@@ -204,3 +232,4 @@ // Constants should be applied from ill-formed plugins | ||
// Constants should be applied from well-formed plugins | ||
// Constants should not be applied from well-formed plugins to objects | ||
// $ExpectError | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR | ||
@@ -223,6 +252,8 @@ | ||
// Constants should be applied from ill-formed plugins | ||
// Constants should not be applied from ill-formed plugins | ||
// $ExpectError | ||
PluginsJimp.displace(PluginsJimp, 2); | ||
// Methods should be applied from well-formed plugins | ||
// Methods should be not be applied to from well-formed plugins to the top level | ||
// $ExpectError | ||
PluginsJimp.resize(40, 40); | ||
@@ -243,3 +274,3 @@ | ||
// Core functions should still work from Jimp | ||
Jiimp.read('Test'); | ||
Jiimp.getPixelColor(1, 1); | ||
@@ -252,3 +283,4 @@ // Constants should be applied from ill-formed plugins | ||
// Constants should be applied from well-formed plugins | ||
// Constants should be not applied to objects from well-formed plugins | ||
// $ExpectError | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR | ||
@@ -268,3 +300,4 @@ | ||
// Methods from types should be applied | ||
// Methods from types should not be applied | ||
// $ExpectError | ||
TypesJimp.filterType(4); | ||
@@ -284,4 +317,4 @@ // Constants from types should be applied | ||
Jiimp.filterType(4); | ||
// Constants from types should be applied | ||
// $ExpectType 0 | ||
// Constants from types should be not applied to objects | ||
// $ExpectError | ||
Jiimp.PNG_FILTER_NONE; | ||
@@ -321,4 +354,4 @@ | ||
// Constants from types should be applied | ||
// $ExpectType 0 | ||
// Constants from types should not be applied to objects | ||
// $ExpectError | ||
Jiimp.PNG_FILTER_NONE; | ||
@@ -347,2 +380,3 @@ | ||
// $ExpectError | ||
ResizeJimp.resize(2, 2); | ||
@@ -357,3 +391,3 @@ | ||
const Jiimp: typeof ResizeJimp = new ResizeJimp('test'); | ||
const Jiimp: InstanceType<typeof ResizeJimp> = new ResizeJimp('test'); | ||
// Constants from other plugins should be not applied | ||
@@ -363,4 +397,4 @@ // $ExpectError | ||
// Constants from plugin should be applied | ||
// $ExpectType "nearestNeighbor" | ||
// Constants from plugin should not be applied to the object | ||
// $ExpectError | ||
Jiimp.RESIZE_NEAREST_NEIGHBOR; | ||
@@ -367,0 +401,0 @@ |
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
34785
564
+ Added@jimp/core@0.9.9-canary.867.792.0(transitive)
+ Added@jimp/utils@0.9.9-canary.867.792.0(transitive)
- Removed@jimp/core@0.9.8(transitive)
- Removed@jimp/utils@0.9.8(transitive)