Use native browser APIs in sticker-creator
This commit is contained in:
parent
9582f7508a
commit
633f5094c3
8 changed files with 80 additions and 359 deletions
|
@ -2847,200 +2847,6 @@ Signal Desktop makes use of the following open source projects.
|
|||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
## sharp
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction, and
|
||||
distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by the copyright
|
||||
owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all other entities
|
||||
that control, are controlled by, or are under common control with that entity.
|
||||
For the purposes of this definition, "control" means (i) the power, direct or
|
||||
indirect, to cause the direction or management of such entity, whether by
|
||||
contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity exercising
|
||||
permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications, including
|
||||
but not limited to software source code, documentation source, and configuration
|
||||
files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical transformation or
|
||||
translation of a Source form, including but not limited to compiled object code,
|
||||
generated documentation, and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or Object form, made
|
||||
available under the License, as indicated by a copyright notice that is included
|
||||
in or attached to the work (an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object form, that
|
||||
is based on (or derived from) the Work and for which the editorial revisions,
|
||||
annotations, elaborations, or other modifications represent, as a whole, an
|
||||
original work of authorship. For the purposes of this License, Derivative Works
|
||||
shall not include works that remain separable from, or merely link (or bind by
|
||||
name) to the interfaces of, the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including the original version
|
||||
of the Work and any modifications or additions to that Work or Derivative Works
|
||||
thereof, that is intentionally submitted to Licensor for inclusion in the Work
|
||||
by the copyright owner or by an individual or Legal Entity authorized to submit
|
||||
on behalf of the copyright owner. For the purposes of this definition,
|
||||
"submitted" means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems, and
|
||||
issue tracking systems that are managed by, or on behalf of, the Licensor for
|
||||
the purpose of discussing and improving the Work, but excluding communication
|
||||
that is conspicuously marked or otherwise designated in writing by the copyright
|
||||
owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
|
||||
of whom a Contribution has been received by Licensor and subsequently
|
||||
incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the Work and such
|
||||
Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License.
|
||||
|
||||
Subject to the terms and conditions of this License, each Contributor hereby
|
||||
grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
|
||||
irrevocable (except as stated in this section) patent license to make, have
|
||||
made, use, offer to sell, sell, import, and otherwise transfer the Work, where
|
||||
such license applies only to those patent claims licensable by such Contributor
|
||||
that are necessarily infringed by their Contribution(s) alone or by combination
|
||||
of their Contribution(s) with the Work to which such Contribution(s) was
|
||||
submitted. If You institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work or a
|
||||
Contribution incorporated within the Work constitutes direct or contributory
|
||||
patent infringement, then any patent licenses granted to You under this License
|
||||
for that Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution.
|
||||
|
||||
You may reproduce and distribute copies of the Work or Derivative Works thereof
|
||||
in any medium, with or without modifications, and in Source or Object form,
|
||||
provided that You meet the following conditions:
|
||||
|
||||
You must give any other recipients of the Work or Derivative Works a copy of
|
||||
this License; and
|
||||
You must cause any modified files to carry prominent notices stating that You
|
||||
changed the files; and
|
||||
You must retain, in the Source form of any Derivative Works that You distribute,
|
||||
all copyright, patent, trademark, and attribution notices from the Source form
|
||||
of the Work, excluding those notices that do not pertain to any part of the
|
||||
Derivative Works; and
|
||||
If the Work includes a "NOTICE" text file as part of its distribution, then any
|
||||
Derivative Works that You distribute must include a readable copy of the
|
||||
attribution notices contained within such NOTICE file, excluding those notices
|
||||
that do not pertain to any part of the Derivative Works, in at least one of the
|
||||
following places: within a NOTICE text file distributed as part of the
|
||||
Derivative Works; within the Source form or documentation, if provided along
|
||||
with the Derivative Works; or, within a display generated by the Derivative
|
||||
Works, if and wherever such third-party notices normally appear. The contents of
|
||||
the NOTICE file are for informational purposes only and do not modify the
|
||||
License. You may add Your own attribution notices within Derivative Works that
|
||||
You distribute, alongside or as an addendum to the NOTICE text from the Work,
|
||||
provided that such additional attribution notices cannot be construed as
|
||||
modifying the License.
|
||||
You may add Your own copyright statement to Your modifications and may provide
|
||||
additional or different license terms and conditions for use, reproduction, or
|
||||
distribution of Your modifications, or for any such Derivative Works as a whole,
|
||||
provided Your use, reproduction, and distribution of the Work otherwise complies
|
||||
with the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions.
|
||||
|
||||
Unless You explicitly state otherwise, any Contribution intentionally submitted
|
||||
for inclusion in the Work by You to the Licensor shall be under the terms and
|
||||
conditions of this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify the terms of
|
||||
any separate license agreement you may have executed with Licensor regarding
|
||||
such Contributions.
|
||||
|
||||
6. Trademarks.
|
||||
|
||||
This License does not grant permission to use the trade names, trademarks,
|
||||
service marks, or product names of the Licensor, except as required for
|
||||
reasonable and customary use in describing the origin of the Work and
|
||||
reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty.
|
||||
|
||||
Unless required by applicable law or agreed to in writing, Licensor provides the
|
||||
Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
||||
including, without limitation, any warranties or conditions of TITLE,
|
||||
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
|
||||
solely responsible for determining the appropriateness of using or
|
||||
redistributing the Work and assume any risks associated with Your exercise of
|
||||
permissions under this License.
|
||||
|
||||
8. Limitation of Liability.
|
||||
|
||||
In no event and under no legal theory, whether in tort (including negligence),
|
||||
contract, or otherwise, unless required by applicable law (such as deliberate
|
||||
and grossly negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special, incidental,
|
||||
or consequential damages of any character arising as a result of this License or
|
||||
out of the use or inability to use the Work (including but not limited to
|
||||
damages for loss of goodwill, work stoppage, computer failure or malfunction, or
|
||||
any and all other commercial damages or losses), even if such Contributor has
|
||||
been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability.
|
||||
|
||||
While redistributing the Work or Derivative Works thereof, You may choose to
|
||||
offer, and charge a fee for, acceptance of support, warranty, indemnity, or
|
||||
other liability obligations and/or rights consistent with this License. However,
|
||||
in accepting such obligations, You may act only on Your own behalf and on Your
|
||||
sole responsibility, not on behalf of any other Contributor, and only if You
|
||||
agree to indemnify, defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason of your
|
||||
accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work
|
||||
|
||||
To apply the Apache License to your work, attach the following boilerplate
|
||||
notice, with the fields enclosed by brackets "[]" replaced with your own
|
||||
identifying information. (Don't include the brackets!) The text should be
|
||||
enclosed in the appropriate comment syntax for the file format. We also
|
||||
recommend that a file or class name and description of purpose be included on
|
||||
the same "printed page" as the copyright notice for easier identification within
|
||||
third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
## split2
|
||||
|
||||
Copyright (c) 2014-2018, Matteo Collina <hello@matteocollina.com>
|
||||
|
|
19
package.json
19
package.json
|
@ -174,7 +174,6 @@
|
|||
"ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#9a9d9fbc1ca43e7a0707a960ce9642dbf82dc64a",
|
||||
"sanitize.css": "11.0.0",
|
||||
"semver": "5.4.1",
|
||||
"sharp": "0.30.5",
|
||||
"split2": "4.0.0",
|
||||
"testcheck": "1.0.0-rc.2",
|
||||
"typeface-inter": "3.18.1",
|
||||
|
@ -249,7 +248,6 @@
|
|||
"@types/redux-logger": "3.0.7",
|
||||
"@types/rimraf": "2.0.2",
|
||||
"@types/semver": "5.5.0",
|
||||
"@types/sharp": "0.29.4",
|
||||
"@types/sinon": "10.0.2",
|
||||
"@types/split2": "3.2.1",
|
||||
"@types/terser-webpack-plugin": "5.0.3",
|
||||
|
@ -318,8 +316,7 @@
|
|||
"fabric/canvas": "https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz",
|
||||
"fabric/jsdom": "https://registry.yarnpkg.com/nop/-/nop-1.0.0.tgz",
|
||||
"fast-glob/glob-parent": "5.1.2",
|
||||
"read-last-lines/mz/thenify-all/thenify": "3.3.1",
|
||||
"sharp/color/color-string": "1.9.0"
|
||||
"read-last-lines/mz/thenify-all/thenify": "3.3.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "16.16.0"
|
||||
|
@ -340,7 +337,7 @@
|
|||
}
|
||||
],
|
||||
"mergeASARs": true,
|
||||
"singleArchFiles": "node_modules/{@signalapp/libsignal-client/prebuilds/**,ringrtc/build/**,sharp/**}",
|
||||
"singleArchFiles": "node_modules/{@signalapp/libsignal-client/prebuilds/**,ringrtc/build/**}",
|
||||
"target": [
|
||||
{
|
||||
"target": "zip",
|
||||
|
@ -408,7 +405,6 @@
|
|||
"signalcaptcha"
|
||||
]
|
||||
},
|
||||
"beforeBuild": "scripts/install-cross-deps.js",
|
||||
"afterPack": "ts/scripts/after-pack.js",
|
||||
"afterSign": "ts/scripts/after-sign.js",
|
||||
"afterAllArtifactBuild": "ts/scripts/after-all-artifact-build.js",
|
||||
|
@ -416,9 +412,7 @@
|
|||
"smartUnpack": false
|
||||
},
|
||||
"asarUnpack": [
|
||||
"**/*.node",
|
||||
"node_modules/sharp/{build,vendor}/**",
|
||||
"!node_modules/sharp/**/*.{js,json}"
|
||||
"**/*.node"
|
||||
],
|
||||
"files": [
|
||||
"package.json",
|
||||
|
@ -473,13 +467,6 @@
|
|||
"node_modules/socks/build/common/*.js",
|
||||
"node_modules/socks/build/client/*.js",
|
||||
"node_modules/smart-buffer/build/*.js",
|
||||
"node_modules/sharp/build/**/*${arch}*.node",
|
||||
"node_modules/sharp/build/**/*.dll",
|
||||
"!node_modules/sharp/{install,src,vendor}",
|
||||
"!node_modules/sharp/vendor",
|
||||
"node_modules/sharp/vendor/*/*${arch}*/**",
|
||||
"!node_modules/sharp/vendor/*/*${arch}*/**/include/**",
|
||||
"!node_modules/sharp/vendor/*/*win32*/**/*.{dll,lib}",
|
||||
"!node_modules/better-sqlite3/deps/*",
|
||||
"!node_modules/better-sqlite3/src/*",
|
||||
"node_modules/better-sqlite3/build/Release/better_sqlite3.node",
|
||||
|
|
|
@ -38,7 +38,6 @@ const bundleDefaults = {
|
|||
'mac-screen-capture-permissions',
|
||||
'ringrtc',
|
||||
'sass',
|
||||
'sharp',
|
||||
'websocket',
|
||||
|
||||
// Things that don't bundle well
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
// Copyright 2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
const path = require('path');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
exports.beforeBuild = async () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
return true;
|
||||
}
|
||||
|
||||
const nonNativeArchs = ['arm64', 'x64'].filter(arch => arch !== process.arch);
|
||||
|
||||
for (const arch of nonNativeArchs) {
|
||||
console.log("Installing sharp's dependencies for", arch);
|
||||
execSync('yarn run install', {
|
||||
cwd: path.join(__dirname, '..', 'node_modules', 'sharp'),
|
||||
env: {
|
||||
...process.env,
|
||||
npm_config_arch: arch,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
// Let electron-builder handle dependencies
|
||||
return true;
|
||||
};
|
|
@ -8,16 +8,7 @@ import type { Draft } from 'redux-ts-utils';
|
|||
import { createAction, handleAction, reduceReducers } from 'redux-ts-utils';
|
||||
import { useDispatch, useSelector } from 'react-redux';
|
||||
import { createSelector } from 'reselect';
|
||||
import {
|
||||
clamp,
|
||||
find,
|
||||
isNumber,
|
||||
isString,
|
||||
pull,
|
||||
remove,
|
||||
take,
|
||||
uniq,
|
||||
} from 'lodash';
|
||||
import { clamp, find, isString, pull, remove, take, uniq } from 'lodash';
|
||||
import type { SortEnd } from 'react-sortable-hoc';
|
||||
import { bindActionCreators } from 'redux';
|
||||
import arrayMove from 'array-move';
|
||||
|
@ -136,11 +127,7 @@ export const reducer = reduceReducers<State>(
|
|||
}),
|
||||
|
||||
handleAction(addImageData, (state, { payload }) => {
|
||||
if (isNumber(payload.meta.pages)) {
|
||||
state.toasts.push({ key: 'StickerCreator--Toasts--animated' });
|
||||
pull(state.order, payload.path);
|
||||
delete state.data[payload.path];
|
||||
} else if (payload.buffer.byteLength > maxByteSize) {
|
||||
if (payload.buffer.byteLength > maxByteSize) {
|
||||
state.toasts.push({ key: 'StickerCreator--Toasts--tooLarge' });
|
||||
pull(state.order, payload.path);
|
||||
delete state.data[payload.path];
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
// Copyright 2019-2021 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { Metadata } from 'sharp';
|
||||
import type { ProcessStickerImageErrorType } from '../window/phase3-sticker-functions';
|
||||
import type {
|
||||
ProcessStickerImageErrorType,
|
||||
StickerImageData,
|
||||
} from '../window/phase3-sticker-functions';
|
||||
|
||||
declare global {
|
||||
// We want to extend `window`'s properties, so we need an interface.
|
||||
|
@ -14,12 +16,7 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
export type StickerImageData = {
|
||||
buffer: Buffer;
|
||||
src: string;
|
||||
path: string;
|
||||
meta: Metadata;
|
||||
};
|
||||
export { StickerImageData };
|
||||
|
||||
type ProcessStickerImageFn = (
|
||||
path: string | undefined
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import sharp from 'sharp';
|
||||
import pify from 'pify';
|
||||
import { readFile } from 'fs';
|
||||
import { readFile } from 'fs/promises';
|
||||
import { noop, uniqBy } from 'lodash';
|
||||
import { ipcRenderer as ipc } from 'electron';
|
||||
|
||||
|
@ -18,6 +16,7 @@ import { initialize as initializeWebAPI } from '../../ts/textsecure/WebAPI';
|
|||
|
||||
import { SignalContext } from '../../ts/windows/context';
|
||||
import { getAnimatedPngDataIfExists } from '../../ts/util/getAnimatedPngDataIfExists';
|
||||
import { explodePromise } from '../../ts/util/explodePromise';
|
||||
|
||||
class ProcessStickerImageError extends Error {
|
||||
constructor(message: string, public readonly errorMessageI18nKey: string) {
|
||||
|
@ -50,16 +49,44 @@ const WebAPI = initializeWebAPI({
|
|||
version: config.version,
|
||||
});
|
||||
|
||||
window.processStickerImage = async (path: string | undefined) => {
|
||||
export type StickerImageData = Readonly<{
|
||||
buffer: Buffer;
|
||||
src: string;
|
||||
path: string;
|
||||
}>;
|
||||
|
||||
async function loadImage(data: Buffer): Promise<HTMLImageElement> {
|
||||
const image = new Image();
|
||||
|
||||
const { promise, resolve, reject } = explodePromise<void>();
|
||||
|
||||
image.addEventListener('load', () => resolve());
|
||||
image.addEventListener('error', () => reject(new Error('Bad image')));
|
||||
image.src = `data:image/jpeg;base64,${data.toString('base64')}`;
|
||||
|
||||
await promise;
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
declare global {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
interface OffscreenCanvas {
|
||||
convertToBlob(options: { type: string; quality: number }): Promise<Blob>;
|
||||
}
|
||||
}
|
||||
|
||||
window.processStickerImage = async function processStickerImage(
|
||||
path?: string
|
||||
): Promise<StickerImageData> {
|
||||
if (!path) {
|
||||
throw new Error(`Path ${path} is not valid!`);
|
||||
}
|
||||
|
||||
const imgBuffer = await pify(readFile)(path);
|
||||
const sharpImg = sharp(imgBuffer);
|
||||
const meta = await sharpImg.metadata();
|
||||
const imgBuffer = await readFile(path);
|
||||
|
||||
const { width, height } = meta;
|
||||
const image = await loadImage(imgBuffer);
|
||||
const { naturalWidth: width, naturalHeight: height } = image;
|
||||
if (!width || !height) {
|
||||
throw new ProcessStickerImageError(
|
||||
'Sticker height or width were falsy',
|
||||
|
@ -70,10 +97,9 @@ window.processStickerImage = async (path: string | undefined) => {
|
|||
let contentType;
|
||||
let processedBuffer;
|
||||
|
||||
// [Sharp doesn't support APNG][0], so we do something simpler: validate the file size
|
||||
// For APNG we do something simpler: validate the file size
|
||||
// and dimensions without resizing, cropping, or converting. In a perfect world, we'd
|
||||
// resize and convert any animated image (GIF, animated WebP) to APNG.
|
||||
// [0]: https://github.com/lovell/sharp/issues/2375
|
||||
const animatedPngDataIfExists = getAnimatedPngDataIfExists(imgBuffer);
|
||||
if (animatedPngDataIfExists) {
|
||||
if (imgBuffer.byteLength > MAX_STICKER_BYTE_LENGTH) {
|
||||
|
@ -109,17 +135,38 @@ window.processStickerImage = async (path: string | undefined) => {
|
|||
contentType = 'image/png';
|
||||
processedBuffer = imgBuffer;
|
||||
} else {
|
||||
contentType = 'image/webp';
|
||||
processedBuffer = await sharpImg
|
||||
.resize({
|
||||
width: STICKER_SIZE,
|
||||
height: STICKER_SIZE,
|
||||
fit: 'contain',
|
||||
background: { r: 0, g: 0, b: 0, alpha: 0 },
|
||||
})
|
||||
.webp()
|
||||
.toBuffer();
|
||||
if (processedBuffer.byteLength > MAX_STICKER_BYTE_LENGTH) {
|
||||
const canvas = new OffscreenCanvas(STICKER_SIZE, STICKER_SIZE);
|
||||
const context = canvas.getContext('2d');
|
||||
if (!context) {
|
||||
throw new Error('Failed to get 2d context of canvas');
|
||||
}
|
||||
|
||||
const scaleFactor = STICKER_SIZE / Math.max(width, height);
|
||||
const newWidth = width * scaleFactor;
|
||||
const newHeight = height * scaleFactor;
|
||||
const dx = (STICKER_SIZE - newWidth) / 2;
|
||||
const dy = (STICKER_SIZE - newHeight) / 2;
|
||||
|
||||
(context as OffscreenCanvasRenderingContext2D).drawImage(
|
||||
image,
|
||||
dx,
|
||||
dy,
|
||||
newWidth,
|
||||
newHeight
|
||||
);
|
||||
|
||||
const blob = await canvas.convertToBlob({
|
||||
type: 'image/webp',
|
||||
quality: 0.8,
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
processedBuffer = Buffer.from(await blob.arrayBuffer());
|
||||
|
||||
if (
|
||||
!processedBuffer ||
|
||||
processedBuffer.byteLength > MAX_STICKER_BYTE_LENGTH
|
||||
) {
|
||||
throw new ProcessStickerImageError(
|
||||
'Sticker file was too large',
|
||||
'StickerCreator--Toasts--tooLarge'
|
||||
|
@ -131,7 +178,6 @@ window.processStickerImage = async (path: string | undefined) => {
|
|||
path,
|
||||
buffer: processedBuffer,
|
||||
src: `data:${contentType};base64,${processedBuffer.toString('base64')}`,
|
||||
meta,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
78
yarn.lock
78
yarn.lock
|
@ -3761,13 +3761,6 @@
|
|||
"@types/express-serve-static-core" "*"
|
||||
"@types/mime" "*"
|
||||
|
||||
"@types/sharp@0.29.4":
|
||||
version "0.29.4"
|
||||
resolved "https://registry.yarnpkg.com/@types/sharp/-/sharp-0.29.4.tgz#e47d8677befc9944d4b9d76ed837452814166de0"
|
||||
integrity sha512-asrPef2LYenr76zBzyy+Fw40yGzq/q/CY77mUP5n43DnuWjQoOB+8vxnzFcqccz+LF+A7mbnknGCfpVWSG82Bw==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/sinon@10.0.2":
|
||||
version "10.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/sinon/-/sinon-10.0.2.tgz#f360d2f189c0fd433d14aeb97b9d705d7e4cc0e4"
|
||||
|
@ -6310,7 +6303,7 @@ color-name@^1.0.0, color-name@~1.1.4:
|
|||
resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
|
||||
integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==
|
||||
|
||||
color-string@1.9.0, color-string@^1.9.0:
|
||||
color-string@1.9.0:
|
||||
version "1.9.0"
|
||||
resolved "https://registry.yarnpkg.com/color-string/-/color-string-1.9.0.tgz#63b6ebd1bec11999d1df3a79a7569451ac2be8aa"
|
||||
integrity sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ==
|
||||
|
@ -6323,14 +6316,6 @@ color-support@^1.1.2, color-support@^1.1.3:
|
|||
resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2"
|
||||
integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==
|
||||
|
||||
color@^4.2.3:
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/color/-/color-4.2.3.tgz#d781ecb5e57224ee43ea9627560107c0e0c6463a"
|
||||
integrity sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==
|
||||
dependencies:
|
||||
color-convert "^2.0.1"
|
||||
color-string "^1.9.0"
|
||||
|
||||
colorette@^2.0.10, colorette@^2.0.14:
|
||||
version "2.0.16"
|
||||
resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.16.tgz#713b9af84fdb000139f04546bd4a93f62a5085da"
|
||||
|
@ -7196,11 +7181,6 @@ detect-libc@^1.0.2, detect-libc@^1.0.3:
|
|||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-1.0.3.tgz#fa137c4bd698edf55cd5cd02ac559f91a4c4ba9b"
|
||||
|
||||
detect-libc@^2.0.0, detect-libc@^2.0.1:
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/detect-libc/-/detect-libc-2.0.1.tgz#e1897aa88fa6ad197862937fbc0441ef352ee0cd"
|
||||
integrity sha512-463v3ZeIrcWtdgIg6vI6XUncguvr2TnGl4SzDXinkt9mSLpBJKXT3mW6xT3VQdDN11+WVs29pgvivTc4Lp8v+w==
|
||||
|
||||
detect-node@^2.0.4:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/detect-node/-/detect-node-2.0.4.tgz#014ee8f8f669c5c58023da64b8179c083a28c46c"
|
||||
|
@ -12723,18 +12703,6 @@ node-abi@^2.21.0:
|
|||
dependencies:
|
||||
semver "^5.4.1"
|
||||
|
||||
node-abi@^3.3.0:
|
||||
version "3.5.0"
|
||||
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.5.0.tgz#26e8b7b251c3260a5ac5ba5aef3b4345a0229248"
|
||||
integrity sha512-LtHvNIBgOy5mO8mPEUtkCW/YCRWYEKshIvqhe1GHHyXEHEB5mgICyYnAcl4qan3uFeRROErKGzatFHPf6kDxWw==
|
||||
dependencies:
|
||||
semver "^7.3.5"
|
||||
|
||||
node-addon-api@^5.0.0:
|
||||
version "5.0.0"
|
||||
resolved "https://registry.yarnpkg.com/node-addon-api/-/node-addon-api-5.0.0.tgz#7d7e6f9ef89043befdb20c1989c905ebde18c501"
|
||||
integrity sha512-CvkDw2OEnme7ybCykJpVcKH+uAOLV2qLqiyla128dN9TkEWfrYmxG6C2boDe5KcNQqZF3orkqzGgOMvZ/JNekA==
|
||||
|
||||
node-cleanup@^2.1.2:
|
||||
version "2.1.2"
|
||||
resolved "https://registry.yarnpkg.com/node-cleanup/-/node-cleanup-2.1.2.tgz#7ac19abd297e09a7f72a71545d951b517e4dde2c"
|
||||
|
@ -14059,25 +14027,6 @@ prebuild-install@^6.0.0:
|
|||
tar-fs "^2.0.0"
|
||||
tunnel-agent "^0.6.0"
|
||||
|
||||
prebuild-install@^7.1.0:
|
||||
version "7.1.0"
|
||||
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.0.tgz#991b6ac16c81591ba40a6d5de93fb33673ac1370"
|
||||
integrity sha512-CNcMgI1xBypOyGqjp3wOc8AAo1nMhZS3Cwd3iHIxOdAUbb+YxdNuM4Z5iIrZ8RLvOsf3F3bl7b7xGq6DjQoNYA==
|
||||
dependencies:
|
||||
detect-libc "^2.0.0"
|
||||
expand-template "^2.0.3"
|
||||
github-from-package "0.0.0"
|
||||
minimist "^1.2.3"
|
||||
mkdirp-classic "^0.5.3"
|
||||
napi-build-utils "^1.0.1"
|
||||
node-abi "^3.3.0"
|
||||
npmlog "^4.0.1"
|
||||
pump "^3.0.0"
|
||||
rc "^1.2.7"
|
||||
simple-get "^4.0.0"
|
||||
tar-fs "^2.0.0"
|
||||
tunnel-agent "^0.6.0"
|
||||
|
||||
prelude-ls@^1.2.1:
|
||||
version "1.2.1"
|
||||
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
|
||||
|
@ -15836,20 +15785,6 @@ shallowequal@^1.1.0:
|
|||
resolved "https://registry.yarnpkg.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8"
|
||||
integrity sha512-y0m1JoUZSlPAjXVtPPW70aZWfIL/dSP7AFkRnniLCrK/8MDKog3TySTBmckD+RObVxH0v4Tox67+F14PdED2oQ==
|
||||
|
||||
sharp@0.30.5:
|
||||
version "0.30.5"
|
||||
resolved "https://registry.yarnpkg.com/sharp/-/sharp-0.30.5.tgz#81c36fd05624978384ac6bd2744d23f9c82edefd"
|
||||
integrity sha512-0T28KxqY4DzUMLSAp1/IhGVeHpPIQyp1xt7esmuXCAfyi/+6tYMUeRhQok+E/+E52Yk5yFjacXp90cQOkmkl4w==
|
||||
dependencies:
|
||||
color "^4.2.3"
|
||||
detect-libc "^2.0.1"
|
||||
node-addon-api "^5.0.0"
|
||||
prebuild-install "^7.1.0"
|
||||
semver "^7.3.7"
|
||||
simple-get "^4.0.1"
|
||||
tar-fs "^2.1.1"
|
||||
tunnel-agent "^0.6.0"
|
||||
|
||||
shebang-command@^1.2.0:
|
||||
version "1.2.0"
|
||||
resolved "https://registry.yarnpkg.com/shebang-command/-/shebang-command-1.2.0.tgz#44aac65b695b03398968c39f363fee5deafdf1ea"
|
||||
|
@ -15912,15 +15847,6 @@ simple-get@^3.0.3:
|
|||
once "^1.3.1"
|
||||
simple-concat "^1.0.0"
|
||||
|
||||
simple-get@^4.0.0, simple-get@^4.0.1:
|
||||
version "4.0.1"
|
||||
resolved "https://registry.yarnpkg.com/simple-get/-/simple-get-4.0.1.tgz#4a39db549287c979d352112fa03fd99fd6bc3543"
|
||||
integrity sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==
|
||||
dependencies:
|
||||
decompress-response "^6.0.0"
|
||||
once "^1.3.1"
|
||||
simple-concat "^1.0.0"
|
||||
|
||||
simple-swizzle@^0.2.2:
|
||||
version "0.2.2"
|
||||
resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a"
|
||||
|
@ -16610,7 +16536,7 @@ tapable@^2.0.0, tapable@^2.1.1, tapable@^2.2.0:
|
|||
resolved "https://registry.yarnpkg.com/tapable/-/tapable-2.2.0.tgz#5c373d281d9c672848213d0e037d1c4165ab426b"
|
||||
integrity sha512-FBk4IesMV1rBxX2tfiK8RAmogtWn53puLOQlvO8XuwlgxcYbP4mVPS9Ph4aeamSyyVjOl24aYWAuc8U5kCVwMw==
|
||||
|
||||
tar-fs@^2.0.0, tar-fs@^2.1.1:
|
||||
tar-fs@^2.0.0:
|
||||
version "2.1.1"
|
||||
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-2.1.1.tgz#489a15ab85f1f0befabb370b7de4f9eb5cbe8784"
|
||||
integrity sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==
|
||||
|
|
Loading…
Reference in a new issue