Skip to content

Commit 25aa2d5

Browse files
josephperrottmgechev
authored andcommitted
refactor: remove usages of the term whitelist
1 parent dd59bfc commit 25aa2d5

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

packages/angular/cli/lib/config/schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1197,7 +1197,7 @@
11971197
},
11981198
"allowedHosts": {
11991199
"type": "array",
1200-
"description": "Whitelist of hosts that are allowed to access the dev server.",
1200+
"description": "List of hosts that are allowed to access the dev server.",
12011201
"default": [],
12021202
"items": {
12031203
"type": "string"

packages/angular_devkit/build_angular/src/dev-server/schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
},
5858
"allowedHosts": {
5959
"type": "array",
60-
"description": "Whitelist of hosts that are allowed to access the dev server.",
60+
"description": "List of hosts that are allowed to access the dev server.",
6161
"default": [],
6262
"items": {
6363
"type": "string"

packages/angular_devkit/build_optimizer/src/build-optimizer/build-optimizer.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { getWrapEnumsTransformer } from '../transforms/wrap-enums';
2323

2424

2525
// Angular packages are known to have no side effects.
26-
const whitelistedAngularModules = [
26+
const knownSideEffectFreeAngularModules = [
2727
/[\\/]node_modules[\\/]@angular[\\/]animations[\\/]/,
2828
/[\\/]node_modules[\\/]@angular[\\/]common[\\/]/,
2929
/[\\/]node_modules[\\/]@angular[\\/]compiler[\\/]/,
@@ -61,7 +61,7 @@ function isKnownCoreFile(filePath: string) {
6161

6262
function isKnownSideEffectFree(filePath: string) {
6363
return ngFactories.some((re) => re.test(filePath)) ||
64-
whitelistedAngularModules.some((re) => re.test(filePath));
64+
knownSideEffectFreeAngularModules.some((re) => re.test(filePath));
6565
}
6666

6767
export interface BuildOptimizerOptions {
@@ -117,7 +117,7 @@ export function buildOptimizer(options: BuildOptimizerOptions): TransformJavascr
117117
getTransforms.push(
118118
// getPrefixFunctionsTransformer is rather dangerous, apply only to known pure es5 modules.
119119
// It will mark both `require()` calls and `console.log(stuff)` as pure.
120-
// We only apply it to whitelisted modules, since we know they are safe.
120+
// We only apply it to modules known to be side effect free, since we know they are safe.
121121
// getPrefixFunctionsTransformer needs to be before getFoldFileTransformer.
122122
getPrefixFunctionsTransformer,
123123
selectedGetScrubFileTransformer,

packages/angular_devkit/build_optimizer/src/build-optimizer/build-optimizer_spec.ts

+8-5
Original file line numberDiff line numberDiff line change
@@ -254,25 +254,28 @@ describe('build-optimizer', () => {
254254
});
255255
});
256256

257-
describe('whitelisted modules', () => {
258-
// This statement is considered pure by getPrefixFunctionsTransformer on whitelisted modules.
257+
describe('known side effect free modules', () => {
258+
// This statement is considered pure by getPrefixFunctionsTransformer on known side effect free
259+
// modules.
259260
const input = 'console.log(42);';
260261
const output = '/*@__PURE__*/ console.log(42);';
261262

262-
it('should process whitelisted modules', () => {
263+
it('should process known side effect free modules', () => {
263264
const inputFilePath = '/node_modules/@angular/core/@angular/core.es5.js';
264265
const boOutput = buildOptimizer({ content: input, inputFilePath });
265266
expect(boOutput.content).toContain(output);
266267
expect(boOutput.emitSkipped).toEqual(false);
267268
});
268269

269-
it('should not process non-whitelisted modules', () => {
270+
it('should not process modules which are not in the list of known side effect free modules',
271+
() => {
270272
const inputFilePath = '/node_modules/other-package/core.es5.js';
271273
const boOutput = buildOptimizer({ content: input, inputFilePath });
272274
expect(boOutput.emitSkipped).toEqual(true);
273275
});
274276

275-
it('should not process non-whitelisted umd modules', () => {
277+
it('should not process umd modules which are not in the list of known side effect free modules',
278+
() => {
276279
const inputFilePath = '/node_modules/other_lib/index.js';
277280
const boOutput = buildOptimizer({ content: input, inputFilePath });
278281
expect(boOutput.emitSkipped).toEqual(true);

packages/angular_devkit/core/src/analytics/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export * from './noop';
1717
*
1818
* These cannot be in their respective schema.json file because we either change the type
1919
* (e.g. --buildEventLog is string, but we want to know the usage of it, not its value), or
20-
* some validation needs to be done (we cannot record ng add --collection if it's not whitelisted).
20+
* some validation needs to be done (we cannot record ng add --collection if it's not marked as
21+
* allowed).
2122
*/
2223
export enum NgCliAnalyticsDimensions {
2324
CpuCount = 1,

packages/schematics/update/update/index.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export function angularMajorCompatGuarantee(range: string) {
5959

6060
// This is a map of packageGroupName to range extending function. If it isn't found, the range is
6161
// kept the same.
62-
const peerCompatibleWhitelist: { [name: string]: PeerVersionTransform } = {
62+
const knownPeerCompatibleList: { [name: string]: PeerVersionTransform } = {
6363
'@angular/core': angularMajorCompatGuarantee,
6464
};
6565

@@ -96,7 +96,7 @@ function _updatePeerVersion(infoMap: Map<string, PackageInfo>, name: string, ran
9696
name = maybePackageInfo.installed.updateMetadata.packageGroupName || name;
9797
}
9898

99-
const maybeTransform = peerCompatibleWhitelist[name];
99+
const maybeTransform = knownPeerCompatibleList[name];
100100
if (maybeTransform) {
101101
if (typeof maybeTransform == 'function') {
102102
return maybeTransform(range);
@@ -172,7 +172,7 @@ function _validateReversePeerDependencies(
172172
continue;
173173
}
174174

175-
// Override the peer version range if it's whitelisted.
175+
// Override the peer version range if it's known as a compatible.
176176
const extendedRange = _updatePeerVersion(infoMap, peer, range);
177177

178178
if (!semver.satisfies(version, extendedRange, { includePrerelease: next || undefined })) {

0 commit comments

Comments
 (0)