From ef3b8915d895d59ea4878137d5b4280056ca912b Mon Sep 17 00:00:00 2001 From: Alexis Svinartchouk Date: Fri, 13 Nov 2020 18:05:27 +0100 Subject: [PATCH] Update etcher-sdk to 5.1.2 Change-type: patch --- npm-shrinkwrap.json | 51 +++++++++++++++++++++------------------------ package.json | 2 +- webpack.config.ts | 40 +++++++++++++++++++++++------------ 3 files changed, 52 insertions(+), 41 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index f8dff00d..3d3b8ad7 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1360,6 +1360,12 @@ } } }, + "@balena/node-crc-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@balena/node-crc-utils/-/node-crc-utils-2.0.0.tgz", + "integrity": "sha512-u86QDMtkpHLlvehs3Z+yHklXRhDPL5XGCO3BCSuaD61gKzrNDUIj03cz8T/PBPPUJqn7DfWkf9sKP9VwlvxKuw==", + "dev": true + }, "@balena/udif": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@balena/udif/-/udif-1.1.0.tgz", @@ -7351,9 +7357,9 @@ "dev": true }, "etcher-sdk": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/etcher-sdk/-/etcher-sdk-5.1.1.tgz", - "integrity": "sha512-N23KjuPbE3D1NX0qc+JSxdcWCALP1LAF3AJThZcbHjvQIHVSNf7PvaWfykZ8HmWSxIjiIK8V1Alimf8CYrk2+g==", + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/etcher-sdk/-/etcher-sdk-5.1.2.tgz", + "integrity": "sha512-N08WjvgG4NMF91hkh0vYmSurMptA/ee1ddEIFanY5OHp4GluFJ8+wy/564CDn7NeuLq90yLmdWuL1sXOzoPzMw==", "dev": true, "requires": { "@balena/udif": "^1.1.0", @@ -7368,7 +7374,7 @@ "drivelist": "^9.1.0", "file-disk": "^8.0.0", "file-type": "^8.0.0", - "gzip-stream": "^1.1.0", + "gzip-stream": "^1.1.1", "lzma-native": "^6.0.0", "mountutils": "^1.3.18", "node-raspberrypi-usbboot": "^0.2.9", @@ -7380,7 +7386,7 @@ "unzip-stream": "^0.3.0", "xxhash": "^0.3.0", "yauzl": "^2.9.2", - "zip-part-stream": "^1.0.1" + "zip-part-stream": "^1.0.2" }, "dependencies": { "debug": { @@ -8507,14 +8513,14 @@ "dev": true }, "gzip-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/gzip-stream/-/gzip-stream-1.1.0.tgz", - "integrity": "sha512-NsYAyiXQB2cBoy6qWRt0l8RHhafych/e1wlFpD8DA5pAD7aOvRH+PEHnznfp8ALvXVuJ1LNvwqoCRXcZGzs2xg==", + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/gzip-stream/-/gzip-stream-1.1.1.tgz", + "integrity": "sha512-V4FlTwvLpd5ZPcIjUODt/NrP+yhX6pKNzKYahrcSo6WLeLz5Rvlta00DZ3D13YL7QeOC3D7IYPUGKeuN3x9cEg==", "dev": true, "requires": { + "@balena/node-crc-utils": "^2.0.0", "combined-stream": "^1.0.8", - "crc32-stream": "^4.0.0", - "resin-crc-utils": "^1.0.3" + "crc32-stream": "^4.0.0" } }, "har-schema": { @@ -11507,9 +11513,9 @@ } }, "node-abi": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.18.0.tgz", - "integrity": "sha512-yi05ZoiuNNEbyT/xXfSySZE+yVnQW6fxPZuFbLyS1s6b5Kw3HzV2PHOM4XR+nsjzkHxByK+2Wg+yCQbe35l8dw==", + "version": "2.19.1", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-2.19.1.tgz", + "integrity": "sha512-HbtmIuByq44yhAzK7b9j/FelKlHYISKQn0mtvcBrU5QBkhoCMp5bu8Hv5AI34DcKfOAcJBcOEMwLlwO62FFu9A==", "dev": true, "requires": { "semver": "^5.4.1" @@ -13716,15 +13722,6 @@ "raven-js": "^3.19.1" } }, - "resin-crc-utils": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/resin-crc-utils/-/resin-crc-utils-1.0.3.tgz", - "integrity": "sha512-G5uLoRyZmurm6Lub0p7fPrkc5BzmTIpsXuTlIr6yII1QD4xDyM+Nx5nhn8uqbz1rpHBIvImwhVc3nnioKHc0sw==", - "dev": true, - "requires": { - "nan": "^2.14.0" - } - }, "resize-observer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/resize-observer/-/resize-observer-1.0.0.tgz", @@ -17471,14 +17468,14 @@ "dev": true }, "zip-part-stream": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/zip-part-stream/-/zip-part-stream-1.0.1.tgz", - "integrity": "sha512-WNgc3+GaH0x+G4HotQbDNAfnRQdnn3HFnQOAUN5EVioXlD4zFH42smklvU5LG7VpCbkil1uDSm20rc/6L5J8ZA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/zip-part-stream/-/zip-part-stream-1.0.2.tgz", + "integrity": "sha512-2dxIug2ydhnpv1YGRuU7muTpxx4+hoLaQoVwfysaRzWF1GV2s5BDqlTuiQQda/vdfMtKYIamSJffps+0n4QJsw==", "dev": true, "requires": { + "@balena/node-crc-utils": "^2.0.0", "combined-stream": "^1.0.8", - "crc32-stream": "^4.0.0", - "resin-crc-utils": "^1.0.3" + "crc32-stream": "^4.0.0" } }, "zip-stream": { diff --git a/package.json b/package.json index 6949c2ed..05916133 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,7 @@ "electron-notarize": "^1.0.0", "electron-rebuild": "^2.3.2", "electron-updater": "^4.3.5", - "etcher-sdk": "^5.1.1", + "etcher-sdk": "^5.1.2", "file-loader": "^6.0.0", "husky": "^4.2.5", "immutable": "^3.8.1", diff --git a/webpack.config.ts b/webpack.config.ts index bf12898e..0295cd46 100644 --- a/webpack.config.ts +++ b/webpack.config.ts @@ -108,6 +108,23 @@ function replace(test: RegExp, ...replacements: ReplacementRule[]) { }; } +function fetchWasm(...where: string[]) { + const whereStr = where.map((x) => `'${x}'`).join(', '); + return outdent` + const Path = require('path'); + let electron; + try { + // This doesn't exist in the child-writer + electron = require('electron'); + } catch { + } + function appPath() { + return Path.isAbsolute(__dirname) ? __dirname : Path.join(electron.remote.app.getAppPath(), 'generated'); + } + scriptDirectory = Path.join(appPath(), 'modules', ${whereStr}, '/'); + `; +} + const commonConfig = { mode: 'production', optimization: { @@ -232,19 +249,12 @@ const commonConfig = { // We use __dirname in the child-writer and electron.remote.app.getAppPath() in the renderer replace(/node_modules\/ext2fs\/lib\/libext2fs\.js$/, { search: 'scriptDirectory=__dirname+"/"', - replace: outdent` - const Path = require('path'); - let electron; - try { - // This doesn't exist in the child-writer - electron = require('electron'); - } catch { - } - function appPath() { - return Path.isAbsolute(__dirname) ? __dirname : Path.join(electron.remote.app.getAppPath(), 'generated'); - } - scriptDirectory = Path.join(appPath(), 'modules', 'ext2fs', 'lib', '/'); - `, + replace: fetchWasm('ext2fs', 'lib'), + }), + // Same for node-crc-utils + replace(/node_modules\/@balena\/node-crc-utils\/crc32\.js$/, { + search: 'scriptDirectory=__dirname+"/"', + replace: fetchWasm('@balena', 'node-crc-utils'), }), // Copy native modules to generated folder { @@ -299,6 +309,10 @@ const guiConfigCopyPatterns = [ from: 'node_modules/ext2fs/lib/libext2fs.wasm', to: 'modules/ext2fs/lib/libext2fs.wasm', }, + { + from: 'node_modules/@balena/node-crc-utils/crc32.wasm', + to: 'modules/@balena/node-crc-utils/crc32.wasm', + }, ]; if (os.platform() === 'win32') {