1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-22 01:47:00 +01:00

Using a normal bundle instead of a factored bundle for phishing-detect (build sys) (#11972)

This commit is contained in:
ryanml 2021-08-30 20:58:50 -07:00 committed by GitHub
parent 290fcbf89e
commit 4b4303c108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 11 deletions

View File

@ -74,12 +74,7 @@ function createScriptTasks({ browserPlatforms, livereload }) {
return { dev, test, testDev, prod };
function createTasksForBuildJsExtension({ taskPrefix, devMode, testing }) {
const standardEntryPoints = [
'background',
'ui',
'phishing-detect',
'content-script',
];
const standardEntryPoints = ['background', 'ui', 'content-script'];
const standardSubtask = createTask(
`${taskPrefix}:standardEntryPoints`,
createFactoredBuild({
@ -114,6 +109,11 @@ function createScriptTasks({ browserPlatforms, livereload }) {
createTaskForBundleSentry({ devMode }),
);
const phishingDetectSubtask = createTask(
`${taskPrefix}:phishing-detect`,
createTaskForBundlePhishingDetect({ devMode }),
);
// task for initiating browser livereload
const initiateLiveReload = async () => {
if (devMode) {
@ -136,6 +136,7 @@ function createScriptTasks({ browserPlatforms, livereload }) {
contentscriptSubtask,
disableConsoleSubtask,
installSentrySubtask,
phishingDetectSubtask,
].map((subtask) => runInChildProcess(subtask));
// make a parent task that runs each task in a child thread
return composeParallel(initiateLiveReload, ...allSubtasks);
@ -163,6 +164,17 @@ function createScriptTasks({ browserPlatforms, livereload }) {
});
}
function createTaskForBundlePhishingDetect({ devMode }) {
const label = 'phishing-detect';
return createNormalBundle({
label,
entryFilepath: `./app/scripts/${label}.js`,
destFilepath: `${label}.js`,
devMode,
browserPlatforms,
});
}
// the "contentscript" bundle contains the "inpage" bundle
function createTaskForBundleContentscript({ devMode, testing }) {
const inpage = 'inpage';
@ -277,10 +289,6 @@ function createFactoredBuild({
renderHtmlFile('home', groupSet, commonSet, browserPlatforms);
break;
}
case 'phishing-detect': {
renderHtmlFile('phishing', groupSet, commonSet, browserPlatforms);
break;
}
case 'background': {
renderHtmlFile('background', groupSet, commonSet, browserPlatforms);
break;

View File

@ -137,6 +137,10 @@ function getCopyTargets(shouldIncludeLockdown) {
src: require.resolve('@lavamoat/lavapack/src/runtime-cjs.js'),
dest: `runtime-cjs.js`,
},
{
src: `./app/phishing.html`,
dest: `phishing.html`,
},
];
const languageTags = new Set();

View File

@ -24,7 +24,7 @@ async function start() {
`common-0.js`,
`background-0.js`,
`ui-0.js`,
'phishing-detect-0.js',
'phishing-detect.js',
// `contentscript.js`, skipped because the validator is erroneously sampling the inlined `inpage.js` script
`inpage.js`,
];