Skip to content

Commit f5b2d7e

Browse files
alan-agius4clydin
authored andcommitted
refactor: remove no longer needed caniuse-lite dependency
1 parent 5990ed9 commit f5b2d7e

File tree

15 files changed

+40
-155
lines changed

15 files changed

+40
-155
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@
9696
"@types/babel__core": "7.1.16",
9797
"@types/babel__template": "7.4.1",
9898
"@types/cacache": "^15.0.0",
99-
"@types/caniuse-lite": "^1.0.0",
10099
"@types/copy-webpack-plugin": "^8.0.0",
101100
"@types/debug": "^4.1.2",
102101
"@types/express": "^4.16.0",
@@ -132,7 +131,6 @@
132131
"bootstrap": "^4.0.0",
133132
"browserslist": "^4.9.1",
134133
"cacache": "15.3.0",
135-
"caniuse-lite": "^1.0.30001032",
136134
"chokidar": "^3.5.2",
137135
"circular-dependency-plugin": "5.2.2",
138136
"common-tags": "^1.8.0",

packages/angular_devkit/build_angular/BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ ts_library(
118118
"@npm//@types/babel__template",
119119
"@npm//@types/browserslist",
120120
"@npm//@types/cacache",
121-
"@npm//@types/caniuse-lite",
122121
"@npm//@types/copy-webpack-plugin",
123122
"@npm//@types/glob",
124123
"@npm//@types/inquirer",
@@ -138,7 +137,6 @@ ts_library(
138137
"@npm//babel-plugin-istanbul",
139138
"@npm//browserslist",
140139
"@npm//cacache",
141-
"@npm//caniuse-lite",
142140
"@npm//circular-dependency-plugin",
143141
"@npm//copy-webpack-plugin",
144142
"@npm//core-js",

packages/angular_devkit/build_angular/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"babel-plugin-istanbul": "6.1.1",
2727
"browserslist": "^4.9.1",
2828
"cacache": "15.3.0",
29-
"caniuse-lite": "^1.0.30001032",
3029
"circular-dependency-plugin": "5.2.2",
3130
"copy-webpack-plugin": "9.0.1",
3231
"core-js": "3.19.1",

packages/angular_devkit/build_angular/src/builders/browser/index.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { ScriptTarget } from 'typescript';
1717
import webpack from 'webpack';
1818
import { ExecutionTransformer } from '../../transforms';
1919
import {
20-
BuildBrowserFeatures,
2120
deleteOutputDir,
2221
normalizeAssetPatterns,
2322
normalizeOptimization,
@@ -38,6 +37,7 @@ import { ensureOutputPaths } from '../../utils/output-paths';
3837
import { generateEntryPoints } from '../../utils/package-chunk-sort';
3938
import { augmentAppWithServiceWorker } from '../../utils/service-worker';
4039
import { Spinner } from '../../utils/spinner';
40+
import { getSupportedBrowsers } from '../../utils/supported-browsers';
4141
import { assertCompatibleAngularVersion } from '../../utils/version';
4242
import {
4343
generateI18nBrowserWebpackConfigFromContext,
@@ -153,9 +153,7 @@ export function buildWebpackBrowser(
153153
),
154154
);
155155

156-
const buildBrowserFeatures = new BuildBrowserFeatures(sysProjectRoot);
157-
158-
checkInternetExplorerSupport(buildBrowserFeatures.supportedBrowsers, context.logger);
156+
checkInternetExplorerSupport(sysProjectRoot, context.logger);
159157

160158
return {
161159
...(await initialize(options, context, transforms.webpackConfiguration)),
@@ -417,10 +415,8 @@ function mapEmittedFilesToFileInfo(files: EmittedFiles[] = []): FileInfo[] {
417415
return filteredFiles;
418416
}
419417

420-
function checkInternetExplorerSupport(
421-
supportedBrowsers: string[],
422-
logger: logging.LoggerApi,
423-
): void {
418+
function checkInternetExplorerSupport(projectRoot: string, logger: logging.LoggerApi): void {
419+
const supportedBrowsers = getSupportedBrowsers(projectRoot);
424420
if (supportedBrowsers.some((b) => b === 'ie 9' || b === 'ie 10' || b === 'ie 11')) {
425421
logger.warn(
426422
`Warning: Support was requested for Internet Explorer in the project's browserslist configuration. ` +

packages/angular_devkit/build_angular/src/utils/build-browser-features.ts

Lines changed: 0 additions & 57 deletions
This file was deleted.

packages/angular_devkit/build_angular/src/utils/build-browser-features_spec.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

packages/angular_devkit/build_angular/src/utils/build-options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export interface BuildOptions {
7171
cache: NormalizedCachedOptions;
7272
codeCoverage?: boolean;
7373
codeCoverageExclude?: string[];
74+
supportedBrowsers: string[];
7475
}
7576

7677
export interface WebpackDevServerOptions

packages/angular_devkit/build_angular/src/utils/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
export * from './build-browser-features';
109
export * from './default-progress';
1110
export * from './delete-output-dir';
1211
export * from './run-module-as-observable-fork';

packages/angular_devkit/build_angular/src/utils/normalize-builder-schema.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import {
2121
} from './normalize-file-replacements';
2222
import { NormalizedOptimizationOptions, normalizeOptimization } from './normalize-optimization';
2323
import { normalizeSourceMaps } from './normalize-source-maps';
24+
import { getSupportedBrowsers } from './supported-browsers';
2425

2526
/**
2627
* A normalized browser builder schema.
@@ -65,5 +66,6 @@ export function normalizeBrowserSchema(
6566
// A value of 0 is falsy and will disable polling rather then enable
6667
// 500 ms is a sensible default in this case
6768
poll: options.poll === 0 ? 500 : options.poll,
69+
supportedBrowsers: getSupportedBrowsers(getSystemPath(projectRoot)),
6870
};
6971
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* @license
3+
* Copyright Google LLC All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
import browserslist from 'browserslist';
10+
11+
export function getSupportedBrowsers(projectRoot: string): string[] {
12+
browserslist.defaults = [
13+
'last 1 Chrome version',
14+
'last 1 Firefox version',
15+
'last 2 Edge major versions',
16+
'last 2 Safari major versions',
17+
'last 2 iOS major versions',
18+
'Firefox ESR',
19+
];
20+
21+
return browserslist(undefined, { path: projectRoot });
22+
}

0 commit comments

Comments
 (0)