1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-22 19:26:13 +02:00
metamask-extension/lavamoat/build-system/policy-override.json

555 lines
17 KiB
JSON
Raw Normal View History

{
"resources": {
"@babel/core": {
"packages": {
"$root$": true,
"@babel/preset-env": true,
"@babel/preset-react": true,
"@babel/plugin-transform-runtime": true,
"@babel/plugin-proposal-class-properties": true,
Add TypeScript to the build system (#13489) This commit modifies the build system so that TypeScript files can be transpiled into ES5 just like JavaScript files. Note that this commit does NOT change the build system to run TypeScript files through the TypeScript compiler. In other words, no files will be type-checked at the build stage, as we expect type-checking to be handled elsewhere (live, via your editor integration with `tsserver`, and before a PR is merged, via `yarn lint`). Rather, we merely instruct Babel to strip TypeScript-specific syntax from any files that have it, as if those files had been written using JavaScript syntax alone. Why take this approach? Because it prevents the build process from being negatively impacted with respect to performance (as TypeScript takes a significant amount of time to run). It's worth noting the downside of this approach: because we aren't running files through TypeScript, but relying on Babel's [TypeScript transform][1] to identify TypeScript syntax, this transform has to keep up with any syntax changes that TypeScript adds in the future. In fact there are a few syntactical forms that Babel already does not recognize. These forms are rare or are deprecated by TypeScript, so I don't consider them to be a blocker, but it's worth noting just in case it comes up later. Also, any settings we place in `tsconfig.json` will be completely ignored by Babel. Again, this isn't a blocker because there are some analogs for the most important settings reflected in the options we can pass to the transform. These and other caveats are detailed in the [documentation for the transform][2]. [1]: https://babeljs.io/docs/en/babel-plugin-transform-typescript [2]: https://babeljs.io/docs/en/babel-plugin-transform-typescript#caveats
2022-03-29 00:33:40 +02:00
"@babel/plugin-proposal-nullish-coalescing-operator": true,
"@babel/plugin-proposal-object-rest-spread": true,
"@babel/plugin-proposal-optional-chaining": true,
Add TypeScript to the build system (#13489) This commit modifies the build system so that TypeScript files can be transpiled into ES5 just like JavaScript files. Note that this commit does NOT change the build system to run TypeScript files through the TypeScript compiler. In other words, no files will be type-checked at the build stage, as we expect type-checking to be handled elsewhere (live, via your editor integration with `tsserver`, and before a PR is merged, via `yarn lint`). Rather, we merely instruct Babel to strip TypeScript-specific syntax from any files that have it, as if those files had been written using JavaScript syntax alone. Why take this approach? Because it prevents the build process from being negatively impacted with respect to performance (as TypeScript takes a significant amount of time to run). It's worth noting the downside of this approach: because we aren't running files through TypeScript, but relying on Babel's [TypeScript transform][1] to identify TypeScript syntax, this transform has to keep up with any syntax changes that TypeScript adds in the future. In fact there are a few syntactical forms that Babel already does not recognize. These forms are rare or are deprecated by TypeScript, so I don't consider them to be a blocker, but it's worth noting just in case it comes up later. Also, any settings we place in `tsconfig.json` will be completely ignored by Babel. Again, this isn't a blocker because there are some analogs for the most important settings reflected in the options we can pass to the transform. These and other caveats are detailed in the [documentation for the transform][2]. [1]: https://babeljs.io/docs/en/babel-plugin-transform-typescript [2]: https://babeljs.io/docs/en/babel-plugin-transform-typescript#caveats
2022-03-29 00:33:40 +02:00
"@babel/preset-typescript": true
}
},
2022-08-05 17:04:44 +02:00
"@babel/eslint-parser": {
"builtin": {
"path": true
},
"packages": {
"@babel/core": true,
Add TypeScript migration dashboard (#13820) As we convert parts of the codebase to TypeScript, we will want a way to track progress. This commit adds a dashboard which displays all of the files that we wish to convert to TypeScript and which files we've already converted. The list of all possible files to convert is predetermined by walking the dependency graph of each entrypoint the build system uses to compile the extension (the files that the entrypoint imports, the files that the imports import, etc). The list should not need to be regenerated, but you can do it by running: yarn ts-migration:enumerate The dashboard is implemented as a separate React app. The CircleCI configuration has been updated so that when a new commit is pushed, the React app is built and stored in the CircleCI artifacts. When a PR is merged, the built files will be pushed to a separate repo whose sole purpose is to serve the dashboard via GitHub Pages (this is the same way that the Storybook works). All of the app code and script to build the app are self-contained under `development/ts-migration-dashboard`. To build this app yourself, you can run: yarn ts-migration:dashboard:build or if you want to build automatically as you change files, run: yarn ts-migration:dashboard:watch Then open the following file in your browser (there is no server component): development/ts-migration-dashboard/build/index.html Finally, although you shouldn't have to do this, to manually deploy the dashboard once built, you can run: git remote add ts-migration-dashboard git@github.com:MetaMask/metamask-extension-ts-migration-dashboard.git yarn ts-migration:dashboard:deploy
2022-08-09 22:16:08 +02:00
"@babel/core>@babel/parser": true,
2022-08-05 17:04:44 +02:00
"@babel/eslint-parser>eslint-scope": true,
"@babel/eslint-parser>eslint-visitor-keys": true,
"@babel/eslint-parser>semver": true,
Add TypeScript migration dashboard (#13820) As we convert parts of the codebase to TypeScript, we will want a way to track progress. This commit adds a dashboard which displays all of the files that we wish to convert to TypeScript and which files we've already converted. The list of all possible files to convert is predetermined by walking the dependency graph of each entrypoint the build system uses to compile the extension (the files that the entrypoint imports, the files that the imports import, etc). The list should not need to be regenerated, but you can do it by running: yarn ts-migration:enumerate The dashboard is implemented as a separate React app. The CircleCI configuration has been updated so that when a new commit is pushed, the React app is built and stored in the CircleCI artifacts. When a PR is merged, the built files will be pushed to a separate repo whose sole purpose is to serve the dashboard via GitHub Pages (this is the same way that the Storybook works). All of the app code and script to build the app are self-contained under `development/ts-migration-dashboard`. To build this app yourself, you can run: yarn ts-migration:dashboard:build or if you want to build automatically as you change files, run: yarn ts-migration:dashboard:watch Then open the following file in your browser (there is no server component): development/ts-migration-dashboard/build/index.html Finally, although you shouldn't have to do this, to manually deploy the dashboard once built, you can run: git remote add ts-migration-dashboard git@github.com:MetaMask/metamask-extension-ts-migration-dashboard.git yarn ts-migration:dashboard:deploy
2022-08-09 22:16:08 +02:00
"@babel/parser": true,
2022-08-05 17:04:44 +02:00
"depcheck>@babel/parser": true,
2022-08-23 22:13:02 +02:00
"eslint": true,
"lavamoat>lavamoat-tofu>@babel/parser": true
2022-08-05 17:04:44 +02:00
},
"globals": {
"process.versions": true
}
},
2022-08-23 22:13:02 +02:00
"depcheck>@babel/traverse": {
"packages": {
"babel/preset-env>b@babel/types": true
}
},
"eslint>@eslint/eslintrc": {
2022-07-26 20:10:51 +02:00
"builtin": {
"assert": true,
"fs": true,
"module": true,
"os": true,
"path": true,
"url": true,
"util": true
},
"globals": {
"process.platform": true
},
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.
2021-11-02 04:20:31 +01:00
"packages": {
"$root$": true,
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.
2021-11-02 04:20:31 +01:00
"@babel/eslint-parser": true,
"@babel/eslint-plugin": true,
"@metamask/eslint-config": true,
"@metamask/eslint-config-nodejs": true,
"@metamask/eslint-config-typescript": true,
"@typescript-eslint/eslint-plugin": true,
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.
2021-11-02 04:20:31 +01:00
"eslint": true,
"eslint-config-prettier": true,
"eslint-plugin-import": true,
"eslint-plugin-jsdoc": true,
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.
2021-11-02 04:20:31 +01:00
"eslint-plugin-node": true,
"eslint-plugin-prettier": true,
"eslint-plugin-react": true,
"eslint-plugin-react-hooks": true
}
},
2022-07-26 20:10:51 +02:00
"eslint>eslint-scope": {
"builtin": {
"assert": true
}
},
"eslint-plugin-jest": {
"packages": {
2022-07-26 20:10:51 +02:00
"eslint-plugin-jest>@typescript-eslint/utils": true,
"@typescript-eslint/eslint-plugin": true
}
},
2022-07-26 20:10:51 +02:00
"eslint-plugin-jest>@typescript-eslint/utils>eslint-utils": {
"packages": {
"eslint-plugin-jest>@typescript-eslint/utils>eslint-utils>eslint-visitor-keys": true
}
},
"eslint-plugin-jest>@typescript-eslint/utils": {
"builtin": {
"path": true
},
"packages": {
"eslint-plugin-jest>@typescript-eslint/experimental-utils>@typescript-eslint/types": true,
"eslint-plugin-jest>@typescript-eslint/utils>eslint-utils": true,
"eslint-plugin-jest>@typescript-eslint/utils>@typescript-eslint/types": true,
"eslint-plugin-jest>@typescript-eslint/utils>@typescript-eslint/scope-manager": true,
"eslint-plugin-jest>@typescript-eslint/utils>webpack>eslint-scope": true,
2022-07-26 20:10:51 +02:00
"@typescript-eslint/parser>@typescript-eslint/types": true,
"eslint": true,
"@typescript-eslint/parser>@typescript-eslint/scope-manager": true,
"eslint>eslint-scope": true,
"eslint>eslint-utils": true,
"webpack>eslint-scope": true
2022-07-26 20:10:51 +02:00
}
},
"eslint-plugin-jest>@typescript-eslint/utils>@typescript-eslint/scope-manager>@typescript-eslint/visitor-keys": {
"builtin": {
"path": true
},
"packages": {
"eslint>eslint-visitor-keys": true
}
},
"@typescript-eslint/eslint-plugin>@typescript-eslint/utils": {
"builtin": {
"path": true
},
"packages": {
"eslint>eslint-utils": true,
"@typescript-eslint/parser>@typescript-eslint/types": true,
"eslint": true,
"@typescript-eslint/parser>@typescript-eslint/scope-manager": true,
"@typescript-eslint/utils": true,
"webpack>eslint-scope": true
}
},
"eslint-plugin-jest>@typescript-eslint/utils>@typescript-eslint/scope-manager": {
"builtin": {
"path": true
},
"packages": {
"eslint-plugin-jest>@typescript-eslint/utils>@typescript-eslint/scope-manager>@typescript-eslint/visitor-keys": true,
"eslint-plugin-jest>@typescript-eslint/utils>@typescript-eslint/types": true
}
},
"eslint-plugin-jest>@typescript-eslint/experimental-utils": {
"builtin": {
"path": true
},
"packages": {
2022-07-26 20:10:51 +02:00
"eslint-plugin-jest>@typescript-eslint/experimental-utils>@typescript-eslint/types": true,
"eslint-plugin-jest>@typescript-eslint/experimental-utils>eslint-utils": true,
"@typescript-eslint/parser>@typescript-eslint/types": true,
"eslint": true,
"@typescript-eslint/parser>@typescript-eslint/scope-manager": true,
2022-07-26 20:10:51 +02:00
"eslint>eslint-scope": true,
"eslint>eslint-utils": true,
"webpack>eslint-scope": true
}
},
"eslint-plugin-jest>@typescript-eslint/experimental-utils>eslint-utils": {
"packages": {
"eslint-plugin-jest>@typescript-eslint/experimental-utils>eslint-utils>eslint-visitor-keys": true
}
},
2022-07-26 20:10:51 +02:00
"@typescript-eslint/eslint-plugin>@typescript-eslint/type-utils": {
"packages": {
Add TypeScript migration dashboard (#13820) As we convert parts of the codebase to TypeScript, we will want a way to track progress. This commit adds a dashboard which displays all of the files that we wish to convert to TypeScript and which files we've already converted. The list of all possible files to convert is predetermined by walking the dependency graph of each entrypoint the build system uses to compile the extension (the files that the entrypoint imports, the files that the imports import, etc). The list should not need to be regenerated, but you can do it by running: yarn ts-migration:enumerate The dashboard is implemented as a separate React app. The CircleCI configuration has been updated so that when a new commit is pushed, the React app is built and stored in the CircleCI artifacts. When a PR is merged, the built files will be pushed to a separate repo whose sole purpose is to serve the dashboard via GitHub Pages (this is the same way that the Storybook works). All of the app code and script to build the app are self-contained under `development/ts-migration-dashboard`. To build this app yourself, you can run: yarn ts-migration:dashboard:build or if you want to build automatically as you change files, run: yarn ts-migration:dashboard:watch Then open the following file in your browser (there is no server component): development/ts-migration-dashboard/build/index.html Finally, although you shouldn't have to do this, to manually deploy the dashboard once built, you can run: git remote add ts-migration-dashboard git@github.com:MetaMask/metamask-extension-ts-migration-dashboard.git yarn ts-migration:dashboard:deploy
2022-08-09 22:16:08 +02:00
"@typescript-eslint/eslint-plugin>@typescript-eslint/type-utils>debug": true,
"@typescript-eslint/eslint-plugin>@typescript-eslint/utils": true,
2022-07-26 20:10:51 +02:00
"@typescript-eslint/eslint-plugin>tsutils": true,
"eslint-plugin-jest>@typescript-eslint/utils": true,
Add TypeScript migration dashboard (#13820) As we convert parts of the codebase to TypeScript, we will want a way to track progress. This commit adds a dashboard which displays all of the files that we wish to convert to TypeScript and which files we've already converted. The list of all possible files to convert is predetermined by walking the dependency graph of each entrypoint the build system uses to compile the extension (the files that the entrypoint imports, the files that the imports import, etc). The list should not need to be regenerated, but you can do it by running: yarn ts-migration:enumerate The dashboard is implemented as a separate React app. The CircleCI configuration has been updated so that when a new commit is pushed, the React app is built and stored in the CircleCI artifacts. When a PR is merged, the built files will be pushed to a separate repo whose sole purpose is to serve the dashboard via GitHub Pages (this is the same way that the Storybook works). All of the app code and script to build the app are self-contained under `development/ts-migration-dashboard`. To build this app yourself, you can run: yarn ts-migration:dashboard:build or if you want to build automatically as you change files, run: yarn ts-migration:dashboard:watch Then open the following file in your browser (there is no server component): development/ts-migration-dashboard/build/index.html Finally, although you shouldn't have to do this, to manually deploy the dashboard once built, you can run: git remote add ts-migration-dashboard git@github.com:MetaMask/metamask-extension-ts-migration-dashboard.git yarn ts-migration:dashboard:deploy
2022-08-09 22:16:08 +02:00
"eslint>debug": true,
"madge>debug": true,
"typescript": true,
"nock>debug": true
2022-07-26 20:10:51 +02:00
}
},
"@typescript-eslint/eslint-plugin>@typescript-eslint/type-utils>debug": {
"packages": {
"@typescript-eslint/eslint-plugin>@typescript-eslint/type-utils>debug>ms": true
},
"globals": {
"console.debug": true,
"console.log": true
}
},
"@typescript-eslint/eslint-plugin": {
"packages": {
"typescript": true,
2022-07-26 20:10:51 +02:00
"eslint-plugin-jest>@typescript-eslint/utils": true,
"@typescript-eslint/eslint-plugin>@typescript-eslint/type-utils": true,
"@typescript-eslint/eslint-plugin>@typescript-eslint/utils": true,
"@typescript-eslint/parser>@typescript-eslint/scope-manager": true,
"@typescript-eslint/eslint-plugin>tsutils": true,
"eslint>debug": true,
"eslint": true,
"semver": true,
"globby>ignore": true,
"eslint>regexpp": true
}
},
"eslint-plugin-import>eslint-module-utils": {
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.
2021-11-02 04:20:31 +01:00
"packages": {
"eslint-import-resolver-node": true,
"@babel/eslint-parser": true
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.
2021-11-02 04:20:31 +01:00
}
},
"node-sass": {
"native": true
},
"browserify>module-deps": {
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.
2021-11-02 04:20:31 +01:00
"packages": {
"loose-envify": true
}
},
"sass": {
"env": "unfrozen",
"builtin": {
"url": true
},
"globals": {
"Buffer": true
}
},
2022-07-26 20:10:51 +02:00
"string.prototype.matchall>get-intrinsic": {
"packages": {
"string.prototype.matchall>has-symbols": true
}
},
"tsutils": {
"packages": {
"typescript": true,
"tslib": true
}
},
"typescript": {
"globals": {
"globalThis": true
}
},
"yargs": {
"builtin": {
"assert": true,
"fs": true,
"path": true,
"util": true
},
"globals": {
"console": true,
"Error": true,
"process": true
}
},
"yargs>y18n": {
"builtin": {
"fs": true,
"path": true,
"util": true
}
},
"yargs>yargs-parser": {
"builtin": {
"fs": true,
"path": true,
"util": true
},
"globals": {
"process": true
}
},
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": {
"builtin": {
"events.EventEmitter": true,
"util": true
},
"globals": {
"process.nextTick": true,
"process.stderr": true
},
"packages": {
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>are-we-there-yet": true,
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge": true,
"@storybook/react>@storybook/node-logger>npmlog>console-control-strings": true,
"nyc>yargs>set-blocking": true
}
},
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>are-we-there-yet": {
"builtin": {
"events.EventEmitter": true,
"util.inherits": true
},
"packages": {
"koa>delegates": true,
"readable-stream": true
}
},
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge": {
"builtin": {
"util.format": true
},
"globals": {
"clearInterval": true,
"process": true,
"setImmediate": true,
"setInterval": true
},
"packages": {
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>aproba": true,
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>string-width": true,
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>strip-ansi": true,
"@storybook/react>@storybook/node-logger>npmlog>console-control-strings": true,
"@storybook/react>@storybook/node-logger>npmlog>gauge>has-unicode": true,
"@storybook/react>@storybook/node-logger>npmlog>gauge>wide-align": true,
"nyc>signal-exit": true,
"react>object-assign": true
}
},
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>string-width": {
"packages": {
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": true,
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>strip-ansi": true,
"gulp>gulp-cli>yargs>string-width>code-point-at": true
}
},
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>string-width>is-fullwidth-code-point": {
"packages": {
"gulp>gulp-cli>yargs>string-width>is-fullwidth-code-point>number-is-nan": true
}
},
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>strip-ansi": {
"packages": {
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog>gauge>strip-ansi>ansi-regex": true
}
},
"@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": {
"builtin": {
"os.homedir": true
},
"globals": {
"process.env": true,
"process.getuid": true,
"process.platform": true
}
},
"@storybook/react>@storybook/node-logger>npmlog>gauge>has-unicode": {
"builtin": {
"os.type": true
},
"globals": {
"process.env.LANG": true,
"process.env.LC_ALL": true,
"process.env.LC_CTYPE": true
}
},
"@storybook/react>@storybook/node-logger>npmlog>gauge>wide-align": {
"packages": {
"yargs>string-width": true
}
},
"gulp-watch>chokidar": {
"builtin": {
"events.EventEmitter": true,
"fs": true,
"path.basename": true,
"path.dirname": true,
"path.extname": true,
"path.join": true,
"path.relative": true,
"path.resolve": true,
"path.sep": true
},
"globals": {
"clearTimeout": true,
"console.error": true,
"process.env.CHOKIDAR_INTERVAL": true,
"process.env.CHOKIDAR_PRINT_FSEVENTS_REQUIRE_ERROR": true,
"process.env.CHOKIDAR_USEPOLLING": true,
"process.nextTick": true,
"process.platform": true,
"setTimeout": true
},
"packages": {
"chokidar>normalize-path": true,
"eslint>is-glob": true,
"gulp-watch>chokidar>anymatch": true,
"gulp-watch>chokidar>async-each": true,
"gulp-watch>chokidar>braces": true,
"gulp-watch>chokidar>fsevents": true,
"gulp-watch>chokidar>is-binary-path": true,
"gulp-watch>chokidar>readdirp": true,
"gulp-watch>chokidar>upath": true,
"gulp-watch>glob-parent": true,
"gulp-watch>path-is-absolute": true,
"pumpify>inherits": true
}
},
"gulp-watch>chokidar>fsevents": {
"builtin": {
"events.EventEmitter": true,
"fs.stat": true,
"path.join": true,
"util.inherits": true
},
"globals": {
"__dirname": true,
"console.assert": true,
"process.nextTick": true,
"process.platform": true,
"setImmediate": true
},
"packages": {
"gulp-watch>chokidar>fsevents>node-pre-gyp": true
}
},
"gulp-watch>chokidar>fsevents>node-pre-gyp": {
"builtin": {
"events.EventEmitter": true,
"fs.existsSync": true,
"fs.readFileSync": true,
"fs.renameSync": true,
"path.dirname": true,
"path.existsSync": true,
"path.join": true,
"path.resolve": true,
"url.parse": true,
"url.resolve": true,
"util.inherits": true
},
"globals": {
"__dirname": true,
"console.log": true,
"process.arch": true,
"process.cwd": true,
"process.env": true,
"process.platform": true,
"process.version.substr": true,
"process.versions": true
},
"packages": {
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>npmlog": true,
"gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": true,
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": true,
"gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": true,
"gulp-watch>chokidar>fsevents>node-pre-gyp>semver": true
}
},
"gulp-watch>chokidar>fsevents>node-pre-gyp>detect-libc": {
"builtin": {
"child_process.spawnSync": true,
"fs.readdirSync": true,
"os.platform": true
},
"globals": {
"process.env": true
}
},
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt": {
"builtin": {
"path": true,
"stream.Stream": true,
"url": true
},
"globals": {
"console": true,
"process.argv": true,
"process.env.DEBUG_NOPT": true,
"process.env.NOPT_DEBUG": true,
"process.platform": true
},
"packages": {
"@lavamoat/allow-scripts>@npmcli/run-script>node-gyp>nopt>abbrev": true,
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv": true
}
},
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv": {
"builtin": {
"child_process.exec": true,
"path": true
},
"globals": {
"process.env.COMPUTERNAME": true,
"process.env.ComSpec": true,
"process.env.EDITOR": true,
"process.env.HOSTNAME": true,
"process.env.PATH": true,
"process.env.PROMPT": true,
"process.env.PS1": true,
"process.env.Path": true,
"process.env.SHELL": true,
"process.env.USER": true,
"process.env.USERDOMAIN": true,
"process.env.USERNAME": true,
"process.env.VISUAL": true,
"process.env.path": true,
"process.nextTick": true,
"process.platform": true
},
"packages": {
"@storybook/core>@storybook/core-server>x-default-browser>default-browser-id>untildify>os-homedir": true,
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": true
}
},
"gulp-watch>chokidar>fsevents>node-pre-gyp>nopt>osenv>os-tmpdir": {
"globals": {
"process.env.SystemRoot": true,
"process.env.TEMP": true,
"process.env.TMP": true,
"process.env.TMPDIR": true,
"process.env.windir": true,
"process.platform": true
}
},
"gulp-watch>chokidar>fsevents>node-pre-gyp>rimraf": {
"builtin": {
"assert": true,
"fs": true,
"path.join": true
},
"globals": {
"process.platform": true,
"setTimeout": true
},
"packages": {
"nyc>glob": true
}
},
"gulp-watch>chokidar>fsevents>node-pre-gyp>semver": {
"globals": {
"console": true,
"process": true
}
},
"chokidar>fsevents": {
"globals": {
"console.assert": true,
"process.platform": true
},
"native": true
},
"gulp>glob-watcher>chokidar>fsevents": {
"builtin": {
"events.EventEmitter": true,
"fs.stat": true,
"path.join": true,
"util.inherits": true
},
"globals": {
"__dirname": true,
"console.assert": true,
"process.nextTick": true,
"process.platform": true,
"setImmediate": true
},
"packages": {
"gulp-watch>chokidar>fsevents>node-pre-gyp": true
}
},
"nyc>yargs>set-blocking": {
"globals": {
"process.stderr": true,
"process.stdout": true
}
}
}
}