Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jimp/custom

Package Overview
Dependencies
Maintainers
2
Versions
219
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jimp/custom - npm Package Compare versions

Comparing version 0.8.2-canary.792.290.0 to 0.8.2-canary.792.332.0

6

package.json
{
"name": "@jimp/custom",
"version": "0.8.2-canary.792.290.0",
"version": "0.8.2-canary.792.332.0",
"description": "Interface to customize jimp configuration",

@@ -20,3 +20,3 @@ "main": "dist/index.js",

"dependencies": {
"@jimp/core": "0.8.2-canary.792.290.0",
"@jimp/core": "0.8.2-canary.792.332.0",
"core-js": "^2.5.7"

@@ -27,3 +27,3 @@ },

},
"gitHead": "9cdd4f81472c738ea7c29a55f5650cfc8bdae919"
"gitHead": "3c22c39d67bb001aae84b2165e4f1f23b3cf84f2"
}

@@ -8,42 +8,27 @@ // TypeScript Version: 3.1

JimpType,
GetIntersectionFromPlugins
GetIntersectionFromPlugins,
JimpConstructors
} from '@jimp/core';
declare function configure<
PluginFuncArr extends FunctionRet<JimpPlugin>,
JimpInstance extends Jimp = Jimp
>(
configuration: {
plugins: PluginFuncArr;
},
jimpInstance?: JimpInstance
): Exclude<JimpInstance, undefined> &
GetIntersectionFromPlugins<PluginFuncArr>;
type JimpInstance<
TypesFuncArr extends FunctionRet<JimpType> | undefined,
PluginFuncArr extends FunctionRet<JimpPlugin> | undefined,
J extends Jimp
> = Exclude<J, undefined> &
GetIntersectionFromPlugins<Exclude<TypesFuncArr | PluginFuncArr, undefined>> &
JimpConstructors;
declare function configure<
TypesFuncArr extends FunctionRet<JimpType>,
JimpInstance extends Jimp = Jimp
TypesFuncArr extends FunctionRet<JimpType> | undefined = undefined,
PluginFuncArr extends FunctionRet<JimpPlugin> | undefined = undefined,
J extends Jimp = Jimp
>(
configuration: {
types: TypesFuncArr;
},
jimpInstance?: JimpInstance
): Exclude<JimpInstance, undefined> &
GetIntersectionFromPlugins<TypesFuncArr>;
declare function configure<
TypesFuncArr extends FunctionRet<JimpType>,
PluginFuncArr extends FunctionRet<JimpPlugin>,
JimpInstance extends Jimp = Jimp
>(
configuration: {
types?: TypesFuncArr;
plugins?: PluginFuncArr;
},
jimpInstance?: JimpInstance
jimpInstance?: J
// Since JimpInstance is required, we want to use the default `Jimp` type
): Exclude<JimpInstance, undefined> &
GetIntersectionFromPlugins<TypesFuncArr> &
GetIntersectionFromPlugins<PluginFuncArr>;
): JimpInstance<TypesFuncArr, PluginFuncArr, J>;
export default configure;
export default configure;

@@ -16,26 +16,53 @@ import configure from '@jimp/custom';

