Add: node_modules
This commit is contained in:
21
app/node_modules/@jimp/custom/LICENSE
generated
vendored
Normal file
21
app/node_modules/@jimp/custom/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018 Oliver Moran
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
196
app/node_modules/@jimp/custom/README.md
generated
vendored
Normal file
196
app/node_modules/@jimp/custom/README.md
generated
vendored
Normal file
@@ -0,0 +1,196 @@
|
||||
<div align="center">
|
||||
<img width="200" height="200"
|
||||
src="https://s3.amazonaws.com/pix.iemoji.com/images/emoji/apple/ios-11/256/crayon.png">
|
||||
<h1>@jimp/custom</h1>
|
||||
<p>Configure jimp with types and plugins.</p>
|
||||
</div>
|
||||
|
||||
## Useful Defaults
|
||||
|
||||
The following wil configure a `jimp` instance with the same functionality as the main `jimp` package.
|
||||
|
||||
```js
|
||||
import configure from '@jimp/custom';
|
||||
// all of jimp's default types
|
||||
import types from '@jimp/types';
|
||||
// all of jimp's default types
|
||||
import plugins from '@jimp/plugins';
|
||||
|
||||
configure({
|
||||
types: [types],
|
||||
plugins: [plugins]
|
||||
});
|
||||
```
|
||||
|
||||
## Available Methods
|
||||
|
||||
### configure
|
||||
|
||||
Takes a Jimp configuration and applies it to `@jimp/core`.
|
||||
|
||||
Sample Jimp configuration:
|
||||
|
||||
```js
|
||||
import types from '@jimp/types';
|
||||
|
||||
import bmp from '@jimp/bmp';
|
||||
import jpeg from '@jimp/types';
|
||||
...
|
||||
|
||||
configure({
|
||||
types: [types]
|
||||
})
|
||||
|
||||
// or
|
||||
|
||||
configure({
|
||||
types: [bmp, jpeg, ...]
|
||||
})
|
||||
```
|
||||
|
||||
#### Extending Jimp Further
|
||||
|
||||
You can use configure to add more types and plugins to a jimp multiple times.
|
||||
|
||||
```js
|
||||
let jimp = configure({
|
||||
types: [bmp]
|
||||
});
|
||||
|
||||
jimp = configure(
|
||||
{
|
||||
types: [jpeg]
|
||||
},
|
||||
jimp
|
||||
);
|
||||
```
|
||||
|
||||
## Type Definition
|
||||
|
||||
To define a new Jimp image type write a function the takes the current Jimp configuration. In this function you can extend Jimp's internal data structures.
|
||||
|
||||
This function must return and array whose first element is the mime type and second element is an array of valid file extensions.
|
||||
|
||||
```js
|
||||
const special = require('special-js');
|
||||
|
||||
const MIME_TYPE = 'image/special';
|
||||
|
||||
export default () => ({
|
||||
mime: [MIME_TYPE, ['spec', 'special']],
|
||||
|
||||
constants: {
|
||||
MIME_SPECIAL: MIME_TYPE
|
||||
},
|
||||
|
||||
decoders: {
|
||||
[MIME_TYPE]: data => special.decode(data)
|
||||
},
|
||||
|
||||
encoders: {
|
||||
[MIME_TYPE]: image => special.encode(image.bitmap)
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### Constants
|
||||
|
||||
A jimp image type can expose as many constants as it wants. Each jimp type is required to expose a mime type.
|
||||
|
||||
```js
|
||||
constants: {
|
||||
MIME_SPECIAL: MIME_TYPE
|
||||
},
|
||||
```
|
||||
|
||||
### hasAlpha
|
||||
|
||||
A image type can define whether it supports an alpha channel.
|
||||
|
||||
```js
|
||||
hasAlpha: {
|
||||
MIME_SPECIAL: true
|
||||
},
|
||||
```
|
||||
|
||||
### Decoder
|
||||
|
||||
A function that when supplied with a buffer should return a bitmap with height and width.
|
||||
|
||||
```js
|
||||
decoders: {
|
||||
[MIME_TYPE]: data => special.decode(data)
|
||||
},
|
||||
```
|
||||
|
||||
### Encoder
|
||||
|
||||
A function that when supplied with a Jimp image should return an encoded buffer.
|
||||
|
||||
```js
|
||||
encoders: {
|
||||
[MIME_TYPE]: image => special.encode(image.bitmap)
|
||||
}
|
||||
```
|
||||
|
||||
### Class
|
||||
|
||||
Add class properties and function to the Jimp constructor.
|
||||
|
||||
```js
|
||||
class: {
|
||||
_quality: 100,
|
||||
quality: function(n, cb) {
|
||||
if (typeof n !== 'number') {
|
||||
return throwError.call(this, 'n must be a number', cb);
|
||||
}
|
||||
|
||||
if (n < 0 || n > 100) {
|
||||
return throwError.call(this, 'n must be a number 0 - 100', cb);
|
||||
}
|
||||
|
||||
this._quality = Math.round(n);
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
## Plugin Definition
|
||||
|
||||
Defining a plugin has access to all the same things in the type definition. Mainly plugins use just the `constants` and `class` config options.
|
||||
|
||||
Below is the `invert` plugin. If a plugin doesn return an object with `constants` and `class`, all keys are treated as class functions.
|
||||
|
||||
```js
|
||||
import { isNodePattern } from '@jimp/utils';
|
||||
|
||||
/**
|
||||
* Inverts the image
|
||||
* @param {function(Error, Jimp)} cb (optional) a callback for when complete
|
||||
* @returns {Jimp} this for chaining of methods
|
||||
*/
|
||||
export default () => ({
|
||||
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];
|
||||
});
|
||||
|
||||
if (isNodePattern(cb)) {
|
||||
cb.call(this, null, this);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
});
|
||||
```
|
125
app/node_modules/@jimp/custom/dist/index.js
generated
vendored
Normal file
125
app/node_modules/@jimp/custom/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,125 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = configure;
|
||||
|
||||
require("core-js/modules/es6.string.iterator");
|
||||
|
||||
require("core-js/modules/es6.array.from");
|
||||
|
||||
require("core-js/modules/es6.regexp.to-string");
|
||||
|
||||
require("core-js/modules/es6.date.to-string");
|
||||
|
||||
require("core-js/modules/es6.array.filter");
|
||||
|
||||
require("core-js/modules/es6.object.keys");
|
||||
|
||||
require("core-js/modules/es6.object.define-property");
|
||||
|
||||
require("core-js/modules/es7.symbol.async-iterator");
|
||||
|
||||
require("core-js/modules/es6.symbol");
|
||||
|
||||
require("core-js/modules/es6.array.is-array");
|
||||
|
||||
require("core-js/modules/es6.array.iterator");
|
||||
|
||||
require("core-js/modules/es7.object.entries");
|
||||
|
||||
require("core-js/modules/web.dom.iterable");
|
||||
|
||||
require("core-js/modules/es6.array.for-each");
|
||||
|
||||
var _core = _interopRequireWildcard(require("@jimp/core"));
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
||||
|
||||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
function configure(configuration) {
|
||||
var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _core.default;
|
||||
var jimpConfig = {
|
||||
hasAlpha: {},
|
||||
encoders: {},
|
||||
decoders: {},
|
||||
class: {},
|
||||
constants: {}
|
||||
};
|
||||
|
||||
function addToConfig(newConfig) {
|
||||
Object.entries(newConfig).forEach(function (_ref) {
|
||||
var _ref2 = _slicedToArray(_ref, 2),
|
||||
key = _ref2[0],
|
||||
value = _ref2[1];
|
||||
|
||||
jimpConfig[key] = _objectSpread({}, jimpConfig[key], value);
|
||||
});
|
||||
}
|
||||
|
||||
function addImageType(typeModule) {
|
||||
var type = typeModule();
|
||||
|
||||
if (Array.isArray(type.mime)) {
|
||||
_core.addType.apply(void 0, _toConsumableArray(type.mime));
|
||||
} else {
|
||||
Object.entries(type.mime).forEach(function (mimeType) {
|
||||
return _core.addType.apply(void 0, _toConsumableArray(mimeType));
|
||||
});
|
||||
}
|
||||
|
||||
delete type.mime;
|
||||
addToConfig(type);
|
||||
}
|
||||
|
||||
function addPlugin(pluginModule) {
|
||||
var plugin = pluginModule(_core.jimpEvChange) || {};
|
||||
|
||||
if (!plugin.class && !plugin.constants) {
|
||||
// Default to class function
|
||||
addToConfig({
|
||||
class: plugin
|
||||
});
|
||||
} else {
|
||||
addToConfig(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
if (configuration.types) {
|
||||
configuration.types.forEach(addImageType);
|
||||
jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, jimpConfig.decoders);
|
||||
jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, jimpConfig.encoders);
|
||||
jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, jimpConfig.hasAlpha);
|
||||
}
|
||||
|
||||
if (configuration.plugins) {
|
||||
configuration.plugins.forEach(addPlugin);
|
||||
}
|
||||
|
||||
(0, _core.addJimpMethods)(jimpConfig.class, jimpInstance);
|
||||
(0, _core.addConstants)(jimpConfig.constants, jimpInstance);
|
||||
return _core.default;
|
||||
}
|
||||
|
||||
module.exports = exports.default;
|
||||
//# sourceMappingURL=index.js.map
|
1
app/node_modules/@jimp/custom/dist/index.js.map
generated
vendored
Normal file
1
app/node_modules/@jimp/custom/dist/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["configure","configuration","jimpInstance","Jimp","jimpConfig","hasAlpha","encoders","decoders","class","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","addType","mimeType","addPlugin","pluginModule","plugin","jimpEvChange","types","plugins"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;;AAOe,SAASA,SAAT,CAAmBC,aAAnB,EAAuD;AAAA,MAArBC,YAAqB,uEAANC,aAAM;AACpE,MAAMC,UAAU,GAAG;AACjBC,IAAAA,QAAQ,EAAE,EADO;AAEjBC,IAAAA,QAAQ,EAAE,EAFO;AAGjBC,IAAAA,QAAQ,EAAE,EAHO;AAIjBC,IAAAA,KAAK,EAAE,EAJU;AAKjBC,IAAAA,SAAS,EAAE;AALM,GAAnB;;AAQA,WAASC,WAAT,CAAqBC,SAArB,EAAgC;AAC9BC,IAAAA,MAAM,CAACC,OAAP,CAAeF,SAAf,EAA0BG,OAA1B,CAAkC,gBAAkB;AAAA;AAAA,UAAhBC,GAAgB;AAAA,UAAXC,KAAW;;AAClDZ,MAAAA,UAAU,CAACW,GAAD,CAAV,qBACKX,UAAU,CAACW,GAAD,CADf,EAEKC,KAFL;AAID,KALD;AAMD;;AAED,WAASC,YAAT,CAAsBC,UAAtB,EAAkC;AAChC,QAAMC,IAAI,GAAGD,UAAU,EAAvB;;AAEA,QAAIE,KAAK,CAACC,OAAN,CAAcF,IAAI,CAACG,IAAnB,CAAJ,EAA8B;AAC5BC,qDAAWJ,IAAI,CAACG,IAAhB;AACD,KAFD,MAEO;AACLV,MAAAA,MAAM,CAACC,OAAP,CAAeM,IAAI,CAACG,IAApB,EAA0BR,OAA1B,CAAkC,UAAAU,QAAQ;AAAA,eAAID,+CAAWC,QAAX,EAAJ;AAAA,OAA1C;AACD;;AAED,WAAOL,IAAI,CAACG,IAAZ;AACAZ,IAAAA,WAAW,CAACS,IAAD,CAAX;AACD;;AAED,WAASM,SAAT,CAAmBC,YAAnB,EAAiC;AAC/B,QAAMC,MAAM,GAAGD,YAAY,CAACE,kBAAD,CAAZ,IAA8B,EAA7C;;AACA,QAAI,CAACD,MAAM,CAACnB,KAAR,IAAiB,CAACmB,MAAM,CAAClB,SAA7B,EAAwC;AACtC;AACAC,MAAAA,WAAW,CAAC;AAAEF,QAAAA,KAAK,EAAEmB;AAAT,OAAD,CAAX;AACD,KAHD,MAGO;AACLjB,MAAAA,WAAW,CAACiB,MAAD,CAAX;AACD;AACF;;AAED,MAAI1B,aAAa,CAAC4B,KAAlB,EAAyB;AACvB5B,IAAAA,aAAa,CAAC4B,KAAd,CAAoBf,OAApB,CAA4BG,YAA5B;AAEAf,IAAAA,YAAY,CAACK,QAAb,qBACKL,YAAY,CAACK,QADlB,EAEKH,UAAU,CAACG,QAFhB;AAIAL,IAAAA,YAAY,CAACI,QAAb,qBACKJ,YAAY,CAACI,QADlB,EAEKF,UAAU,CAACE,QAFhB;AAIAJ,IAAAA,YAAY,CAACG,QAAb,qBACKH,YAAY,CAACG,QADlB,EAEKD,UAAU,CAACC,QAFhB;AAID;;AAED,MAAIJ,aAAa,CAAC6B,OAAlB,EAA2B;AACzB7B,IAAAA,aAAa,CAAC6B,OAAd,CAAsBhB,OAAtB,CAA8BW,SAA9B;AACD;;AAED,4BAAerB,UAAU,CAACI,KAA1B,EAAiCN,YAAjC;AACA,0BAAaE,UAAU,CAACK,SAAxB,EAAmCP,YAAnC;AAEA,SAAOC,aAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange\n} from '@jimp/core';\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"}
|
85
app/node_modules/@jimp/custom/es/index.js
generated
vendored
Normal file
85
app/node_modules/@jimp/custom/es/index.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
||||
|
||||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
||||
|
||||
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
||||
|
||||
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
||||
|
||||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
|
||||
|
||||
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
|
||||
|
||||
function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
||||
|
||||
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
||||
|
||||
import Jimp, { addType, addJimpMethods, addConstants, jimpEvChange } from '@jimp/core';
|
||||
export default function configure(configuration) {
|
||||
var jimpInstance = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Jimp;
|
||||
var jimpConfig = {
|
||||
hasAlpha: {},
|
||||
encoders: {},
|
||||
decoders: {},
|
||||
class: {},
|
||||
constants: {}
|
||||
};
|
||||
|
||||
function addToConfig(newConfig) {
|
||||
Object.entries(newConfig).forEach(function (_ref) {
|
||||
var _ref2 = _slicedToArray(_ref, 2),
|
||||
key = _ref2[0],
|
||||
value = _ref2[1];
|
||||
|
||||
jimpConfig[key] = _objectSpread({}, jimpConfig[key], value);
|
||||
});
|
||||
}
|
||||
|
||||
function addImageType(typeModule) {
|
||||
var type = typeModule();
|
||||
|
||||
if (Array.isArray(type.mime)) {
|
||||
addType.apply(void 0, _toConsumableArray(type.mime));
|
||||
} else {
|
||||
Object.entries(type.mime).forEach(function (mimeType) {
|
||||
return addType.apply(void 0, _toConsumableArray(mimeType));
|
||||
});
|
||||
}
|
||||
|
||||
delete type.mime;
|
||||
addToConfig(type);
|
||||
}
|
||||
|
||||
function addPlugin(pluginModule) {
|
||||
var plugin = pluginModule(jimpEvChange) || {};
|
||||
|
||||
if (!plugin.class && !plugin.constants) {
|
||||
// Default to class function
|
||||
addToConfig({
|
||||
class: plugin
|
||||
});
|
||||
} else {
|
||||
addToConfig(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
if (configuration.types) {
|
||||
configuration.types.forEach(addImageType);
|
||||
jimpInstance.decoders = _objectSpread({}, jimpInstance.decoders, jimpConfig.decoders);
|
||||
jimpInstance.encoders = _objectSpread({}, jimpInstance.encoders, jimpConfig.encoders);
|
||||
jimpInstance.hasAlpha = _objectSpread({}, jimpInstance.hasAlpha, jimpConfig.hasAlpha);
|
||||
}
|
||||
|
||||
if (configuration.plugins) {
|
||||
configuration.plugins.forEach(addPlugin);
|
||||
}
|
||||
|
||||
addJimpMethods(jimpConfig.class, jimpInstance);
|
||||
addConstants(jimpConfig.constants, jimpInstance);
|
||||
return Jimp;
|
||||
}
|
||||
//# sourceMappingURL=index.js.map
|
1
app/node_modules/@jimp/custom/es/index.js.map
generated
vendored
Normal file
1
app/node_modules/@jimp/custom/es/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":["Jimp","addType","addJimpMethods","addConstants","jimpEvChange","configure","configuration","jimpInstance","jimpConfig","hasAlpha","encoders","decoders","class","constants","addToConfig","newConfig","Object","entries","forEach","key","value","addImageType","typeModule","type","Array","isArray","mime","mimeType","addPlugin","pluginModule","plugin","types","plugins"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAOA,IAAP,IACEC,OADF,EAEEC,cAFF,EAGEC,YAHF,EAIEC,YAJF,QAKO,YALP;AAOA,eAAe,SAASC,SAAT,CAAmBC,aAAnB,EAAuD;AAAA,MAArBC,YAAqB,uEAANP,IAAM;AACpE,MAAMQ,UAAU,GAAG;AACjBC,IAAAA,QAAQ,EAAE,EADO;AAEjBC,IAAAA,QAAQ,EAAE,EAFO;AAGjBC,IAAAA,QAAQ,EAAE,EAHO;AAIjBC,IAAAA,KAAK,EAAE,EAJU;AAKjBC,IAAAA,SAAS,EAAE;AALM,GAAnB;;AAQA,WAASC,WAAT,CAAqBC,SAArB,EAAgC;AAC9BC,IAAAA,MAAM,CAACC,OAAP,CAAeF,SAAf,EAA0BG,OAA1B,CAAkC,gBAAkB;AAAA;AAAA,UAAhBC,GAAgB;AAAA,UAAXC,KAAW;;AAClDZ,MAAAA,UAAU,CAACW,GAAD,CAAV,qBACKX,UAAU,CAACW,GAAD,CADf,EAEKC,KAFL;AAID,KALD;AAMD;;AAED,WAASC,YAAT,CAAsBC,UAAtB,EAAkC;AAChC,QAAMC,IAAI,GAAGD,UAAU,EAAvB;;AAEA,QAAIE,KAAK,CAACC,OAAN,CAAcF,IAAI,CAACG,IAAnB,CAAJ,EAA8B;AAC5BzB,MAAAA,OAAO,MAAP,4BAAWsB,IAAI,CAACG,IAAhB;AACD,KAFD,MAEO;AACLV,MAAAA,MAAM,CAACC,OAAP,CAAeM,IAAI,CAACG,IAApB,EAA0BR,OAA1B,CAAkC,UAAAS,QAAQ;AAAA,eAAI1B,OAAO,MAAP,4BAAW0B,QAAX,EAAJ;AAAA,OAA1C;AACD;;AAED,WAAOJ,IAAI,CAACG,IAAZ;AACAZ,IAAAA,WAAW,CAACS,IAAD,CAAX;AACD;;AAED,WAASK,SAAT,CAAmBC,YAAnB,EAAiC;AAC/B,QAAMC,MAAM,GAAGD,YAAY,CAACzB,YAAD,CAAZ,IAA8B,EAA7C;;AACA,QAAI,CAAC0B,MAAM,CAAClB,KAAR,IAAiB,CAACkB,MAAM,CAACjB,SAA7B,EAAwC;AACtC;AACAC,MAAAA,WAAW,CAAC;AAAEF,QAAAA,KAAK,EAAEkB;AAAT,OAAD,CAAX;AACD,KAHD,MAGO;AACLhB,MAAAA,WAAW,CAACgB,MAAD,CAAX;AACD;AACF;;AAED,MAAIxB,aAAa,CAACyB,KAAlB,EAAyB;AACvBzB,IAAAA,aAAa,CAACyB,KAAd,CAAoBb,OAApB,CAA4BG,YAA5B;AAEAd,IAAAA,YAAY,CAACI,QAAb,qBACKJ,YAAY,CAACI,QADlB,EAEKH,UAAU,CAACG,QAFhB;AAIAJ,IAAAA,YAAY,CAACG,QAAb,qBACKH,YAAY,CAACG,QADlB,EAEKF,UAAU,CAACE,QAFhB;AAIAH,IAAAA,YAAY,CAACE,QAAb,qBACKF,YAAY,CAACE,QADlB,EAEKD,UAAU,CAACC,QAFhB;AAID;;AAED,MAAIH,aAAa,CAAC0B,OAAlB,EAA2B;AACzB1B,IAAAA,aAAa,CAAC0B,OAAd,CAAsBd,OAAtB,CAA8BU,SAA9B;AACD;;AAED1B,EAAAA,cAAc,CAACM,UAAU,CAACI,KAAZ,EAAmBL,YAAnB,CAAd;AACAJ,EAAAA,YAAY,CAACK,UAAU,CAACK,SAAZ,EAAuBN,YAAvB,CAAZ;AAEA,SAAOP,IAAP;AACD","sourcesContent":["import Jimp, {\n addType,\n addJimpMethods,\n addConstants,\n jimpEvChange\n} from '@jimp/core';\n\nexport default function configure(configuration, jimpInstance = Jimp) {\n const jimpConfig = {\n hasAlpha: {},\n encoders: {},\n decoders: {},\n class: {},\n constants: {}\n };\n\n function addToConfig(newConfig) {\n Object.entries(newConfig).forEach(([key, value]) => {\n jimpConfig[key] = {\n ...jimpConfig[key],\n ...value\n };\n });\n }\n\n function addImageType(typeModule) {\n const type = typeModule();\n\n if (Array.isArray(type.mime)) {\n addType(...type.mime);\n } else {\n Object.entries(type.mime).forEach(mimeType => addType(...mimeType));\n }\n\n delete type.mime;\n addToConfig(type);\n }\n\n function addPlugin(pluginModule) {\n const plugin = pluginModule(jimpEvChange) || {};\n if (!plugin.class && !plugin.constants) {\n // Default to class function\n addToConfig({ class: plugin });\n } else {\n addToConfig(plugin);\n }\n }\n\n if (configuration.types) {\n configuration.types.forEach(addImageType);\n\n jimpInstance.decoders = {\n ...jimpInstance.decoders,\n ...jimpConfig.decoders\n };\n jimpInstance.encoders = {\n ...jimpInstance.encoders,\n ...jimpConfig.encoders\n };\n jimpInstance.hasAlpha = {\n ...jimpInstance.hasAlpha,\n ...jimpConfig.hasAlpha\n };\n }\n\n if (configuration.plugins) {\n configuration.plugins.forEach(addPlugin);\n }\n\n addJimpMethods(jimpConfig.class, jimpInstance);\n addConstants(jimpConfig.constants, jimpInstance);\n\n return Jimp;\n}\n"],"file":"index.js"}
|
55
app/node_modules/@jimp/custom/package.json
generated
vendored
Normal file
55
app/node_modules/@jimp/custom/package.json
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@jimp/custom@0.6.4",
|
||||
"C:\\Users\\ryuki\\TheDesk\\app"
|
||||
]
|
||||
],
|
||||
"_from": "@jimp/custom@0.6.4",
|
||||
"_id": "@jimp/custom@0.6.4",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-sdBHrBoVr1+PFx4dlUAgXvvu4dG0esQobhg7qhpSLRje1ScavIgE2iXdJKpycgzrqwAOL8vW4/E5w2/rONlaoQ==",
|
||||
"_location": "/@jimp/custom",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@jimp/custom@0.6.4",
|
||||
"name": "@jimp/custom",
|
||||
"escapedName": "@jimp%2fcustom",
|
||||
"scope": "@jimp",
|
||||
"rawSpec": "0.6.4",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.6.4"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/jimp"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@jimp/custom/-/custom-0.6.4.tgz",
|
||||
"_spec": "0.6.4",
|
||||
"_where": "C:\\Users\\ryuki\\TheDesk\\app",
|
||||
"author": "",
|
||||
"dependencies": {
|
||||
"@jimp/core": "^0.6.4",
|
||||
"core-js": "^2.5.7"
|
||||
},
|
||||
"description": "Interface to customize jimp configuration",
|
||||
"gitHead": "7c9d3c817cade88d4a20422be10670d3c1528429",
|
||||
"license": "MIT",
|
||||
"main": "dist/index.js",
|
||||
"module": "es/index.js",
|
||||
"name": "@jimp/custom",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:node:production && npm run build:module",
|
||||
"build:debug": "npm run build:node:debug",
|
||||
"build:module": "cross-env BABEL_ENV=module babel src -d es --source-maps --config-file ../../babel.config.js",
|
||||
"build:node": "babel src -d dist --source-maps --config-file ../../babel.config.js",
|
||||
"build:node:debug": "cross-env BABEL_ENV=development npm run build:node",
|
||||
"build:node:production": "cross-env BABEL_ENV=production npm run build:node",
|
||||
"build:watch": "npm run build:node:debug -- -- --watch --verbose"
|
||||
},
|
||||
"version": "0.6.4"
|
||||
}
|
74
app/node_modules/@jimp/custom/src/index.js
generated
vendored
Normal file
74
app/node_modules/@jimp/custom/src/index.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
import Jimp, {
|
||||
addType,
|
||||
addJimpMethods,
|
||||
addConstants,
|
||||
jimpEvChange
|
||||
} from '@jimp/core';
|
||||
|
||||
export default function configure(configuration, jimpInstance = Jimp) {
|
||||
const jimpConfig = {
|
||||
hasAlpha: {},
|
||||
encoders: {},
|
||||
decoders: {},
|
||||
class: {},
|
||||
constants: {}
|
||||
};
|
||||
|
||||
function addToConfig(newConfig) {
|
||||
Object.entries(newConfig).forEach(([key, value]) => {
|
||||
jimpConfig[key] = {
|
||||
...jimpConfig[key],
|
||||
...value
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function addImageType(typeModule) {
|
||||
const type = typeModule();
|
||||
|
||||
if (Array.isArray(type.mime)) {
|
||||
addType(...type.mime);
|
||||
} else {
|
||||
Object.entries(type.mime).forEach(mimeType => addType(...mimeType));
|
||||
}
|
||||
|
||||
delete type.mime;
|
||||
addToConfig(type);
|
||||
}
|
||||
|
||||
function addPlugin(pluginModule) {
|
||||
const plugin = pluginModule(jimpEvChange) || {};
|
||||
if (!plugin.class && !plugin.constants) {
|
||||
// Default to class function
|
||||
addToConfig({ class: plugin });
|
||||
} else {
|
||||
addToConfig(plugin);
|
||||
}
|
||||
}
|
||||
|
||||
if (configuration.types) {
|
||||
configuration.types.forEach(addImageType);
|
||||
|
||||
jimpInstance.decoders = {
|
||||
...jimpInstance.decoders,
|
||||
...jimpConfig.decoders
|
||||
};
|
||||
jimpInstance.encoders = {
|
||||
...jimpInstance.encoders,
|
||||
...jimpConfig.encoders
|
||||
};
|
||||
jimpInstance.hasAlpha = {
|
||||
...jimpInstance.hasAlpha,
|
||||
...jimpConfig.hasAlpha
|
||||
};
|
||||
}
|
||||
|
||||
if (configuration.plugins) {
|
||||
configuration.plugins.forEach(addPlugin);
|
||||
}
|
||||
|
||||
addJimpMethods(jimpConfig.class, jimpInstance);
|
||||
addConstants(jimpConfig.constants, jimpInstance);
|
||||
|
||||
return Jimp;
|
||||
}
|
Reference in New Issue
Block a user