Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove no longer needed caniuse-lite dependency #22124

Merged
merged 1 commit into from
Nov 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"@types/babel__core": "7.1.16",
"@types/babel__template": "7.4.1",
"@types/cacache": "^15.0.0",
"@types/caniuse-lite": "^1.0.0",
"@types/copy-webpack-plugin": "^8.0.0",
"@types/debug": "^4.1.2",
"@types/express": "^4.16.0",
Expand Down Expand Up @@ -132,7 +131,6 @@
"bootstrap": "^4.0.0",
"browserslist": "^4.9.1",
"cacache": "15.3.0",
"caniuse-lite": "^1.0.30001032",
"chokidar": "^3.5.2",
"circular-dependency-plugin": "5.2.2",
"common-tags": "^1.8.0",
Expand Down
2 changes: 0 additions & 2 deletions packages/angular_devkit/build_angular/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ ts_library(
"@npm//@types/babel__template",
"@npm//@types/browserslist",
"@npm//@types/cacache",
"@npm//@types/caniuse-lite",
"@npm//@types/copy-webpack-plugin",
"@npm//@types/glob",
"@npm//@types/inquirer",
Expand All @@ -138,7 +137,6 @@ ts_library(
"@npm//babel-plugin-istanbul",
"@npm//browserslist",
"@npm//cacache",
"@npm//caniuse-lite",
"@npm//circular-dependency-plugin",
"@npm//copy-webpack-plugin",
"@npm//core-js",
Expand Down
1 change: 0 additions & 1 deletion packages/angular_devkit/build_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"babel-plugin-istanbul": "6.1.1",
"browserslist": "^4.9.1",
"cacache": "15.3.0",
"caniuse-lite": "^1.0.30001032",
"circular-dependency-plugin": "5.2.2",
"copy-webpack-plugin": "9.0.1",
"core-js": "3.19.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import { ScriptTarget } from 'typescript';
import webpack from 'webpack';
import { ExecutionTransformer } from '../../transforms';
import {
BuildBrowserFeatures,
deleteOutputDir,
normalizeAssetPatterns,
normalizeOptimization,
Expand All @@ -38,6 +37,7 @@ import { ensureOutputPaths } from '../../utils/output-paths';
import { generateEntryPoints } from '../../utils/package-chunk-sort';
import { augmentAppWithServiceWorker } from '../../utils/service-worker';
import { Spinner } from '../../utils/spinner';
import { getSupportedBrowsers } from '../../utils/supported-browsers';
import { assertCompatibleAngularVersion } from '../../utils/version';
import {
generateI18nBrowserWebpackConfigFromContext,
Expand Down Expand Up @@ -153,9 +153,7 @@ export function buildWebpackBrowser(
),
);

const buildBrowserFeatures = new BuildBrowserFeatures(sysProjectRoot);

checkInternetExplorerSupport(buildBrowserFeatures.supportedBrowsers, context.logger);
checkInternetExplorerSupport(sysProjectRoot, context.logger);

return {
...(await initialize(options, context, transforms.webpackConfiguration)),
Expand Down Expand Up @@ -417,10 +415,8 @@ function mapEmittedFilesToFileInfo(files: EmittedFiles[] = []): FileInfo[] {
return filteredFiles;
}

function checkInternetExplorerSupport(
supportedBrowsers: string[],
logger: logging.LoggerApi,
): void {
function checkInternetExplorerSupport(projectRoot: string, logger: logging.LoggerApi): void {
const supportedBrowsers = getSupportedBrowsers(projectRoot);
if (supportedBrowsers.some((b) => b === 'ie 9' || b === 'ie 10' || b === 'ie 11')) {
logger.warn(
`Warning: Support was requested for Internet Explorer in the project's browserslist configuration. ` +
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface BuildOptions {
cache: NormalizedCachedOptions;
codeCoverage?: boolean;
codeCoverageExclude?: string[];
supportedBrowsers: string[];
}

export interface WebpackDevServerOptions
Expand Down
1 change: 0 additions & 1 deletion packages/angular_devkit/build_angular/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
* found in the LICENSE file at https://angular.io/license
*/

export * from './build-browser-features';
export * from './default-progress';
export * from './delete-output-dir';
export * from './run-module-as-observable-fork';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from './normalize-file-replacements';
import { NormalizedOptimizationOptions, normalizeOptimization } from './normalize-optimization';
import { normalizeSourceMaps } from './normalize-source-maps';
import { getSupportedBrowsers } from './supported-browsers';

/**
* A normalized browser builder schema.
Expand Down Expand Up @@ -65,5 +66,6 @@ export function normalizeBrowserSchema(
// A value of 0 is falsy and will disable polling rather then enable
// 500 ms is a sensible default in this case
poll: options.poll === 0 ? 500 : options.poll,
supportedBrowsers: getSupportedBrowsers(getSystemPath(projectRoot)),
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/

import browserslist from 'browserslist';

export function getSupportedBrowsers(projectRoot: string): string[] {
browserslist.defaults = [
'last 1 Chrome version',
'last 1 Firefox version',
'last 2 Edge major versions',
'last 2 Safari major versions',
'last 2 iOS major versions',
'Firefox ESR',
];

return browserslist(undefined, { path: projectRoot });
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
} from 'webpack';
import { SubresourceIntegrityPlugin } from 'webpack-subresource-integrity';
import { AngularBabelLoaderOptions } from '../../babel/webpack-loader';
import { BuildBrowserFeatures } from '../../utils';
import { WebpackConfigOptions } from '../../utils/build-options';
import { allowMangle, profilingEnabled } from '../../utils/environment-options';
import { loadEsmModule } from '../../utils/load-esm';
Expand Down Expand Up @@ -97,7 +96,6 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config

// determine hashing format
const hashFormat = getOutputHashFormat(buildOptions.outputHashing || 'none');
const buildBrowserFeatures = new BuildBrowserFeatures(projectRoot);

if (buildOptions.progress) {
extraPlugins.push(new ProgressPlugin(platform));
Expand Down Expand Up @@ -412,7 +410,7 @@ export async function getCommonConfig(wco: WebpackConfigOptions): Promise<Config
level: verbose ? 'verbose' : 'error',
},
stats: getStatsOptions(verbose),
cache: getCacheSettings(wco, buildBrowserFeatures.supportedBrowsers, NG_VERSION.full),
cache: getCacheSettings(wco, NG_VERSION.full),
optimization: {
minimizer: extraMinimizers,
moduleIds: 'deterministic',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as path from 'path';
import { Configuration, RuleSetUseItem } from 'webpack';
import { ExtraEntryPoint } from '../../builders/browser/schema';
import { SassWorkerImplementation } from '../../sass/sass-service';
import { BuildBrowserFeatures } from '../../utils/build-browser-features';
import { WebpackConfigOptions } from '../../utils/build-options';
import {
AnyComponentStyleBudgetChecker,
Expand Down Expand Up @@ -155,9 +154,8 @@ export function getStylesConfig(wco: WebpackConfigOptions): Configuration {
}
}

const { supportedBrowsers } = new BuildBrowserFeatures(wco.projectRoot);
const postcssPresetEnvPlugin = postcssPresetEnv({
browsers: supportedBrowsers,
browsers: buildOptions.supportedBrowsers,
autoprefixer: true,
stage: 3,
});
Expand Down Expand Up @@ -398,7 +396,7 @@ export function getStylesConfig(wco: WebpackConfigOptions): Configuration {
minimizer: buildOptions.optimization.styles.minify
? [
new CssOptimizerPlugin({
supportedBrowsers,
supportedBrowsers: buildOptions.supportedBrowsers,
}),
]
: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ export function getInstrumentationExcludedPaths(

export function getCacheSettings(
wco: WebpackConfigOptions,
supportedBrowsers: string[],
angularVersion: string,
): WebpackOptionsNormalized['cache'] {
const { enabled, path: cacheDirectory } = wco.buildOptions.cache;
Expand All @@ -144,7 +143,6 @@ export function getCacheSettings(
outputPath: undefined,
}),
)
.update(supportedBrowsers.join(''))
.digest('hex'),
};
}
Expand Down
2 changes: 0 additions & 2 deletions packages/schematics/angular/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ ts_library(
"//packages/angular_devkit/schematics/tasks",
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript",
"@npm//@types/browserslist",
"@npm//@types/caniuse-lite",
"@npm//@types/node",
"@npm//jsonc-parser",
"@npm//rxjs",
Expand Down Expand Up @@ -121,7 +120,6 @@ ts_library(
"//packages/angular_devkit/schematics/testing",
"//packages/schematics/angular/third_party/github.com/Microsoft/TypeScript",
"@npm//@types/browserslist",
"@npm//@types/caniuse-lite",
"@npm//jsonc-parser",
"@npm//rxjs",
],
Expand Down
18 changes: 8 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,7 @@

"@angular/dev-infra-private@https://github.com/angular/dev-infra-private-builds.git#a90cdda88674f02dc5e30269868b531b5793295c":
version "0.0.0"
uid a90cdda88674f02dc5e30269868b531b5793295c
resolved "https://github.com/angular/dev-infra-private-builds.git#a90cdda88674f02dc5e30269868b531b5793295c"
resolved "https://github.com/angular/dev-infra-private-builds.git#e87c1a61a10bc630a316ed971139f572626ebe8b"
dependencies:
"@actions/core" "^1.4.0"
"@actions/github" "^5.0.0"
Expand All @@ -128,7 +127,7 @@
"@bazel/protractor" "4.4.2"
"@bazel/runfiles" "4.4.2"
"@bazel/typescript" "4.4.2"
"@microsoft/api-extractor" "7.18.19"
"@microsoft/api-extractor" "7.18.17"
"@octokit/auth-app" "^3.6.0"
"@octokit/core" "^3.5.1"
"@octokit/graphql" "^4.8.0"
Expand Down Expand Up @@ -1828,11 +1827,6 @@
"@types/node" "*"
"@types/responselike" "*"

"@types/caniuse-lite@^1.0.0":
version "1.0.1"
resolved "https://registry.yarnpkg.com/@types/caniuse-lite/-/caniuse-lite-1.0.1.tgz#368292d5d28268cb7917b9178fcdd500df22d64a"
integrity sha512-enW8d/vdojHAhr1C/0BqsNkhz/0ik2WCuAJIp9EClP+mHkR8xXBJ2OGeXHZ6cPqDjVKvWBRe9tY/Nr9r4yQSuA==

"@types/component-emitter@^1.2.10":
version "1.2.11"
resolved "https://registry.yarnpkg.com/@types/component-emitter/-/component-emitter-1.2.11.tgz#50d47d42b347253817a39709fef03ce66a108506"
Expand Down Expand Up @@ -3299,7 +3293,12 @@ camelcase@^5.0.0, camelcase@^5.3.1:
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320"
integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==

caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001032, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001274:
caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109:
version "1.0.30001274"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001274.tgz#26ca36204d15b17601ba6fc35dbdad950a647cc7"
integrity sha512-+Nkvv0fHyhISkiMIjnyjmf5YJcQ1IQHZN6U9TLUMroWR38FNwpsC51Gb68yueafX1V6ifOisInSgP9WJFS13ew==

caniuse-lite@^1.0.30001274:
version "1.0.30001278"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001278.tgz#51cafc858df77d966b17f59b5839250b24417fff"
integrity sha512-mpF9KeH8u5cMoEmIic/cr7PNS+F5LWBk0t2ekGT60lFf0Wq+n9LspAj0g3P+o7DQhD3sUdlMln4YFAWhFYn9jg==
Expand Down Expand Up @@ -9131,7 +9130,6 @@ sass@1.43.4, sass@^1.32.8:

"sauce-connect-proxy@https://saucelabs.com/downloads/sc-4.6.4-linux.tar.gz":
version "0.0.0"
uid "992e2cb0d91e54b27a4f5bbd2049f3b774718115"
resolved "https://saucelabs.com/downloads/sc-4.6.4-linux.tar.gz#992e2cb0d91e54b27a4f5bbd2049f3b774718115"

saucelabs@^1.5.0:
Expand Down