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