// Methods from types should be applied
CustomJimp.deflateLevel(4);
// Constants from types should be applied
// $ExpectType 0
CustomJimp.PNG_FILTER_NONE;
test('can handle custom jimp', () => {
// Methods from types should be applied
CustomJimp.deflateLevel(4);
// Constants from types should be applied
// $ExpectType 0
CustomJimp.PNG_FILTER_NONE;
// Core functions should still work from Jimp
CustomJimp.read('Test');
// Constants should be applied from ill-formed plugins
CustomJimp.displace(CustomJimp, 2);
// Methods should be applied from well-formed plugins
CustomJimp.resize(40, 40)
// Constants should be applied from well-formed plugins
CustomJimp.RESIZE_NEAREST_NEIGHBOR
// $ExpectError
CustomJimp.test;
// $ExpectError
CustomJimp.func();
// Core functions should still work from Jimp
CustomJimp.read('Test');
const Jiimp = new CustomJimp('test');
// Methods from types should be applied
Jiimp.deflateLevel(4);
// Constants from types should be applied
// $ExpectType 0
Jiimp.PNG_FILTER_NONE;
// Constants should be applied from ill-formed plugins
CustomJimp.displace(CustomJimp, 2);
// Core functions should still work from Jimp
Jiimp.read('Test');
// Methods should be applied from well-formed plugins
CustomJimp.resize(40, 40)
// Constants should be applied from ill-formed plugins
Jiimp.displace(Jiimp, 2);
// Constants should be applied from well-formed plugins
CustomJimp.RESIZE_NEAREST_NEIGHBOR
// Methods should be applied from well-formed plugins
Jiimp.resize(40, 40)
// $ExpectError
CustomJimp.test;
// Constants should be applied from well-formed plugins
Jiimp.RESIZE_NEAREST_NEIGHBOR
// $ExpectError
CustomJimp.func();
// $ExpectError
Jiimp.test;
// $ExpectError
Jiimp.func();
});
test('can compose', () => {

@@ -72,2 +99,27 @@ const OtherCustomJimp = configure({

OtherCustomJimp.func();
const Jiimp = new OtherCustomJimp('test');
// Methods from types should be applied
Jiimp.deflateLevel(4);
// Constants from types should be applied
// $ExpectType 0
Jiimp.PNG_FILTER_NONE;
// Core functions should still work from Jimp
Jiimp.read('Test');
// Constants should be applied from ill-formed plugins
Jiimp.displace(Jiimp, 2);
// Methods should be applied from well-formed plugins
Jiimp.resize(40, 40)
// Constants should be applied from well-formed plugins
Jiimp.RESIZE_NEAREST_NEIGHBOR
// $ExpectError
Jiimp.test;
// $ExpectError
Jiimp.func();
});

@@ -98,2 +150,22 @@

PluginsJimp.func();
const Jiimp = new PluginsJimp('test');
// Core functions should still work from Jimp
Jiimp.read('Test');
// Constants should be applied from ill-formed plugins
Jiimp.displace(Jiimp, 2);
// Methods should be applied from well-formed plugins
Jiimp.resize(40, 40)
// Constants should be applied from well-formed plugins
Jiimp.RESIZE_NEAREST_NEIGHBOR
// $ExpectError
Jiimp.test;
// $ExpectError
Jiimp.func();
})

@@ -109,3 +181,2 @@

// Constants from types should be applied
// Commented for complexity errors
// $ExpectType 0

@@ -119,2 +190,15 @@ TypesJimp.PNG_FILTER_NONE;

TypesJimp.func();
const Jiimp = new TypesJimp('test');
// Methods from types should be applied
Jiimp.filterType(4);
// Constants from types should be applied
// $ExpectType 0
Jiimp.PNG_FILTER_NONE;
// $ExpectError
Jiimp.test;
// $ExpectError
Jiimp.func();
});

@@ -127,4 +211,7 @@

// Constants from other types should be not applied
// $ExpectError
PngJimp.MIME_TIFF;
// Constants from types should be applied
// Commented for complexity errors
// $ExpectType 0

@@ -138,2 +225,18 @@ PngJimp.PNG_FILTER_NONE;

PngJimp.func();
const Jiimp = new PngJimp('test');
// Constants from other types should be not applied
// $ExpectError
Jiimp.MIME_TIFF;
// Constants from types should be applied
// $ExpectType 0
Jiimp.PNG_FILTER_NONE;
// $ExpectError
Jiimp.test;
// $ExpectError
Jiimp.func();
});

@@ -143,18 +246,39 @@

test('can handle only one plugin', () => {
const PngJimp = configure({
const ResizeJimp = configure({
plugins: [resize]
});
// Constants from types should be applied
// Commented for complexity errors
// Constants from other plugins should be not applied
// $ExpectError
ResizeJimp.FONT_SANS_8_BLACK;
// Constants from plugin should be applied
// $ExpectType "nearestNeighbor"
PngJimp.RESIZE_NEAREST_NEIGHBOR;
ResizeJimp.RESIZE_NEAREST_NEIGHBOR;
PngJimp.resize(2, 2);
ResizeJimp.resize(2, 2);
// $ExpectError
PngJimp.test;
ResizeJimp.test;
// $ExpectError
PngJimp.func();
ResizeJimp.func();
const Jiimp: typeof ResizeJimp = new ResizeJimp('test');
// Constants from other plugins should be not applied
// $ExpectError
Jiimp.FONT_SANS_8_BLACK;
// Constants from plugin should be applied
// $ExpectType "nearestNeighbor"
Jiimp.RESIZE_NEAREST_NEIGHBOR;
Jiimp.resize(2, 2);
// $ExpectError
Jiimp.test;
// $ExpectError
Jiimp.func();
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc