Bundle preload.js
This commit is contained in:
parent
9c3e3c4331
commit
4fd3ed7242
11 changed files with 205 additions and 232 deletions
|
@ -30,3 +30,4 @@ sticker-creator/**/*.js
|
||||||
**/*.d.ts
|
**/*.d.ts
|
||||||
.eslintrc.js
|
.eslintrc.js
|
||||||
webpack.config.ts
|
webpack.config.ts
|
||||||
|
preload.bundle.*
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -39,3 +39,4 @@ sticker-creator/dist/*
|
||||||
|
|
||||||
/.idea
|
/.idea
|
||||||
/storybook-static/
|
/storybook-static/
|
||||||
|
preload.bundle.*
|
||||||
|
|
|
@ -45,3 +45,4 @@ _locales/**/*.json
|
||||||
# Symlink into third-party `components`:
|
# Symlink into third-party `components`:
|
||||||
stylesheets/_intlTelInput.scss
|
stylesheets/_intlTelInput.scss
|
||||||
|
|
||||||
|
preload.bundle.*
|
||||||
|
|
12
main.js
12
main.js
|
@ -336,7 +336,12 @@ async function createWindow() {
|
||||||
nodeIntegrationInWorker: false,
|
nodeIntegrationInWorker: false,
|
||||||
contextIsolation: false,
|
contextIsolation: false,
|
||||||
enableRemoteModule: true,
|
enableRemoteModule: true,
|
||||||
preload: path.join(__dirname, 'preload.js'),
|
preload: path.join(
|
||||||
|
__dirname,
|
||||||
|
enableCI || config.environment === 'production'
|
||||||
|
? 'preload.bundle.js'
|
||||||
|
: 'preload.js'
|
||||||
|
),
|
||||||
nativeWindowOpen: true,
|
nativeWindowOpen: true,
|
||||||
spellcheck: await getSpellCheckSetting(),
|
spellcheck: await getSpellCheckSetting(),
|
||||||
backgroundThrottling: false,
|
backgroundThrottling: false,
|
||||||
|
@ -964,14 +969,15 @@ app.on('ready', async () => {
|
||||||
|
|
||||||
// We use this event only a single time to log the startup time of the app
|
// We use this event only a single time to log the startup time of the app
|
||||||
// from when it's first ready until the loading screen disappears.
|
// from when it's first ready until the loading screen disappears.
|
||||||
ipc.once('signal-app-loaded', () => {
|
ipc.once('signal-app-loaded', (event, { preloadTime }) => {
|
||||||
const loadTime = Date.now() - startTime;
|
const loadTime = Date.now() - startTime;
|
||||||
const sqlInitTime = sqlInitTimeEnd - sqlInitTimeStart;
|
const sqlInitTime = sqlInitTimeEnd - sqlInitTimeStart;
|
||||||
console.log('App loaded - time:', loadTime);
|
console.log('App loaded - time:', loadTime);
|
||||||
console.log('SQL init - time:', sqlInitTime);
|
console.log('SQL init - time:', sqlInitTime);
|
||||||
|
console.log('Preload - time:', preloadTime);
|
||||||
|
|
||||||
if (enableCI) {
|
if (enableCI) {
|
||||||
console._log('ci: app_loaded=%j', { loadTime, sqlInitTime });
|
console._log('ci: app_loaded=%j', { loadTime, sqlInitTime, preloadTime });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -212,6 +212,7 @@
|
||||||
"@types/storybook__addon-actions": "3.4.3",
|
"@types/storybook__addon-actions": "3.4.3",
|
||||||
"@types/storybook__addon-knobs": "5.0.3",
|
"@types/storybook__addon-knobs": "5.0.3",
|
||||||
"@types/storybook__react": "4.0.2",
|
"@types/storybook__react": "4.0.2",
|
||||||
|
"@types/terser-webpack-plugin": "5.0.3",
|
||||||
"@types/underscore": "1.10.3",
|
"@types/underscore": "1.10.3",
|
||||||
"@types/uuid": "3.4.4",
|
"@types/uuid": "3.4.4",
|
||||||
"@types/webpack-dev-server": "3.11.3",
|
"@types/webpack-dev-server": "3.11.3",
|
||||||
|
@ -264,6 +265,7 @@
|
||||||
"snyk": "1.316.1",
|
"snyk": "1.316.1",
|
||||||
"spectron": "5.0.0",
|
"spectron": "5.0.0",
|
||||||
"style-loader": "1.0.0",
|
"style-loader": "1.0.0",
|
||||||
|
"terser-webpack-plugin": "5.1.1",
|
||||||
"ts-dedent": "2.0.0",
|
"ts-dedent": "2.0.0",
|
||||||
"ts-loader": "4.1.0",
|
"ts-loader": "4.1.0",
|
||||||
"ts-node": "8.3.0",
|
"ts-node": "8.3.0",
|
||||||
|
@ -396,7 +398,7 @@
|
||||||
"stylesheets/*.css",
|
"stylesheets/*.css",
|
||||||
"!js/register.js",
|
"!js/register.js",
|
||||||
"app/*",
|
"app/*",
|
||||||
"preload.js",
|
"preload.bundle.js",
|
||||||
"preload_utils.js",
|
"preload_utils.js",
|
||||||
"about_preload.js",
|
"about_preload.js",
|
||||||
"settings_preload.js",
|
"settings_preload.js",
|
||||||
|
@ -440,7 +442,8 @@
|
||||||
"node_modules/libsignal-client/build/*${platform}*.node",
|
"node_modules/libsignal-client/build/*${platform}*.node",
|
||||||
"node_modules/ringrtc/build/${platform}/**",
|
"node_modules/ringrtc/build/${platform}/**",
|
||||||
"!**/node_modules/ffi-napi/deps",
|
"!**/node_modules/ffi-napi/deps",
|
||||||
"!**/node_modules/react-dom/*/*.development.js"
|
"!**/node_modules/react-dom/*/*.development.js",
|
||||||
|
"!node_modules/.cache"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
|
|
||||||
/* eslint-disable global-require, no-inner-declarations */
|
/* eslint-disable global-require, no-inner-declarations */
|
||||||
|
|
||||||
|
const preloadStartTime = Date.now();
|
||||||
|
let preloadEndTime = 0;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const electron = require('electron');
|
const electron = require('electron');
|
||||||
const semver = require('semver');
|
const semver = require('semver');
|
||||||
|
@ -108,7 +111,10 @@ try {
|
||||||
|
|
||||||
window.setBadgeCount = count => ipc.send('set-badge-count', count);
|
window.setBadgeCount = count => ipc.send('set-badge-count', count);
|
||||||
|
|
||||||
window.logAppLoadedEvent = () => ipc.send('signal-app-loaded');
|
window.logAppLoadedEvent = () =>
|
||||||
|
ipc.send('signal-app-loaded', {
|
||||||
|
preloadTime: preloadEndTime - preloadStartTime,
|
||||||
|
});
|
||||||
|
|
||||||
// We never do these in our code, so we'll prevent it everywhere
|
// We never do these in our code, so we'll prevent it everywhere
|
||||||
window.open = () => null;
|
window.open = () => null;
|
||||||
|
@ -715,4 +721,5 @@ try {
|
||||||
throw error;
|
throw error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
preloadEndTime = Date.now();
|
||||||
window.log.info('preload complete');
|
window.log.info('preload complete');
|
||||||
|
|
|
@ -13,6 +13,7 @@ import {
|
||||||
cloneDeep,
|
cloneDeep,
|
||||||
compact,
|
compact,
|
||||||
fromPairs,
|
fromPairs,
|
||||||
|
toPairs,
|
||||||
get,
|
get,
|
||||||
groupBy,
|
groupBy,
|
||||||
isFunction,
|
isFunction,
|
||||||
|
@ -258,9 +259,9 @@ async function goBackToMainProcess(): Promise<void> {
|
||||||
|
|
||||||
const channelsAsUnknown = fromPairs(
|
const channelsAsUnknown = fromPairs(
|
||||||
compact(
|
compact(
|
||||||
map(dataInterface, (value: any) => {
|
map(toPairs(dataInterface), ([name, value]: [string, any]) => {
|
||||||
if (isFunction(value)) {
|
if (isFunction(value)) {
|
||||||
return [value.name, makeChannel(value.name)];
|
return [name, makeChannel(name)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -15795,214 +15795,6 @@
|
||||||
"reasonCategory": "falseMatch",
|
"reasonCategory": "falseMatch",
|
||||||
"updated": "2020-04-30T22:35:27.860Z"
|
"updated": "2020-04-30T22:35:27.860Z"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"rule": "jQuery-insertBefore(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/esm/node-path.js",
|
|
||||||
"line": "function insertBefore(context, newNode) {",
|
|
||||||
"lineNumber": 26,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-insertAfter(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/esm/node-path.js",
|
|
||||||
"line": "function insertAfter(context, newNode) {",
|
|
||||||
"lineNumber": 30,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-before(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/esm/traverse.js",
|
|
||||||
"line": " before(type, path);",
|
|
||||||
"lineNumber": 77,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-after(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/esm/traverse.js",
|
|
||||||
"line": " after(type, path);",
|
|
||||||
"lineNumber": 79,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-before(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/esm/traverse.js",
|
|
||||||
"line": " before(unionType, path);",
|
|
||||||
"lineNumber": 90,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-after(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/esm/traverse.js",
|
|
||||||
"line": " after(unionType, path);",
|
|
||||||
"lineNumber": 92,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-insertBefore(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/lib/node-path.js",
|
|
||||||
"line": "function insertBefore(context, newNode) {",
|
|
||||||
"lineNumber": 33,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-insertAfter(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/lib/node-path.js",
|
|
||||||
"line": "function insertAfter(context, newNode) {",
|
|
||||||
"lineNumber": 37,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-before(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/lib/traverse.js",
|
|
||||||
"line": " before(type, path);",
|
|
||||||
"lineNumber": 86,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-after(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/lib/traverse.js",
|
|
||||||
"line": " after(type, path);",
|
|
||||||
"lineNumber": 88,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-before(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/lib/traverse.js",
|
|
||||||
"line": " before(unionType, path);",
|
|
||||||
"lineNumber": 99,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-after(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/ast/lib/traverse.js",
|
|
||||||
"line": " after(unionType, path);",
|
|
||||||
"lineNumber": 101,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-before(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/wasm-edit/esm/index.js",
|
|
||||||
"line": " function before(type, path) {",
|
|
||||||
"lineNumber": 73,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-after(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/wasm-edit/esm/index.js",
|
|
||||||
"line": " function after(type, path) {",
|
|
||||||
"lineNumber": 77,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-before(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/wasm-edit/lib/index.js",
|
|
||||||
"line": " function before(type, path) {",
|
|
||||||
"lineNumber": 90,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-after(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/@webassemblyjs/wasm-edit/lib/index.js",
|
|
||||||
"line": " function after(type, path) {",
|
|
||||||
"lineNumber": 94,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-$(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/acorn/dist/acorn.js",
|
|
||||||
"line": " // $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText)",
|
|
||||||
"lineNumber": 3119,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "eval",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/eslint-scope/lib/index.js",
|
|
||||||
"line": " * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls",
|
|
||||||
"lineNumber": 121,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "eval",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/eslint-scope/lib/scope.js",
|
|
||||||
"line": " * Moreover, if 'eval()' is used in a scope, it might introduce new",
|
|
||||||
"lineNumber": 182,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "eval",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/eslint-scope/lib/scope.js",
|
|
||||||
"line": " * Whether this is a scope that contains an 'eval()' invocation.",
|
|
||||||
"lineNumber": 236,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "eval",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/webpack/lib/EvalDevToolModuleTemplatePlugin.js",
|
|
||||||
"line": "\t\t\t\t\t`eval(${JSON.stringify(content + footer)});`",
|
|
||||||
"lineNumber": 48,
|
|
||||||
"reasonCategory": "usageTrusted",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "eval",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/webpack/lib/EvalSourceMapDevToolModuleTemplatePlugin.js",
|
|
||||||
"line": "\t\t\t\t\t`eval(${JSON.stringify(content + footer)});`",
|
|
||||||
"lineNumber": 98,
|
|
||||||
"reasonCategory": "usageTrusted",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-$(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/webpack/lib/HotModuleReplacement.runtime.js",
|
|
||||||
"line": "\t\t\treturn $require$(request);",
|
|
||||||
"lineNumber": 44,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-$(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/webpack/lib/HotModuleReplacement.runtime.js",
|
|
||||||
"line": "\t\t\t\t$require$(moduleId);",
|
|
||||||
"lineNumber": 603,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "jQuery-$(",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/webpack/lib/Template.js",
|
|
||||||
"line": "const PATH_NAME_NORMALIZE_REPLACE_REGEX = /[^a-zA-Z0-9_!§$()=\\-^°]+/g;",
|
|
||||||
"lineNumber": 22,
|
|
||||||
"reasonCategory": "falseMatch",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"rule": "eval",
|
|
||||||
"path": "node_modules/terser-webpack-plugin/node_modules/webpack/lib/optimize/ModuleConcatenationPlugin.js",
|
|
||||||
"line": "\t\t\t\t\t\tparser.state.module.buildMeta.moduleConcatenationBailout = \"eval()\";",
|
|
||||||
"lineNumber": 31,
|
|
||||||
"reasonCategory": "usageTrusted",
|
|
||||||
"updated": "2021-04-05T20:48:36.065Z"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"rule": "jQuery-before(",
|
"rule": "jQuery-before(",
|
||||||
"path": "node_modules/test-exclude/node_modules/braces/index.js",
|
"path": "node_modules/test-exclude/node_modules/braces/index.js",
|
||||||
|
@ -17401,5 +17193,95 @@
|
||||||
"reasonCategory": "usageTrusted",
|
"reasonCategory": "usageTrusted",
|
||||||
"updated": "2021-01-08T15:46:32.143Z",
|
"updated": "2021-01-08T15:46:32.143Z",
|
||||||
"reasonDetail": "Doesn't manipulate the DOM. This is just a function."
|
"reasonDetail": "Doesn't manipulate the DOM. This is just a function."
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-prepend(",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/source-map-support/browser-source-map-support.js",
|
||||||
|
"lineNumber": 90,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "eval",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/source-map-support/source-map-support.js",
|
||||||
|
"line": " // Most eval() calls are in this format",
|
||||||
|
"lineNumber": 234,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "eval",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/source-map-support/source-map-support.js",
|
||||||
|
"line": " // Parse nested eval() calls using recursion",
|
||||||
|
"lineNumber": 246,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "eval",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/source-map-support/source-map-support.js",
|
||||||
|
"line": " // passed to eval() ending in \"//# sourceURL=...\" will return the source file",
|
||||||
|
"lineNumber": 344,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "eval",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/source-map-support/source-map-support.js",
|
||||||
|
"line": " // Code called using eval() needs special handling",
|
||||||
|
"lineNumber": 373,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "DOM-innerHTML",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/terser/dist/bundle.min.js",
|
||||||
|
"lineNumber": 1,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "DOM-outerHTML",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/terser/dist/bundle.min.js",
|
||||||
|
"lineNumber": 1,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-$(",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/terser/dist/bundle.min.js",
|
||||||
|
"lineNumber": 1,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-after(",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/terser/dist/bundle.min.js",
|
||||||
|
"lineNumber": 1,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "jQuery-before(",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/terser/dist/bundle.min.js",
|
||||||
|
"lineNumber": 1,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "DOM-innerHTML",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/terser/tools/domprops.js",
|
||||||
|
"line": " \"innerHTML\",",
|
||||||
|
"lineNumber": 3419,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rule": "DOM-outerHTML",
|
||||||
|
"path": "node_modules/corejs-upgrade-webpack-plugin/node_modules/terser/tools/domprops.js",
|
||||||
|
"line": " \"outerHTML\",",
|
||||||
|
"lineNumber": 4349,
|
||||||
|
"reasonCategory": "falseMatch",
|
||||||
|
"updated": "2021-04-06T23:11:04.431Z"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -45,6 +45,7 @@ const searchPattern = normalizePath(join(basePath, '**/*.{js,ts,tsx}'));
|
||||||
|
|
||||||
const excludedFilesRegexps = [
|
const excludedFilesRegexps = [
|
||||||
'^release/',
|
'^release/',
|
||||||
|
'^preload.bundle.js(LICENSE.txt|map)?',
|
||||||
|
|
||||||
// Non-distributed files
|
// Non-distributed files
|
||||||
'\\.d\\.ts$',
|
'\\.d\\.ts$',
|
||||||
|
|
|
@ -5,6 +5,7 @@ import { resolve } from 'path';
|
||||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||||
import { Configuration, EnvironmentPlugin, ProvidePlugin } from 'webpack';
|
import { Configuration, EnvironmentPlugin, ProvidePlugin } from 'webpack';
|
||||||
import HtmlWebpackPlugin = require('html-webpack-plugin');
|
import HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||||
|
import TerserPlugin = require('terser-webpack-plugin');
|
||||||
|
|
||||||
const context = __dirname;
|
const context = __dirname;
|
||||||
const { NODE_ENV: mode = 'development' } = process.env;
|
const { NODE_ENV: mode = 'development' } = process.env;
|
||||||
|
@ -27,6 +28,7 @@ const csp = `
|
||||||
const stickerCreatorConfig: Configuration = {
|
const stickerCreatorConfig: Configuration = {
|
||||||
context,
|
context,
|
||||||
mode: mode as Configuration['mode'],
|
mode: mode as Configuration['mode'],
|
||||||
|
cache: { type: 'filesystem' },
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
entry: [
|
entry: [
|
||||||
'react-hot-loader/patch',
|
'react-hot-loader/patch',
|
||||||
|
@ -89,4 +91,64 @@ const stickerCreatorConfig: Configuration = {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
export default [stickerCreatorConfig];
|
const EXTERNAL_MODULE = new Set([
|
||||||
|
'backbone',
|
||||||
|
'better-sqlite3',
|
||||||
|
'ffi-napi',
|
||||||
|
'fs-xattr',
|
||||||
|
'fsevents',
|
||||||
|
'got',
|
||||||
|
'jquery',
|
||||||
|
'libsignal-client',
|
||||||
|
'node-fetch',
|
||||||
|
'node-sass',
|
||||||
|
'pino',
|
||||||
|
'proxy-agent',
|
||||||
|
'ref-array-napi',
|
||||||
|
'ref-napi',
|
||||||
|
'ringrtc',
|
||||||
|
'sharp',
|
||||||
|
'websocket',
|
||||||
|
'zkgroup',
|
||||||
|
]);
|
||||||
|
|
||||||
|
const preloadConfig: Configuration = {
|
||||||
|
context,
|
||||||
|
mode: mode as Configuration['mode'],
|
||||||
|
cache: { type: 'filesystem' },
|
||||||
|
devtool: mode === 'development' ? 'inline-source-map' : false,
|
||||||
|
entry: ['./preload.js'],
|
||||||
|
// Stack-traces have to be readable so don't mangle function names.
|
||||||
|
optimization: {
|
||||||
|
minimizer: [
|
||||||
|
new TerserPlugin({
|
||||||
|
terserOptions: {
|
||||||
|
mangle: {
|
||||||
|
keep_fnames: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
},
|
||||||
|
target: 'electron-preload',
|
||||||
|
output: {
|
||||||
|
path: resolve(context),
|
||||||
|
filename: 'preload.bundle.js',
|
||||||
|
publicPath: './',
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js'],
|
||||||
|
alias: {},
|
||||||
|
},
|
||||||
|
externals: [
|
||||||
|
({ request = '' }, callback) => {
|
||||||
|
if (EXTERNAL_MODULE.has(request)) {
|
||||||
|
return callback(undefined, `commonjs2 ${request}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
callback();
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export default [stickerCreatorConfig, preloadConfig];
|
||||||
|
|
36
yarn.lock
36
yarn.lock
|
@ -2658,6 +2658,14 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.7.tgz#545158342f949e8fd3bfd813224971ecddc3fac4"
|
resolved "https://registry.yarnpkg.com/@types/tapable/-/tapable-1.0.7.tgz#545158342f949e8fd3bfd813224971ecddc3fac4"
|
||||||
integrity sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ==
|
integrity sha512-0VBprVqfgFD7Ehb2vd8Lh9TG3jP98gvr8rgehQqzztZNI7o8zS8Ad4jyZneKELphpuE212D8J70LnSNQSyO6bQ==
|
||||||
|
|
||||||
|
"@types/terser-webpack-plugin@5.0.3":
|
||||||
|
version "5.0.3"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/terser-webpack-plugin/-/terser-webpack-plugin-5.0.3.tgz#9194c24dee3a9d5dcfd67b58edffc1d66653d16b"
|
||||||
|
integrity sha512-Ef60BOY9hV+yXjkMCuJI17cu1R8/H31n5Rnt1cElJFyBSkbRV3UWyBIYn8YpijsOG05R4bZf3G2azyBHkksu/A==
|
||||||
|
dependencies:
|
||||||
|
terser "^5.3.8"
|
||||||
|
webpack "^5.1.0"
|
||||||
|
|
||||||
"@types/tough-cookie@*":
|
"@types/tough-cookie@*":
|
||||||
version "2.3.5"
|
version "2.3.5"
|
||||||
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-2.3.5.tgz#9da44ed75571999b65c37b60c9b2b88db54c585d"
|
resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-2.3.5.tgz#9da44ed75571999b65c37b60c9b2b88db54c585d"
|
||||||
|
@ -16680,6 +16688,18 @@ term-size@^2.1.0:
|
||||||
resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.0.tgz#1f16adedfe9bdc18800e1776821734086fcc6753"
|
resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.0.tgz#1f16adedfe9bdc18800e1776821734086fcc6753"
|
||||||
integrity sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==
|
integrity sha512-a6sumDlzyHVJWb8+YofY4TW112G6p2FCPEAFk+59gIYHv3XHRhm9ltVQ9kli4hNWeQBwSpe8cRN25x0ROunMOw==
|
||||||
|
|
||||||
|
terser-webpack-plugin@5.1.1, terser-webpack-plugin@^5.1.1:
|
||||||
|
version "5.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.1.1.tgz#7effadee06f7ecfa093dbbd3e9ab23f5f3ed8673"
|
||||||
|
integrity sha512-5XNNXZiR8YO6X6KhSGXfY0QrGrCRlSwAEjIIrlRQR4W8nP69TaJUlh3bkuac6zzgspiGPfKEHcY295MMVExl5Q==
|
||||||
|
dependencies:
|
||||||
|
jest-worker "^26.6.2"
|
||||||
|
p-limit "^3.1.0"
|
||||||
|
schema-utils "^3.0.0"
|
||||||
|
serialize-javascript "^5.0.1"
|
||||||
|
source-map "^0.6.1"
|
||||||
|
terser "^5.5.1"
|
||||||
|
|
||||||
terser-webpack-plugin@^1.2.4, terser-webpack-plugin@^1.4.1:
|
terser-webpack-plugin@^1.2.4, terser-webpack-plugin@^1.4.1:
|
||||||
version "1.4.1"
|
version "1.4.1"
|
||||||
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4"
|
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4"
|
||||||
|
@ -16695,18 +16715,6 @@ terser-webpack-plugin@^1.2.4, terser-webpack-plugin@^1.4.1:
|
||||||
webpack-sources "^1.4.0"
|
webpack-sources "^1.4.0"
|
||||||
worker-farm "^1.7.0"
|
worker-farm "^1.7.0"
|
||||||
|
|
||||||
terser-webpack-plugin@^5.1.1:
|
|
||||||
version "5.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-5.1.1.tgz#7effadee06f7ecfa093dbbd3e9ab23f5f3ed8673"
|
|
||||||
integrity sha512-5XNNXZiR8YO6X6KhSGXfY0QrGrCRlSwAEjIIrlRQR4W8nP69TaJUlh3bkuac6zzgspiGPfKEHcY295MMVExl5Q==
|
|
||||||
dependencies:
|
|
||||||
jest-worker "^26.6.2"
|
|
||||||
p-limit "^3.1.0"
|
|
||||||
schema-utils "^3.0.0"
|
|
||||||
serialize-javascript "^5.0.1"
|
|
||||||
source-map "^0.6.1"
|
|
||||||
terser "^5.5.1"
|
|
||||||
|
|
||||||
terser@^4.1.2:
|
terser@^4.1.2:
|
||||||
version "4.2.0"
|
version "4.2.0"
|
||||||
resolved "https://registry.yarnpkg.com/terser/-/terser-4.2.0.tgz#4b1b5f4424b426a7a47e80d6aae45e0d7979aef0"
|
resolved "https://registry.yarnpkg.com/terser/-/terser-4.2.0.tgz#4b1b5f4424b426a7a47e80d6aae45e0d7979aef0"
|
||||||
|
@ -16725,7 +16733,7 @@ terser@^4.6.3:
|
||||||
source-map "~0.6.1"
|
source-map "~0.6.1"
|
||||||
source-map-support "~0.5.12"
|
source-map-support "~0.5.12"
|
||||||
|
|
||||||
terser@^5.5.1:
|
terser@^5.3.8, terser@^5.5.1:
|
||||||
version "5.6.1"
|
version "5.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/terser/-/terser-5.6.1.tgz#a48eeac5300c0a09b36854bf90d9c26fb201973c"
|
resolved "https://registry.yarnpkg.com/terser/-/terser-5.6.1.tgz#a48eeac5300c0a09b36854bf90d9c26fb201973c"
|
||||||
integrity sha512-yv9YLFQQ+3ZqgWCUk+pvNJwgUTdlIxUk1WTN+RnaFJe2L7ipG2csPT0ra2XRm7Cs8cxN7QXmK1rFzEwYEQkzXw==
|
integrity sha512-yv9YLFQQ+3ZqgWCUk+pvNJwgUTdlIxUk1WTN+RnaFJe2L7ipG2csPT0ra2XRm7Cs8cxN7QXmK1rFzEwYEQkzXw==
|
||||||
|
@ -17744,7 +17752,7 @@ webpack-sources@^2.1.1:
|
||||||
source-list-map "^2.0.1"
|
source-list-map "^2.0.1"
|
||||||
source-map "^0.6.1"
|
source-map "^0.6.1"
|
||||||
|
|
||||||
webpack@5.30.0:
|
webpack@5.30.0, webpack@^5.1.0:
|
||||||
version "5.30.0"
|
version "5.30.0"
|
||||||
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.30.0.tgz#07d87c182a060e0c2491062f3dc0edc85a29d884"
|
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.30.0.tgz#07d87c182a060e0c2491062f3dc0edc85a29d884"
|
||||||
integrity sha512-Zr9NIri5yzpfmaMea2lSMV1UygbW0zQsSlGLMgKUm63ACXg6alhd1u4v5UBSBjzYKXJN6BNMGVM7w165e7NxYA==
|
integrity sha512-Zr9NIri5yzpfmaMea2lSMV1UygbW0zQsSlGLMgKUm63ACXg6alhd1u4v5UBSBjzYKXJN6BNMGVM7w165e7NxYA==
|
||||||
|
|
Loading…
Reference in a new issue