Skip to content

Commit

Permalink
Build - refactor for bundle factoring and swappable runtime (#11080)
Browse files Browse the repository at this point in the history
* wip

* build - breakout sentry-install bundle

* deps - move new build sys deps to published versions

* chore: lint fix

* clean - remove unused file

* clean - remove unsused package script

* lavamoat - update build system policy

* build - render html to all platforms

* development - improve sourcemap debugger output

* deps - update lavapack

* lint - fix

* deps - update lavapack for bugfix

* deps - update lavapack for bugfix

* deps - bump lavapack for line ending normalization

* sourcemap explorer - disable boundary validation

* ci - reset normal ci flow

* build - re-enable minification on prod

* build - remove noisy log about html dest

* build - update terser and remove gulp wrapper for sourcemap fix

* Revert "sourcemap explorer - disable boundary validation"

This reverts commit 9411220.

* build - reenable react-devtools in dev mode

* wip

* build - breakout sentry-install bundle

* deps - move new build sys deps to published versions

* chore: lint fix

* clean - remove unused file

* clean - remove unsused package script

* lavamoat - update build system policy

* build - render html to all platforms

* development - improve sourcemap debugger output

* deps - update lavapack

* lint - fix

* deps - update lavapack for bugfix

* deps - update lavapack for bugfix

* deps - bump lavapack for line ending normalization

* sourcemap explorer - disable boundary validation

* ci - reset normal ci flow

* build - re-enable minification on prod

* build - remove noisy log about html dest

* build - update terser and remove gulp wrapper for sourcemap fix

* Revert "sourcemap explorer - disable boundary validation"

This reverts commit 9411220.

* build - reenable react-devtools in dev mode

* Updating lockfile

* lint fix

* build/dev - patch watchifys incompatible binary stats output

* ui - add comment about conditional import

* build - improve comment

* Update development/stream-flat-map.js

Co-authored-by: Brad Decker <[email protected]>

* Outputting all bundle file links (metamaskbot)

Co-authored-by: ryanml <[email protected]>
Co-authored-by: Brad Decker <[email protected]>
  • Loading branch information
3 people authored Jul 15, 2021
1 parent 4aab488 commit 9f4820e
Show file tree
Hide file tree
Showing 23 changed files with 573 additions and 459 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ module.exports = {
'babel.config.js',
'nyc.config.js',
'stylelint.config.js',
'app/scripts/runLockdown.js',
'app/scripts/lockdown-run.js',
'development/**/*.js',
'test/e2e/**/*.js',
'test/lib/wait-until-called.js',
Expand Down
12 changes: 7 additions & 5 deletions app/background.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
</head>
<body>
<script src="./globalthis.js" type="text/javascript" charset="utf-8"></script>
<script src="./initSentry.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./runLockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./bg-libs.js" type="text/javascript" charset="utf-8"></script>
<script src="./background.js" type="text/javascript" charset="utf-8"></script>
<script src="./sentry-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-run.js" type="text/javascript" charset="utf-8"></script>
<script src="./runtime-cjs.js" type="text/javascript" charset="utf-8"></script>
{{@each(it.jsBundles) => val}}
<script src="{{val}}" type="text/javascript" charset="utf-8"></script>
{{/each}}
<script src="./chromereload.js" type="text/javascript" charset="utf-8"></script>
</body>
</html>
12 changes: 7 additions & 5 deletions app/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
<div id="app-content"></div>
<div id="popover-content"></div>
<script src="./globalthis.js" type="text/javascript" charset="utf-8"></script>
<script src="./initSentry.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./runLockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./ui-libs.js" type="text/javascript" charset="utf-8"></script>
<script src="./ui.js" type="text/javascript" charset="utf-8"></script>
<script src="./sentry-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-run.js" type="text/javascript" charset="utf-8"></script>
<script src="./runtime-cjs.js" type="text/javascript" charset="utf-8"></script>
{{@each(it.jsBundles) => val}}
<script src="{{val}}" type="text/javascript" charset="utf-8"></script>
{{/each}}
</body>
</html>
4 changes: 2 additions & 2 deletions app/manifest/_base.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"js": [
"disable-console.js",
"globalthis.js",
"lockdown.js",
"runLockdown.js",
"lockdown-install.js",
"lockdown-run.js",
"contentscript.js"
],
"run_at": "document_start",
Expand Down
12 changes: 7 additions & 5 deletions app/notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@
</div>
<div id="popover-content"></div>
<script src="./globalthis.js" type="text/javascript" charset="utf-8"></script>
<script src="./initSentry.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./runLockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./ui-libs.js" type="text/javascript" charset="utf-8"></script>
<script src="./ui.js" type="text/javascript" charset="utf-8"></script>
<script src="./sentry-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-run.js" type="text/javascript" charset="utf-8"></script>
<script src="./runtime-cjs.js" type="text/javascript" charset="utf-8"></script>
{{@each(it.jsBundles) => val}}
<script src="{{val}}" type="text/javascript" charset="utf-8"></script>
{{/each}}
</body>
</html>
4 changes: 2 additions & 2 deletions app/phishing.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<head>
<title>Ethereum Phishing Detection - MetaMask</title>
<script src="./globalthis.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./runLockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-run.js" type="text/javascript" charset="utf-8"></script>
<script src="./phishing-detect.js"></script>
<link rel="stylesheet" type="text/css" href="./index.css" title="ltr">
<link rel="stylesheet" type="text/css" href="./index-rtl.css" title="rtl" disabled>
Expand Down
12 changes: 7 additions & 5 deletions app/popup.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
<div id="app-content"></div>
<div id="popover-content"></div>
<script src="./globalthis.js" type="text/javascript" charset="utf-8"></script>
<script src="./initSentry.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./runLockdown.js" type="text/javascript" charset="utf-8"></script>
<script src="./ui-libs.js" type="text/javascript" charset="utf-8"></script>
<script src="./ui.js" type="text/javascript" charset="utf-8"></script>
<script src="./sentry-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-install.js" type="text/javascript" charset="utf-8"></script>
<script src="./lockdown-run.js" type="text/javascript" charset="utf-8"></script>
<script src="./runtime-cjs.js" type="text/javascript" charset="utf-8"></script>
{{@each(it.jsBundles) => val}}
<script src="{{val}}" type="text/javascript" charset="utf-8"></script>
{{/each}}
</body>
</html>
4 changes: 2 additions & 2 deletions app/scripts/runLockdown.js → app/scripts/lockdown-run.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ try {
// caught and logged here so that the contentscript still gets injected.
// This affects Firefox v56 and Waterfox Classic
console.error('Lockdown failed:', error);
if (window.sentry && window.sentry.captureException) {
window.sentry.captureException(error);
if (globalThis.sentry && globalThis.sentry.captureException) {
globalThis.sentry.captureException(error);
}
}
File renamed without changes.
3 changes: 3 additions & 0 deletions app/scripts/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
import 'abortcontroller-polyfill/dist/polyfill-patch-fetch';
import '@formatjs/intl-relativetimeformat/polyfill';

// dev only, "react-devtools" import is skipped in prod builds
import 'react-devtools';

import PortStream from 'extension-port-stream';
import extension from 'extensionizer';

Expand Down
Loading

0 comments on commit 9f4820e

Please sign in to comment.