Merge pull request #4211 from balena-io/fix-url-loading

patch: bump etcher-sdk to 9.0.11 to fix url loading using http/2
This commit is contained in:
flowzone-app[bot] 2024-04-26 13:24:43 +00:00 committed by GitHub
commit c5a8bfc0dc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7982 additions and 27435 deletions

35380
npm-shrinkwrap.json generated

File diff suppressed because it is too large Load Diff

View File

@ -40,7 +40,7 @@
"drivelist": "^12.0.2",
"electron-squirrel-startup": "^1.0.0",
"electron-updater": "6.1.8",
"etcher-sdk": "9.0.9",
"etcher-sdk": "9.0.11",
"i18next": "23.11.2",
"immutable": "3.8.2",
"lodash": "4.17.21",

View File

@ -17,29 +17,7 @@
import type { Configuration, ModuleOptions } from 'webpack';
import { resolve } from 'path';
import {
BannerPlugin,
IgnorePlugin,
NormalModuleReplacementPlugin,
} from 'webpack';
interface ReplacementRule {
search: string;
replace: string | (() => string);
}
function slashOrAntislash(pattern: RegExp): RegExp {
return new RegExp(pattern.source.replace(/\\\//g, '(\\/|\\\\)'));
}
function replace(test: RegExp, ...replacements: ReplacementRule[]) {
return {
loader: 'string-replace-loader',
// Handle windows path separators
test: slashOrAntislash(test),
options: { multiple: replacements.map((r) => ({ ...r, strict: true })) },
};
}
import { BannerPlugin, IgnorePlugin } from 'webpack';
const rules: Required<ModuleOptions>['rules'] = [
// Add support for native node modules
@ -81,11 +59,6 @@ const rules: Required<ModuleOptions>['rules'] = [
test: /\.svg$/,
use: '@svgr/webpack',
},
// force axios to use http backend (not xhr) to support streams
replace(/node_modules\/axios\/lib\/defaults\.js$/, {
search: './adapters/xhr',
replace: './adapters/http',
}),
];
export const rendererConfig: Configuration = {
@ -93,12 +66,6 @@ export const rendererConfig: Configuration = {
rules,
},
plugins: [
// Force axios to use http.js, not xhr.js as we need stream support
// (its package.json file replaces http with xhr for browser targets).
new NormalModuleReplacementPlugin(
slashOrAntislash(/node_modules\/axios\/lib\/adapters\/xhr\.js/),
'./http.js',
),
// Ignore `aws-crt` which is a dependency of (ultimately) `aws4-axios` which is used
// by etcher-sdk and does a runtime check to its availability. Were not currently
// using the “assume role” functionality (AFAIU) of aws4-axios and we dont care that