Update electron to 17.3.0
This commit is contained in:
parent
8b36e37d18
commit
f7c3a44056
|
@ -264,7 +264,7 @@
|
||||||
"cross-env": "5.2.0",
|
"cross-env": "5.2.0",
|
||||||
"css-loader": "3.2.0",
|
"css-loader": "3.2.0",
|
||||||
"debug": "4.3.3",
|
"debug": "4.3.3",
|
||||||
"electron": "17.2.0",
|
"electron": "17.3.0",
|
||||||
"electron-builder": "23.0.1",
|
"electron-builder": "23.0.1",
|
||||||
"electron-mocha": "11.0.2",
|
"electron-mocha": "11.0.2",
|
||||||
"electron-notarize": "0.1.1",
|
"electron-notarize": "0.1.1",
|
||||||
|
@ -412,8 +412,6 @@
|
||||||
"afterPack": "ts/scripts/after-pack.js",
|
"afterPack": "ts/scripts/after-pack.js",
|
||||||
"afterSign": "ts/scripts/after-sign.js",
|
"afterSign": "ts/scripts/after-sign.js",
|
||||||
"asarUnpack": [
|
"asarUnpack": [
|
||||||
"ts/workers/heicConverter.bundle.js",
|
|
||||||
"ts/sql/mainWorker.bundle.js",
|
|
||||||
"node_modules/better-sqlite3/build/Release/better_sqlite3.node"
|
"node_modules/better-sqlite3/build/Release/better_sqlite3.node"
|
||||||
],
|
],
|
||||||
"files": [
|
"files": [
|
||||||
|
|
|
@ -83,43 +83,3 @@ esbuild.build({
|
||||||
entryPoints: [path.join(ROOT_DIR, 'preload.js')],
|
entryPoints: [path.join(ROOT_DIR, 'preload.js')],
|
||||||
outfile: path.join(ROOT_DIR, 'preload.bundle.js'),
|
outfile: path.join(ROOT_DIR, 'preload.bundle.js'),
|
||||||
});
|
});
|
||||||
|
|
||||||
// HEIC worker
|
|
||||||
esbuild.build({
|
|
||||||
...bundleDefaults,
|
|
||||||
entryPoints: [path.join(ROOT_DIR, 'ts', 'workers', 'heicConverterWorker.ts')],
|
|
||||||
outfile: path.join(ROOT_DIR, 'ts', 'workers', 'heicConverter.bundle.js'),
|
|
||||||
});
|
|
||||||
|
|
||||||
// SQL worker
|
|
||||||
const libDir = path.join('..', '..', 'node_modules', 'better-sqlite3');
|
|
||||||
const bindingFile = path.join(
|
|
||||||
libDir,
|
|
||||||
'build',
|
|
||||||
'Release',
|
|
||||||
'better_sqlite3.node'
|
|
||||||
);
|
|
||||||
|
|
||||||
esbuild.build({
|
|
||||||
...nodeDefaults,
|
|
||||||
bundle: true,
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
{
|
|
||||||
name: 'bindings',
|
|
||||||
setup(build) {
|
|
||||||
build.onResolve({ filter: /^bindings$/ }, () => ({
|
|
||||||
path: path.join(ROOT_DIR, 'ts', 'sql', 'mainWorkerBindings.ts'),
|
|
||||||
}));
|
|
||||||
|
|
||||||
build.onResolve({ filter: /^better_sqlite3\.node$/ }, () => ({
|
|
||||||
path: bindingFile,
|
|
||||||
external: true,
|
|
||||||
}));
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
entryPoints: [path.join(ROOT_DIR, 'ts', 'sql', 'mainWorker.ts')],
|
|
||||||
outfile: path.join(ROOT_DIR, 'ts', 'sql', 'mainWorker.bundle.js'),
|
|
||||||
});
|
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { Worker } from 'worker_threads';
|
import { Worker } from 'worker_threads';
|
||||||
import { format } from 'util';
|
import { format } from 'util';
|
||||||
|
import { app } from 'electron';
|
||||||
|
|
||||||
import { strictAssert } from '../util/assert';
|
import { strictAssert } from '../util/assert';
|
||||||
import { explodePromise } from '../util/explodePromise';
|
import { explodePromise } from '../util/explodePromise';
|
||||||
import type { LoggerType } from '../types/Logging';
|
import type { LoggerType } from '../types/Logging';
|
||||||
import { isCorruptionError } from './errors';
|
import { isCorruptionError } from './errors';
|
||||||
|
|
||||||
const ASAR_PATTERN = /app\.asar$/;
|
|
||||||
const MIN_TRACE_DURATION = 40;
|
const MIN_TRACE_DURATION = 40;
|
||||||
|
|
||||||
export type InitializeOptions = Readonly<{
|
export type InitializeOptions = Readonly<{
|
||||||
|
@ -85,18 +85,8 @@ export class MainSQL {
|
||||||
private onResponse = new Map<number, PromisePair<any>>();
|
private onResponse = new Map<number, PromisePair<any>>();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
let appDir = join(__dirname, '..', '..');
|
const scriptDir = join(app.getAppPath(), 'ts', 'sql', 'mainWorker.js');
|
||||||
let isBundled = false;
|
this.worker = new Worker(scriptDir);
|
||||||
|
|
||||||
if (ASAR_PATTERN.test(appDir)) {
|
|
||||||
appDir = appDir.replace(ASAR_PATTERN, 'app.asar.unpacked');
|
|
||||||
isBundled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const scriptDir = join(appDir, 'ts', 'sql');
|
|
||||||
this.worker = new Worker(
|
|
||||||
join(scriptDir, isBundled ? 'mainWorker.bundle.js' : 'mainWorker.js')
|
|
||||||
);
|
|
||||||
|
|
||||||
const { promise: onCorruption, resolve: resolveCorruption } =
|
const { promise: onCorruption, resolve: resolveCorruption } =
|
||||||
explodePromise<Error>();
|
explodePromise<Error>();
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
// This is a shim that gets inserted in place of `bindings` npm module when
|
|
||||||
// building sql worker bundle.
|
|
||||||
module.exports = (binding: string) => {
|
|
||||||
if (binding === 'better_sqlite3.node') {
|
|
||||||
// eslint-disable-next-line global-require, import/no-unresolved
|
|
||||||
return require('better_sqlite3.node');
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new Error(`Unknown binding ${binding}`);
|
|
||||||
};
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
import { Worker } from 'worker_threads';
|
import { Worker } from 'worker_threads';
|
||||||
|
import { app } from 'electron';
|
||||||
|
|
||||||
export type WrappedWorkerRequest = {
|
export type WrappedWorkerRequest = {
|
||||||
readonly uuid: string;
|
readonly uuid: string;
|
||||||
|
@ -15,25 +16,17 @@ export type WrappedWorkerResponse = {
|
||||||
readonly response?: File;
|
readonly response?: File;
|
||||||
};
|
};
|
||||||
|
|
||||||
const ASAR_PATTERN = /app\.asar$/;
|
|
||||||
|
|
||||||
export function getHeicConverter(): (
|
export function getHeicConverter(): (
|
||||||
uuid: string,
|
uuid: string,
|
||||||
data: Uint8Array
|
data: Uint8Array
|
||||||
) => Promise<WrappedWorkerResponse> {
|
) => Promise<WrappedWorkerResponse> {
|
||||||
let appDir = join(__dirname, '..', '..');
|
const scriptDir = join(
|
||||||
let isBundled = false;
|
app.getAppPath(),
|
||||||
if (ASAR_PATTERN.test(appDir)) {
|
'ts',
|
||||||
appDir = appDir.replace(ASAR_PATTERN, 'app.asar.unpacked');
|
'workers',
|
||||||
isBundled = true;
|
'heicConverterWorker.js'
|
||||||
}
|
|
||||||
const scriptDir = join(appDir, 'ts', 'workers');
|
|
||||||
const worker = new Worker(
|
|
||||||
join(
|
|
||||||
scriptDir,
|
|
||||||
isBundled ? 'heicConverter.bundle.js' : 'heicConverterWorker.js'
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
const worker = new Worker(scriptDir);
|
||||||
|
|
||||||
const ResponseMap = new Map<
|
const ResponseMap = new Map<
|
||||||
string,
|
string,
|
||||||
|
|
|
@ -6172,10 +6172,10 @@ electron-window@^0.8.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-electron-renderer "^2.0.0"
|
is-electron-renderer "^2.0.0"
|
||||||
|
|
||||||
electron@17.2.0:
|
electron@17.3.0:
|
||||||
version "17.2.0"
|
version "17.3.0"
|
||||||
resolved "https://registry.yarnpkg.com/electron/-/electron-17.2.0.tgz#a5c42c16352ea968fcb5d1ce256bec51e7d140fe"
|
resolved "https://registry.yarnpkg.com/electron/-/electron-17.3.0.tgz#cdcc46a7a3cd0b6f2a1757fbeb807f6b2fce847e"
|
||||||
integrity sha512-eNXhPVEUofkgAeqRFvTizzYecoCMyS0Rar08WZHSAw9wjfZXawYMvTpjjjk9GiX9W/+Cjxua4YtGn5bOTabc0A==
|
integrity sha512-KuYHCOw1a+CE9thZlWRqTScf6M81KLd6n5qpdBGb0rl62+50RUuau9CnYpBb3EJxrjsXLaiQCBBSdPsozf/XUg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@electron/get" "^1.13.0"
|
"@electron/get" "^1.13.0"
|
||||||
"@types/node" "^14.6.2"
|
"@types/node" "^14.6.2"
|
||||||
|
|
Loading…
Reference in New Issue