mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Chore: Removed "canvas" package to fix build using node 18
This commit is contained in:
parent
e518d45719
commit
c7444e563b
@ -4,6 +4,7 @@
|
||||
"words": [
|
||||
"adata",
|
||||
"Avenir",
|
||||
"Dicourse",
|
||||
"githubusercontent",
|
||||
"MASTERKEY",
|
||||
"mkdirp",
|
||||
|
@ -4,38 +4,54 @@
|
||||
// use strict is necessary here so that typescript doesn't place "use strict" above the jest docblock
|
||||
// https://github.com/microsoft/TypeScript/issues/15819#issuecomment-782235619
|
||||
|
||||
import { textToDataUri, svgUriToPng } from './contextMenuUtils';
|
||||
// import { textToDataUri, svgUriToPng } from './contextMenuUtils';
|
||||
|
||||
jest.mock('@joplin/lib/models/Resource');
|
||||
// jest.mock('@joplin/lib/models/Resource');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// These tests are disabled because unfortunately they require the "canvas"
|
||||
// module, and it's yet another binary module that fails to compile half of the
|
||||
// time. Since it's only needed here it's not worth the trouble.
|
||||
|
||||
describe('contextMenu', () => {
|
||||
it('should provide proper copy path', async () => {
|
||||
const testCase = [
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">test</svg>',
|
||||
'image/svg+xml',
|
||||
];
|
||||
const expectedText = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3BhY2U9InByZXNlcnZlIj50ZXN0PC9zdmc+';
|
||||
expect(textToDataUri(testCase[0], testCase[1])).toBe(expectedText);
|
||||
|
||||
it('should pass', () => {
|
||||
expect(1).toBe(1);
|
||||
});
|
||||
|
||||
it('should convert to png binary', async () => {
|
||||
const testCase = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3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jQtOS44LDgtMTMuMywxMy43QzEwLjgsMjcuOSw5LjgsMjkuNyw5LDMxLjZ6Ii8+Cgk8cGF0aCBkPSJNMTUuNCw1NC43Yy0yLjYtMS02LjEsMC43LTkuNywzLjRjMS4yLDYuNiwzLjksMTMsOCwxOC41QzEzLDY5LjMsMTMuNSw2MS44LDE1LjQsNTQuN3oiLz4KCTxwYXRoIGQ9Ik0zOS44LDU3LjZDNTQuMyw2Ni43LDcwLDczLDg2LjUsNzYuNGMwLjYtMC44LDEuMS0xLjYsMS43LTIuNWM0LjgtNy43LDctMTYuMyw2LjgtMjQuOGMtMTMuOC05LjMtMzEuMy04LjQtNDUuOC03LjcgICBjLTkuNSwwLjUtMTcuOCwwLjktMjMuMi0xLjdjLTAuMSwwLjEtMC4yLDAuMy0wLjMsMC40Yy0xLDEuNy0yLDMuNC0yLjksNS4xQzI4LjIsNDkuNywzMy44LDUzLjksMzkuOCw1Ny42eiIvPgoJPHBhdGggZD0iTTI2LjIsODguMmMzLjMsMiw2LjcsMy42LDEwLjIsNC43Yy0zLjUtNi4yLTYuMy0xMi42LTguOC0xOC41Yy0zLjEtNy4yLTUuOC0xMy41LTktMTcuMmMtMS45LDgtMiwxNi40LTAuMywyNC43ICAgQzIwLjYsODQuMiwyMy4yLDg2LjMsMjYuMiw4OC4yeiIvPgoJPHBhdGggZD0iTTMwLjksNzNjMi45LDYuOCw2LjEsMTQuNCwxMC41LDIxLjJjMTUuNiwzLDMyLTIuMyw0Mi42LTE0LjZDNjcuNyw3Niw1Mi4yLDY5LjYsMzcuOSw2MC43QzMyLDU3LDI2LjUsNTMsMjEuMyw0OC42ICAgYy0wLjYsMS41LTEuMiwzLTEuNyw0LjZDMjQuMSw1Ny4xLDI3LjMsNjQuNSwzMC45LDczeiIvPgo8L2c+Cjwvc3ZnPg==';
|
||||
const png = await svgUriToPng(document, testCase);
|
||||
expect(png).toBeInstanceOf(Uint8Array);
|
||||
});
|
||||
// it('should provide proper copy path', async () => {
|
||||
// const testCase = [
|
||||
// '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">test</svg>',
|
||||
// 'image/svg+xml',
|
||||
// ];
|
||||
// const expectedText = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB4bWw6c3BhY2U9InByZXNlcnZlIj50ZXN0PC9zdmc+';
|
||||
// expect(textToDataUri(testCase[0], testCase[1])).toBe(expectedText);
|
||||
// });
|
||||
|
||||
it('should throw error on invalid svg uri', async () => {
|
||||
// We are mocking console.error since jsdom throws errors to console when we try to load an invalid img
|
||||
// https://github.com/facebook/jest/pull/5267#issuecomment-356605468
|
||||
const consoleError = console.error;
|
||||
console.error = jest.fn();
|
||||
const testCases: Array<string> = [
|
||||
'data:image/svg+xml;base64,error',
|
||||
'invalid',
|
||||
];
|
||||
for (const testCase of testCases) {
|
||||
await expect(svgUriToPng(document, testCase)).rejects.toBeInstanceOf(Error);
|
||||
}
|
||||
console.error = consoleError;
|
||||
});
|
||||
// it('should convert to png binary', async () => {
|
||||
// const testCase = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiIGlkPSJMYXllcl8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDEwMCAxMDAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDEwMCAxMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiIGhlaWdodD0iMTAwcHgiIHdpZHRoPSIxMDBweCI+CjxnPgoJPHBhdGggZD0iTTI4LjEsMzYuNmM0LjYsMS45LDEyLjIsMS42LDIwLjksMS4xYzguOS0wLjQs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TkuNSwwLjUtMTcuOCwwLjktMjMuMi0xLjdjLTAuMSwwLjEtMC4yLDAuMy0wLjMsMC40Yy0xLDEuNy0yLDMuNC0yLjksNS4xQzI4LjIsNDkuNywzMy44LDUzLjksMzkuOCw1Ny42eiIvPgoJPHBhdGggZD0iTTI2LjIsODguMmMzLjMsMiw2LjcsMy42LDEwLjIsNC43Yy0zLjUtNi4yLTYuMy0xMi42LTguOC0xOC41Yy0zLjEtNy4yLTUuOC0xMy41LTktMTcuMmMtMS45LDgtMiwxNi40LTAuMywyNC43ICAgQzIwLjYsODQuMiwyMy4yLDg2LjMsMjYuMiw4OC4yeiIvPgoJPHBhdGggZD0iTTMwLjksNzNjMi45LDYuOCw2LjEsMTQuNCwxMC41LDIxLjJjMTUuNiwzLDMyLTIuMyw0Mi42LTE0LjZDNjcuNyw3Niw1Mi4yLDY5LjYsMzcuOSw2MC43QzMyLDU3LDI2LjUsNTMsMjEuMyw0OC42ICAgYy0wLjYsMS41LTEuMiwzLTEuNyw0LjZDMjQuMSw1Ny4xLDI3LjMsNjQuNSwzMC45LDczeiIvPgo8L2c+Cjwvc3ZnPg==';
|
||||
// const png = await svgUriToPng(document, testCase);
|
||||
// expect(png).toBeInstanceOf(Uint8Array);
|
||||
// });
|
||||
|
||||
// it('should throw error on invalid svg uri', async () => {
|
||||
// // We are mocking console.error since jsdom throws errors to console when we try to load an invalid img
|
||||
// // https://github.com/facebook/jest/pull/5267#issuecomment-356605468
|
||||
// const consoleError = console.error;
|
||||
// console.error = jest.fn();
|
||||
// const testCases: Array<string> = [
|
||||
// 'data:image/svg+xml;base64,error',
|
||||
// 'invalid',
|
||||
// ];
|
||||
// for (const testCase of testCases) {
|
||||
// await expect(svgUriToPng(document, testCase)).rejects.toBeInstanceOf(Error);
|
||||
// }
|
||||
// console.error = consoleError;
|
||||
// });
|
||||
});
|
||||
|
@ -116,7 +116,6 @@
|
||||
"app-builder-bin": "^1.9.11",
|
||||
"babel-cli": "^6.26.0",
|
||||
"babel-preset-react": "^6.24.1",
|
||||
"canvas": "^2.9.0",
|
||||
"electron": "14.1.0",
|
||||
"electron-builder": "^22.11.7",
|
||||
"electron-notarize": "^1.0.0",
|
||||
|
81
yarn.lock
81
yarn.lock
@ -2910,7 +2910,6 @@ __metadata:
|
||||
async-mutex: ^0.1.3
|
||||
babel-cli: ^6.26.0
|
||||
babel-preset-react: ^6.24.1
|
||||
canvas: ^2.9.0
|
||||
codemirror: ^5.56.0
|
||||
color: ^3.1.2
|
||||
compare-versions: ^3.2.1
|
||||
@ -4217,25 +4216,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@mapbox/node-pre-gyp@npm:^1.0.0":
|
||||
version: 1.0.8
|
||||
resolution: "@mapbox/node-pre-gyp@npm:1.0.8"
|
||||
dependencies:
|
||||
detect-libc: ^1.0.3
|
||||
https-proxy-agent: ^5.0.0
|
||||
make-dir: ^3.1.0
|
||||
node-fetch: ^2.6.5
|
||||
nopt: ^5.0.0
|
||||
npmlog: ^5.0.1
|
||||
rimraf: ^3.0.2
|
||||
semver: ^7.3.5
|
||||
tar: ^6.1.11
|
||||
bin:
|
||||
node-pre-gyp: bin/node-pre-gyp
|
||||
checksum: 29a38f39575107fa1665edf14defcfdf62e12bb38e9c27f7457ba42be84060125015171d12b8de3065155a465992f1854a363e2985f071fcbea9ff0701362b05
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@mrmlnc/readdir-enhanced@npm:^2.2.1":
|
||||
version: 2.2.1
|
||||
resolution: "@mrmlnc/readdir-enhanced@npm:2.2.1"
|
||||
@ -8839,18 +8819,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"canvas@npm:^2.9.0":
|
||||
version: 2.9.0
|
||||
resolution: "canvas@npm:2.9.0"
|
||||
dependencies:
|
||||
"@mapbox/node-pre-gyp": ^1.0.0
|
||||
nan: ^2.15.0
|
||||
node-gyp: latest
|
||||
simple-get: ^3.0.3
|
||||
checksum: 376ccd47340a46c04d5cabafd6feb1b7ae82c92dc3ae6db68c9cbac17ec1c43d2bf6aab60019690e9d49bf40b41bee3e4e0a8901f39b53e993789698e77e2699
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"capital-case@npm:^1.0.4":
|
||||
version: 1.0.4
|
||||
resolution: "capital-case@npm:1.0.4"
|
||||
@ -14822,23 +14790,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"gauge@npm:^3.0.0":
|
||||
version: 3.0.2
|
||||
resolution: "gauge@npm:3.0.2"
|
||||
dependencies:
|
||||
aproba: ^1.0.3 || ^2.0.0
|
||||
color-support: ^1.1.2
|
||||
console-control-strings: ^1.0.0
|
||||
has-unicode: ^2.0.1
|
||||
object-assign: ^4.1.1
|
||||
signal-exit: ^3.0.0
|
||||
string-width: ^4.2.3
|
||||
strip-ansi: ^6.0.1
|
||||
wide-align: ^1.1.2
|
||||
checksum: 81296c00c7410cdd48f997800155fbead4f32e4f82109be0719c63edc8560e6579946cc8abd04205297640691ec26d21b578837fd13a4e96288ab4b40b1dc3e9
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"gauge@npm:^4.0.0":
|
||||
version: 4.0.0
|
||||
resolution: "gauge@npm:4.0.0"
|
||||
@ -20176,7 +20127,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"make-dir@npm:^3.0.0, make-dir@npm:^3.1.0":
|
||||
"make-dir@npm:^3.0.0":
|
||||
version: 3.1.0
|
||||
resolution: "make-dir@npm:3.1.0"
|
||||
dependencies:
|
||||
@ -21656,7 +21607,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"nan@npm:^2.12.1, nan@npm:^2.15.0":
|
||||
"nan@npm:^2.12.1":
|
||||
version: 2.15.0
|
||||
resolution: "nan@npm:2.15.0"
|
||||
dependencies:
|
||||
@ -21933,20 +21884,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"node-fetch@npm:^2.6.5":
|
||||
version: 2.6.7
|
||||
resolution: "node-fetch@npm:2.6.7"
|
||||
dependencies:
|
||||
whatwg-url: ^5.0.0
|
||||
peerDependencies:
|
||||
encoding: ^0.1.0
|
||||
peerDependenciesMeta:
|
||||
encoding:
|
||||
optional: true
|
||||
checksum: 8d816ffd1ee22cab8301c7756ef04f3437f18dace86a1dae22cf81db8ef29c0bf6655f3215cb0cdb22b420b6fe141e64b26905e7f33f9377a7fa59135ea3e10b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"node-gyp-build@npm:^4.2.1":
|
||||
version: 4.3.0
|
||||
resolution: "node-gyp-build@npm:4.3.0"
|
||||
@ -22401,18 +22338,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"npmlog@npm:^5.0.1":
|
||||
version: 5.0.1
|
||||
resolution: "npmlog@npm:5.0.1"
|
||||
dependencies:
|
||||
are-we-there-yet: ^2.0.0
|
||||
console-control-strings: ^1.1.0
|
||||
gauge: ^3.0.0
|
||||
set-blocking: ^2.0.0
|
||||
checksum: 516b2663028761f062d13e8beb3f00069c5664925871a9b57989642ebe09f23ab02145bf3ab88da7866c4e112cafff72401f61a672c7c8a20edc585a7016ef5f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"npmlog@npm:^6.0.0":
|
||||
version: 6.0.0
|
||||
resolution: "npmlog@npm:6.0.0"
|
||||
@ -28586,7 +28511,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"tar@npm:^6.0.2, tar@npm:^6.0.5, tar@npm:^6.1.11, tar@npm:^6.1.2":
|
||||
"tar@npm:^6.0.2, tar@npm:^6.0.5, tar@npm:^6.1.2":
|
||||
version: 6.1.11
|
||||
resolution: "tar@npm:6.1.11"
|
||||
dependencies:
|
||||
|
Loading…
Reference in New Issue
Block a user