Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions development/build/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions development/build/static.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion development/sourcemap-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async function start() {
`common-0.js`,
`background-0.js`,
`ui-0.js`,
'phishing-detect-0.js',
rekmarks marked this conversation as resolved.
Show resolved Hide resolved
'phishing-detect.js',
// `contentscript.js`, skipped because the validator is erroneously sampling the inlined `inpage.js` script
`inpage.js`,
];
Expand Down