Exclude files from builds by build type (#12521)

This PR enables the exclusion of JavaScript and JSON source by `buildType`, and enables the running of `eslint` under LavaMoat. 80-90% of the changes in this PR are `.patch` files and LavaMoat policy additions.

The file exclusion is designed to work in conjunction with our code fencing. If you forget to fence an import statement of an excluded file, the application will now error on boot. **This PR commits us to a particular naming convention for files intended only for certain builds.** Continue reading for details.

### Code Fencing and ESLint

When a file is modified by the code fencing transform, we run ESLint on it to ensure that we fail early for syntax-related issues. This PR adds the first code fences that will be actually be removed in production builds. As a consequence, this was also the first time we attempted to run ESLint under LavaMoat. Making that work required a lot of manual labor because of ESLint's use of dynamic imports, but the manual changes necessary were ultimately quite minor.

### File Exclusion

For all builds, any file in `app/`, `shared/` or `ui/` in a sub-directory matching `**/${otherBuildType}/**` (where `otherBuildType` is any build type except `main`) will be added to the list of excluded files, regardless of its file extension. For example, if we want to add one or more pages to the UI settings in Flask, we'd create the folder `ui/pages/settings/flask`, add any necessary files or sub-folders there, and fence the import statements for anything in that folder. If we wanted the same thing for Beta, we would name the directory `ui/pages/settings/beta`.

As it happens, we already organize some of our source files in this way, namely the logo JSON for Beta and Flask builds. See `ui/helpers/utils/build-types.js` to see how this works in practice.

Because the list of ignored filed is only passed to `browserify.exclude()`, any files not bundled by `browserify` will be ignored. For our purposes, this is mostly relevant for `.scss`. Since we don't have anything like code fencing for SCSS, we'll have to consider how to handle our styles separately.
feature/default_network_editable
Erik Marks 3 years ago committed by GitHub
parent 0c229e2d4a
commit a2d3d942ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      .eslintrc.js
  2. 53
      development/build/index.js
  3. 42
      development/build/scripts.js
  4. 16
      development/build/transforms/utils.js
  5. 36
      lavamoat/node/policy-override.json
  6. 541
      lavamoat/node/policy.json
  7. 2
      package.json
  8. 21
      patches/@eslint+eslintrc+0.4.0.patch
  9. 13
      patches/eslint+7.23.0.patch
  10. 23
      patches/object.values+1.1.1.patch
  11. 12
      ui/helpers/utils/build-types.js
  12. 2
      yarn.lock

@ -1,3 +1,5 @@
const { version: reactVersion } = require('react/package.json');
module.exports = {
root: true,
parser: '@babel/eslint-parser',
@ -213,7 +215,12 @@ module.exports = {
settings: {
react: {
version: 'detect',
// If this is set to 'detect', ESLint will import React in order to find
// its version. Because we run ESLint in the build system under LavaMoat,
// this means that detecting the React version requires a LavaMoat policy
// for all of React, in the build system. That's a no-go, so we grab it
// from React's package.json.
version: reactVersion,
},
},
};

@ -3,8 +3,10 @@
//
// run any task with "yarn build ${taskName}"
//
const path = require('path');
const livereload = require('gulp-livereload');
const minimist = require('minimist');
const { sync: globby } = require('globby');
const {
createTask,
composeSeries,
@ -18,7 +20,8 @@ const createStaticAssetTasks = require('./static');
const createEtcTasks = require('./etc');
const { BuildType, getBrowserVersionMap } = require('./utils');
// packages required dynamically via browserify configuration in dependencies
// Packages required dynamically via browserify configuration in dependencies
// Required for LavaMoat policy generation
require('loose-envify');
require('@babel/plugin-proposal-object-rest-spread');
require('@babel/plugin-transform-runtime');
@ -28,6 +31,19 @@ require('@babel/plugin-proposal-nullish-coalescing-operator');
require('@babel/preset-env');
require('@babel/preset-react');
require('@babel/core');
// ESLint-related
require('@babel/eslint-parser');
require('@babel/eslint-plugin');
require('@metamask/eslint-config');
require('@metamask/eslint-config-nodejs');
require('eslint');
require('eslint-config-prettier');
require('eslint-import-resolver-node');
require('eslint-plugin-import');
require('eslint-plugin-node');
require('eslint-plugin-prettier');
require('eslint-plugin-react');
require('eslint-plugin-react-hooks');
defineAndRunBuildTasks();
@ -45,6 +61,8 @@ function defineAndRunBuildTasks() {
const browserVersionMap = getBrowserVersionMap(browserPlatforms);
const ignoredFiles = getIgnoredFiles(buildType);
const staticTasks = createStaticAssetTasks({
livereload,
browserPlatforms,
@ -63,6 +81,7 @@ function defineAndRunBuildTasks() {
const scriptTasks = createScriptTasks({
browserPlatforms,
buildType,
ignoredFiles,
isLavaMoat,
livereload,
shouldLintFenceFiles,
@ -188,3 +207,35 @@ function parseArgv() {
skipStats: argv[NamedArgs.SkipStats],
};
}
/**
* Gets the files to be ignored by the current build, if any.
*
* @param {string} buildType - The type of the current build.
* @returns {string[] | null} The array of files to be ignored by the current
* build, or `null` if no files are to be ignored.
*/
function getIgnoredFiles(currentBuildType) {
const excludedFiles = Object.values(BuildType)
// This filter removes "main" and the current build type. The files of any
// build types that remain in the array will be excluded. "main" is the
// default build type, and has no files that are excluded from other builds.
.filter(
(buildType) =>
buildType !== BuildType.main && buildType !== currentBuildType,
)
// Compute globs targeting files for exclusion for each excluded build
// type.
.reduce((excludedGlobs, excludedBuildType) => {
return excludedGlobs.concat([
`../../app/**/${excludedBuildType}/**`,
`../../shared/**/${excludedBuildType}/**`,
`../../ui/**/${excludedBuildType}/**`,
]);
}, [])
// This creates absolute paths of the form:
// PATH_TO_REPOSITORY_ROOT/app/**/${excludedBuildType}/**
.map((pathGlob) => path.resolve(__dirname, pathGlob));
return globby(excludedFiles);
}

@ -138,6 +138,7 @@ module.exports = createScriptTasks;
function createScriptTasks({
browserPlatforms,
buildType,
ignoredFiles,
isLavaMoat,
livereload,
shouldLintFenceFiles,
@ -182,8 +183,9 @@ function createScriptTasks({
}
return `./app/scripts/${label}.js`;
}),
testing,
ignoredFiles,
shouldLintFenceFiles,
testing,
}),
);
@ -253,6 +255,7 @@ function createScriptTasks({
destFilepath: `${label}.js`,
devMode,
entryFilepath: `./app/scripts/${label}.js`,
ignoredFiles,
label,
shouldLintFenceFiles,
});
@ -266,6 +269,7 @@ function createScriptTasks({
destFilepath: `${label}.js`,
devMode,
entryFilepath: `./app/scripts/${label}.js`,
ignoredFiles,
label,
shouldLintFenceFiles,
});
@ -279,6 +283,7 @@ function createScriptTasks({
destFilepath: `${label}.js`,
devMode,
entryFilepath: `./app/scripts/${label}.js`,
ignoredFiles,
label,
shouldLintFenceFiles,
});
@ -296,8 +301,9 @@ function createScriptTasks({
devMode,
entryFilepath: `./app/scripts/${inpage}.js`,
label: inpage,
testing,
ignoredFiles,
shouldLintFenceFiles,
testing,
}),
createNormalBundle({
buildType,
@ -306,8 +312,9 @@ function createScriptTasks({
devMode,
entryFilepath: `./app/scripts/${contentscript}.js`,
label: contentscript,
testing,
ignoredFiles,
shouldLintFenceFiles,
testing,
}),
);
}
@ -318,8 +325,9 @@ function createFactoredBuild({
buildType,
devMode,
entryFiles,
testing,
ignoredFiles,
shouldLintFenceFiles,
testing,
}) {
return async function () {
// create bundler setup and apply defaults
@ -336,6 +344,7 @@ function createFactoredBuild({
buildType,
devMode,
envVars,
ignoredFiles,
minify,
reloadOnChange,
shouldLintFenceFiles,
@ -480,6 +489,7 @@ function createNormalBundle({
devMode,
entryFilepath,
extraEntries = [],
ignoredFiles,
label,
modulesToExpose,
shouldLintFenceFiles,
@ -500,6 +510,7 @@ function createNormalBundle({
buildType,
devMode,
envVars,
ignoredFiles,
minify,
reloadOnChange,
shouldLintFenceFiles,
@ -544,12 +555,20 @@ function createBuildConfiguration() {
manualExternal: [],
manualIgnore: [],
};
return { label, bundlerOpts, events };
return { bundlerOpts, events, label };
}
function setupBundlerDefaults(
buildConfiguration,
{ buildType, devMode, envVars, minify, reloadOnChange, shouldLintFenceFiles },
{
buildType,
devMode,
envVars,
ignoredFiles,
minify,
reloadOnChange,
shouldLintFenceFiles,
},
) {
const { bundlerOpts } = buildConfiguration;
@ -579,6 +598,11 @@ function setupBundlerDefaults(
bundlerOpts.transform.push([envify(envVars), { global: true }]);
}
// Ensure that any files that should be ignored are excluded from the build
if (ignoredFiles) {
bundlerOpts.manualExclude = ignoredFiles;
}
// Setup reload on change
if (reloadOnChange) {
setupReloadOnChange(buildConfiguration);
@ -661,11 +685,17 @@ function setupSourcemaps(buildConfiguration, { devMode }) {
async function bundleIt(buildConfiguration) {
const { label, bundlerOpts, events } = buildConfiguration;
const bundler = browserify(bundlerOpts);
// manually apply non-standard options
bundler.external(bundlerOpts.manualExternal);
bundler.ignore(bundlerOpts.manualIgnore);
if (Array.isArray(bundlerOpts.manualExclude)) {
bundler.exclude(bundlerOpts.manualExclude);
}
// output build logs to terminal
bundler.on('log', log);
// forward update event (used by watchify)
bundler.on('update', () => performBundle());

@ -1,6 +1,22 @@
const { ESLint } = require('eslint');
const eslintrc = require('../../../.eslintrc.js');
// We don't want linting to fail for purely stylistic reasons.
eslintrc.rules['prettier/prettier'] = 'off';
// Remove all test-related overrides. We will never lint test files here.
eslintrc.overrides = eslintrc.overrides.filter((override) => {
return !(
(override.extends &&
override.extends.find(
(configName) =>
configName.includes('jest') || configName.includes('mocha'),
)) ||
(override.plugins &&
override.plugins.find((pluginName) => pluginName.includes('jest')))
);
});
/**
* The singleton ESLint instance.
*

@ -1,13 +1,5 @@
{
"resources": {
"node-sass": {
"native": true
},
"module-deps": {
"packages": {
"loose-envify": true
}
},
"@babel/core": {
"packages": {
"<root>": true,
@ -20,6 +12,34 @@
"@babel/plugin-proposal-nullish-coalescing-operator": true
}
},
"@eslint/eslintrc": {
"packages": {
"@babel/eslint-parser": true,
"@babel/eslint-plugin": true,
"@metamask/eslint-config": true,
"@metamask/eslint-config-nodejs": true,
"eslint": true,
"eslint-config-prettier": true,
"eslint-plugin-import": true,
"eslint-plugin-node": true,
"eslint-plugin-prettier": true,
"eslint-plugin-react": true,
"eslint-plugin-react-hooks": true
}
},
"eslint-module-utils": {
"packages": {
"eslint-import-resolver-node": true
}
},
"node-sass": {
"native": true
},
"module-deps": {
"packages": {
"loose-envify": true
}
},
"sass": {
"env": "unfrozen",
"builtin": {

@ -41,6 +41,20 @@
"source-map": true
}
},
"@babel/eslint-parser": {
"packages": {
"@babel/core": true,
"eslint-scope": true,
"eslint-visitor-keys": true,
"semver": true
}
},
"@babel/eslint-plugin": {
"packages": {
"eslint": true,
"eslint-rule-composer": true
}
},
"@babel/generator": {
"globals": {
"console.error": true
@ -815,7 +829,6 @@
"espree": true,
"globals": true,
"ignore": true,
"import-fresh": true,
"js-yaml": true,
"minimatch": true,
"strip-json-comments": true
@ -1038,6 +1051,15 @@
"make-iterator": true
}
},
"array-includes": {
"packages": {
"call-bind": true,
"define-properties": true,
"es-abstract": true,
"get-intrinsic": true,
"is-string": true
}
},
"array-initial": {
"packages": {
"array-slice": true,
@ -1054,6 +1076,19 @@
"array-uniq": true
}
},
"array.prototype.flat": {
"packages": {
"define-properties": true,
"es-abstract": true
}
},
"array.prototype.flatmap": {
"packages": {
"call-bind": true,
"define-properties": true,
"es-abstract": true
}
},
"async-done": {
"builtin": {
"domain.create": true
@ -1340,6 +1375,12 @@
"process.cwd": true
}
},
"call-bind": {
"packages": {
"function-bind": true,
"get-intrinsic": true
}
},
"chalk": {
"globals": {
"process.env.TERM": true,
@ -1491,6 +1532,11 @@
"typedarray": true
}
},
"contains-path": {
"builtin": {
"path.normalize": true
}
},
"convert-source-map": {
"builtin": {
"fs.readFileSync": true,
@ -1679,7 +1725,8 @@
"assert": true
},
"packages": {
"esutils": true
"esutils": true,
"isarray": true
}
},
"dom-serializer": {
@ -1753,9 +1800,22 @@
"WeakRef": true
},
"packages": {
"call-bind": true,
"es-to-primitive": true,
"function-bind": true,
"get-intrinsic": true,
"has": true,
"has-symbols": true
"has-symbols": true,
"is-callable": true,
"is-regex": true,
"object-inspect": true
}
},
"es-to-primitive": {
"packages": {
"is-callable": true,
"is-date-object": true,
"is-symbol": true
}
},
"es5-ext": {
@ -1866,6 +1926,141 @@
"regexpp": true
}
},
"eslint-config-prettier": {
"globals": {
"process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED": true
}
},
"eslint-import-resolver-node": {
"builtin": {
"path.dirname": true,
"path.resolve": true
},
"packages": {
"debug": true,
"resolve": true
}
},
"eslint-module-utils": {
"builtin": {
"crypto.createHash": true,
"fs.existsSync": true,
"fs.readdirSync": true,
"module": true,
"path.dirname": true,
"path.extname": true,
"path.join": true,
"path.parse": true,
"path.resolve": true
},
"globals": {
"__dirname": true,
"console.warn": true,
"process.cwd": true,
"process.hrtime": true
},
"packages": {
"debug": true,
"pkg-dir": true
}
},
"eslint-plugin-es": {
"packages": {
"eslint-utils": true,
"regexpp": true
}
},
"eslint-plugin-import": {
"builtin": {
"fs": true,
"path": true,
"vm": true
},
"globals": {
"process.cwd": true,
"process.env": true
},
"packages": {
"array-includes": true,
"array.prototype.flat": true,
"contains-path": true,
"debug": true,
"doctrine": true,
"eslint": true,
"eslint-module-utils": true,
"has": true,
"minimatch": true,
"object.values": true,
"read-pkg-up": true,
"resolve": true,
"tsconfig-paths": true,
"typescript": true
}
},
"eslint-plugin-node": {
"builtin": {
"fs.readFileSync": true,
"fs.readdirSync": true,
"fs.statSync": true,
"path.basename": true,
"path.dirname": true,
"path.extname": true,
"path.isAbsolute": true,
"path.join": true,
"path.relative": true,
"path.resolve": true,
"path.sep": true
},
"globals": {
"process.cwd": true
},
"packages": {
"eslint-plugin-es": true,
"eslint-utils": true,
"ignore": true,
"minimatch": true,
"resolve": true,
"semver": true
}
},
"eslint-plugin-prettier": {
"packages": {
"prettier": true,
"prettier-linter-helpers": true
}
},
"eslint-plugin-react": {
"builtin": {
"fs.statSync": true,
"path.dirname": true,
"path.extname": true
},
"globals": {
"console.error": true,
"console.log": true,
"process.argv.join": true,
"process.cwd": true
},
"packages": {
"array-includes": true,
"array.prototype.flatmap": true,
"doctrine": true,
"has": true,
"jsx-ast-utils": true,
"minimatch": true,
"object.entries": true,
"object.fromentries": true,
"object.values": true,
"prop-types": true,
"resolve": true,
"string.prototype.matchall": true
}
},
"eslint-plugin-react-hooks": {
"globals": {
"process.env.NODE_ENV": true
}
},
"eslint-scope": {
"builtin": {
"assert": true
@ -2064,6 +2259,17 @@
"to-regex-range": true
}
},
"find-up": {
"builtin": {
"path.dirname": true,
"path.join": true,
"path.parse": true,
"path.resolve": true
},
"packages": {
"locate-path": true
}
},
"first-chunk-stream": {
"builtin": {
"util.inherits": true
@ -2234,6 +2440,18 @@
"assert.equal": true
}
},
"get-intrinsic": {
"globals": {
"AggregateError": true,
"FinalizationRegistry": true,
"WeakRef": true
},
"packages": {
"function-bind": true,
"has": true,
"has-symbols": true
}
},
"get-stream": {
"builtin": {
"stream.PassThrough": true
@ -2613,6 +2831,12 @@
"kind-of": true
}
},
"hosted-git-info": {
"builtin": {
"url.URL": true,
"url.parse": true
}
},
"htmlparser2": {
"builtin": {
"buffer.Buffer": true,
@ -2698,6 +2922,13 @@
"xtend": true
}
},
"internal-slot": {
"packages": {
"get-intrinsic": true,
"has": true,
"side-channel": true
}
},
"is-absolute": {
"packages": {
"is-relative": true,
@ -2723,6 +2954,11 @@
"binary-extensions": true
}
},
"is-callable": {
"globals": {
"document": true
}
},
"is-core-module": {
"globals": {
"process.versions": true
@ -2802,11 +3038,22 @@
"isobject": true
}
},
"is-regex": {
"packages": {
"call-bind": true,
"has-symbols": true
}
},
"is-relative": {
"packages": {
"is-unc-path": true
}
},
"is-symbol": {
"packages": {
"has-symbols": true
}
},
"is-unc-path": {
"packages": {
"unc-path-regex": true
@ -2872,6 +3119,14 @@
"Buffer": true
}
},
"jsx-ast-utils": {
"globals": {
"console.error": true
},
"packages": {
"object.assign": true
}
},
"just-debounce": {
"globals": {
"clearTimeout": true,
@ -2988,6 +3243,29 @@
"type-check": true
}
},
"load-json-file": {
"builtin": {
"path.relative": true
},
"packages": {
"graceful-fs": true,
"parse-json": true,
"pify": true,
"strip-bom": true
}
},
"locate-path": {
"builtin": {
"path.resolve": true
},
"globals": {
"process.cwd": true
},
"packages": {
"p-locate": true,
"path-exists": true
}
},
"lodash": {
"globals": {
"define": true
@ -3285,6 +3563,18 @@
"osenv": true
}
},
"normalize-package-data": {
"builtin": {
"url.parse": true,
"util.format": true
},
"packages": {
"hosted-git-info": true,
"resolve": true,
"semver": true,
"validate-npm-package-license": true
}
},
"normalize-path": {
"packages": {
"remove-trailing-separator": true
@ -3338,6 +3628,7 @@
},
"object.assign": {
"packages": {
"call-bind": true,
"define-properties": true,
"es-abstract": true,
"has-symbols": true,
@ -3352,6 +3643,21 @@
"isobject": true
}
},
"object.entries": {
"packages": {
"call-bind": true,
"define-properties": true,
"es-abstract": true,
"has": true
}
},
"object.fromentries": {
"packages": {
"call-bind": true,
"define-properties": true,
"es-abstract": true
}
},
"object.omit": {
"packages": {
"for-own": true,
@ -3369,6 +3675,14 @@
"make-iterator": true
}
},
"object.values": {
"packages": {
"call-bind": true,
"define-properties": true,
"es-abstract": true,
"has": true
}
},
"once": {
"packages": {
"wrappy": true
@ -3430,6 +3744,16 @@
"os-tmpdir": true
}
},
"p-limit": {
"packages": {
"p-try": true
}
},
"p-locate": {
"packages": {
"p-limit": true
}
},
"parent-module": {
"packages": {
"callsites": true
@ -3479,6 +3803,12 @@
"process.platform": true
}
},
"path-exists": {
"builtin": {
"fs.access": true,
"fs.accessSync": true
}
},
"path-is-absolute": {
"globals": {
"process.platform": true
@ -3519,6 +3849,9 @@
"builtin": {
"fs": true,
"util.promisify": true
},
"packages": {
"pify": true
}
},
"pause-stream": {
@ -3548,6 +3881,14 @@
"pinkie": true
}
},
"pkg-dir": {
"builtin": {
"path.dirname": true
},
"packages": {
"find-up": true
}
},
"plugin-error": {
"builtin": {
"util.inherits": true
@ -3634,11 +3975,62 @@
"postcss": true
}
},
"prettier": {
"builtin": {
"assert": true,
"events": true,
"fs": true,
"module": true,
"os": true,
"path": true,
"stream": true,
"tty": true,
"util": true
},
"globals": {
"Buffer": true,
"Intl": true,
"PerformanceObserver": true,
"WorkerGlobalScope": true,
"XMLHttpRequest": true,
"YAML_SILENCE_DEPRECATION_WARNINGS": true,
"YAML_SILENCE_WARNINGS": true,
"__dirname": true,
"__filename": true,
"atob": true,
"btoa": true,
"clearTimeout": true,
"console": true,
"define": true,
"document": true,
"localStorage": true,
"navigator": true,
"performance": true,
"process": true,
"setImmediate": true,
"setTimeout": true
}
},
"prettier-linter-helpers": {
"packages": {
"fast-diff": true
}
},
"process-nextick-args": {
"globals": {
"process": true
}
},
"prop-types": {
"globals": {
"console": true,
"process.env.NODE_ENV": true
},
"packages": {
"object-assign": true,
"react-is": true
}
},
"pump": {
"builtin": {
"fs": true
@ -3709,11 +4101,33 @@
"strip-json-comments": true
}
},
"react-is": {
"globals": {
"console": true,
"process.env.NODE_ENV": true
}
},
"read-only-stream": {
"packages": {
"readable-stream": true
}
},
"read-pkg": {
"builtin": {
"path.join": true
},
"packages": {
"load-json-file": true,
"normalize-package-data": true,
"path-type": true
}
},
"read-pkg-up": {
"packages": {
"find-up": true,
"read-pkg": true
}
},
"readable-stream": {
"builtin": {
"buffer.Buffer": true,
@ -3788,6 +4202,12 @@
"safe-regex": true
}
},
"regexp.prototype.flags": {
"packages": {
"call-bind": true,
"define-properties": true
}
},
"regexpu-core": {
"packages": {
"regenerate": true,
@ -4052,6 +4472,13 @@
"shebang-regex": true
}
},
"side-channel": {
"packages": {
"call-bind": true,
"get-intrinsic": true,
"object-inspect": true
}
},
"signal-exit": {
"builtin": {
"assert.equal": true,
@ -4130,6 +4557,22 @@
"urix": true
}
},
"source-map-support": {
"builtin": {
"fs": true,
"path.dirname": true,
"path.resolve": true
},
"globals": {
"XMLHttpRequest": true,
"console.error": true,
"process": true
},
"packages": {
"buffer-from": true,
"source-map": true
}
},
"source-map-url": {
"globals": {
"define": true
@ -4140,6 +4583,22 @@
"define": true
}
},
"spdx-correct": {
"packages": {
"spdx-license-ids": true
}
},
"spdx-expression-parse": {
"builtin": {
"fs.readFileSync": true,
"path.normalize": true
},
"globals": {
"console.log": true,
"process.argv.slice": true,
"process.exit": true
}
},
"specificity": {
"globals": {
"define": true
@ -4237,6 +4696,16 @@
"strip-ansi": true
}
},
"string.prototype.matchall": {
"packages": {
"call-bind": true,
"define-properties": true,
"es-abstract": true,
"has-symbols": true,
"internal-slot": true,
"regexp.prototype.flags": true
}
},
"string_decoder": {
"builtin": {
"buffer.Buffer": true
@ -4490,6 +4959,21 @@
"through2": true
}
},
"tsconfig-paths": {
"builtin": {
"fs.existsSync": true,
"fs.lstatSync": true,
"fs.readFileSync": true,
"fs.statSync": true,
"path.dirname": true,
"path.join": true,
"path.resolve": true
},
"packages": {
"json5": true,
"strip-bom": true
}
},
"type-check": {
"packages": {
"prelude-ls": true
@ -4503,6 +4987,51 @@
"is-typedarray": true
}
},
"typescript": {
"builtin": {
"buffer.Buffer": true,
"crypto": true,
"fs.closeSync": true,
"fs.mkdirSync": true,
"fs.openSync": true,
"fs.readFileSync": true,
"fs.readdirSync": true,
"fs.realpathSync": true,
"fs.statSync": true,
"fs.unlinkSync": true,
"fs.unwatchFile": true,
"fs.utimesSync": true,
"fs.watch": true,
"fs.watchFile": true,
"fs.writeFileSync": true,
"fs.writeSync": true,
"inspector": true,
"os.EOL": true,
"os.platform": true,
"path.dirname": true,
"path.join": true,
"path.resolve": true
},
"globals": {
"Intl": true,
"TypeScript": "write",
"__dirname": true,
"__filename": true,
"__magic__": true,
"clearTimeout": true,
"console.log": true,
"gc": true,
"globalThis": "write",
"onProfilerEvent": true,
"performance": true,
"process": true,
"setTimeout": true,
"toolsVersion": "write"
},
"packages": {
"source-map-support": true
}
},
"undeclared-identifiers": {
"packages": {
"acorn-node": true,
@ -4620,6 +5149,12 @@
"util.deprecate": true
}
},
"validate-npm-package-license": {
"packages": {
"spdx-correct": true,
"spdx-expression-parse": true
}
},
"vfile": {
"builtin": {
"path.basename": true,

@ -264,6 +264,7 @@
"enzyme-adapter-react-16": "^1.15.1",
"eslint": "^7.23.0",
"eslint-config-prettier": "^8.1.0",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jest": "^24.3.4",
"eslint-plugin-mocha": "^8.1.0",
@ -277,6 +278,7 @@
"ganache-cli": "^6.12.1",
"ganache-core": "^2.13.1",
"geckodriver": "^1.21.0",
"globby": "^11.0.4",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^5.0.0",
"gulp-dart-sass": "^1.0.2",

@ -0,0 +1,21 @@
diff --git a/node_modules/@eslint/eslintrc/lib/config-array-factory.js b/node_modules/@eslint/eslintrc/lib/config-array-factory.js
index c7ff6a0..6a88c6d 100644
--- a/node_modules/@eslint/eslintrc/lib/config-array-factory.js
+++ b/node_modules/@eslint/eslintrc/lib/config-array-factory.js
@@ -41,7 +41,6 @@
const fs = require("fs");
const path = require("path");
-const importFresh = require("import-fresh");
const stripComments = require("strip-json-comments");
const ConfigValidator = require("./shared/config-validator");
const naming = require("./shared/naming");
@@ -222,7 +221,7 @@ function loadLegacyConfigFile(filePath) {
function loadJSConfigFile(filePath) {
debug(`Loading JS config file: ${filePath}`);
try {
- return importFresh(filePath);
+ return require(filePath);
} catch (e) {
debug(`Error reading JavaScript file: ${filePath}`);
e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`;

@ -0,0 +1,13 @@
diff --git a/node_modules/eslint/lib/linter/linter.js b/node_modules/eslint/lib/linter/linter.js
index adb5c21..4a4be92 100644
--- a/node_modules/eslint/lib/linter/linter.js
+++ b/node_modules/eslint/lib/linter/linter.js
@@ -560,7 +560,7 @@ function resolveParserOptions(parserName, providedOptions, enabledEnvironments)
*/
function resolveGlobals(providedGlobals, enabledEnvironments) {
return Object.assign(
- {},
+ Object.create(null),
...enabledEnvironments.filter(env => env.globals).map(env => env.globals),
providedGlobals
);

@ -0,0 +1,23 @@
diff --git a/node_modules/object.values/index.js b/node_modules/object.values/index.js
index b8ba091..2dc8083 100644
--- a/node_modules/object.values/index.js
+++ b/node_modules/object.values/index.js
@@ -1,17 +1,3 @@
'use strict';
-var define = require('define-properties');
-
-var implementation = require('./implementation');
-var getPolyfill = require('./polyfill');
-var shim = require('./shim');
-
-var polyfill = getPolyfill();
-
-define(polyfill, {
- getPolyfill: getPolyfill,
- implementation: implementation,
- shim: shim
-});
-
-module.exports = polyfill;
+module.exports = Object.values;

@ -1,17 +1,25 @@
///: BEGIN:ONLY_INCLUDE_IN(beta)
import betaJson from '../../../app/build-types/beta/beta-mascot.json';
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(flask)
import flaskJson from '../../../app/build-types/flask/flask-mascot.json';
///: END:ONLY_INCLUDE_IN
const assetList = {
main: {
// Will use default provided by the @metamask/logo library
foxMeshJson: undefined,
},
///: BEGIN:ONLY_INCLUDE_IN(beta)
beta: {
foxMeshJson: betaJson,
},
///: END:ONLY_INCLUDE_IN
///: BEGIN:ONLY_INCLUDE_IN(flask)
flask: {
foxMeshJson: flaskJson,
},
///: END:ONLY_INCLUDE_IN
};
export function isBeta() {
@ -26,8 +34,8 @@ export function getBuildSpecificAsset(assetName) {
!assetList[buildType] ||
!Object.keys(assetList[buildType]).includes(assetName)
) {
console.warn(
`Cannot find asset for build ${buildType}: ${assetName}, returning main build asset`,
console.error(
`Cannot find asset "${assetName}" for build "${buildType}", returning main build asset.`,
);
return assetList.main[assetName];
}

@ -14718,7 +14718,7 @@ globby@11.0.1, globby@^11.0.1:
merge2 "^1.3.0"
slash "^3.0.0"
globby@^11.0.2, globby@^11.0.3:
globby@^11.0.2, globby@^11.0.3, globby@^11.0.4:
version "11.0.4"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5"
integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==

Loading…
Cancel
Save