Drop legacy browser support (#8009)

* Drop legacy browser support

* Docs

* Use rollup-plugin-istanbul for coverage

* exclude node_modules from coverage

* No cleanup() when doing coverage
This commit is contained in:
Jukka Kurkela 2020-11-16 21:01:33 +02:00 committed by GitHub
parent 988c865599
commit 910158055f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 103 additions and 2221 deletions

View File

@ -1,4 +1,4 @@
> 0.5% defaults
last 2 versions not IE 11
Firefox ESR not IE_Mob 11
not dead maintained node versions

View File

@ -7,8 +7,6 @@ env:
browser: true browser: true
node: true node: true
parser: babel-eslint
parserOptions: parserOptions:
ecmaVersion: 7 ecmaVersion: 7
sourceType: module sourceType: module

View File

@ -1,19 +0,0 @@
{
"presets": [
[
"@babel/preset-env", {
"loose": true
}
]
],
"plugins": [
"@babel/plugin-transform-object-assign"
],
"env": {
"test": {
"plugins": [
"istanbul"
]
}
}
}

View File

@ -22,13 +22,14 @@ Latest builds are available for testing at:
## Browser support ## Browser support
Chart.js offers support for the following browsers: All modern and up-to-date browsers are supported, including, but not limited to:
- Chrome 50+ Chrome
- Firefox 45+ Edge
- Internet Explorer 11 Firefox
- Edge 14+ Safari
- Safari 9+
As of version 3, we have dropped Internet Explorer 11 support.
Browser support for the canvas element is available in all modern & major mobile browsers. [CanIUse](https://caniuse.com/#feat=canvas) Browser support for the canvas element is available in all modern & major mobile browsers. [CanIUse](https://caniuse.com/#feat=canvas)

View File

@ -1,12 +1,12 @@
/* eslint-disable import/no-commonjs */ /* eslint-disable import/no-commonjs */
const commonjs = require('@rollup/plugin-commonjs'); const commonjs = require('@rollup/plugin-commonjs');
const istanbul = require('rollup-plugin-istanbul');
const json = require('@rollup/plugin-json'); const json = require('@rollup/plugin-json');
const resolve = require('@rollup/plugin-node-resolve').default; const resolve = require('@rollup/plugin-node-resolve').default;
const builds = require('./rollup.config'); const builds = require('./rollup.config');
const yargs = require('yargs'); const yargs = require('yargs');
module.exports = function(karma) { module.exports = function(karma) {
const args = yargs const args = yargs
.option('verbose', {default: false}) .option('verbose', {default: false})
@ -22,6 +22,14 @@ module.exports = function(karma) {
const regex = karma.autoWatch ? /chart\.js$/ : /chart\.min\.js$/; const regex = karma.autoWatch ? /chart\.js$/ : /chart\.min\.js$/;
const build = builds.filter(v => v.output.file && v.output.file.match(regex))[0]; const build = builds.filter(v => v.output.file && v.output.file.match(regex))[0];
if (args.coverage) {
build.plugins = [
json(),
resolve(),
istanbul({exclude: ['node_modules/**/*.js', 'package.json']})
];
}
karma.set({ karma.set({
frameworks: ['jasmine'], frameworks: ['jasmine'],
reporters: ['progress', 'kjhtml'], reporters: ['progress', 'kjhtml'],
@ -101,11 +109,6 @@ module.exports = function(karma) {
browserDisconnectTolerance: 3 browserDisconnectTolerance: 3
}); });
// https://swizec.com/blog/how-to-run-javascript-tests-in-chrome-on-travis/swizec/6647
if (process.env.TRAVIS) {
karma.customLaunchers.chrome.flags.push('--no-sandbox');
}
if (args.coverage) { if (args.coverage) {
karma.reporters.push('coverage'); karma.reporters.push('coverage');
karma.coverageReporter = { karma.coverageReporter = {

2241
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -44,16 +44,11 @@
"typedoc": "npx typedoc" "typedoc": "npx typedoc"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.3",
"@babel/plugin-transform-object-assign": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"@kurkle/color": "^0.1.9", "@kurkle/color": "^0.1.9",
"@rollup/plugin-commonjs": "^16.0.0", "@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-inject": "^4.0.2", "@rollup/plugin-inject": "^4.0.2",
"@rollup/plugin-json": "^4.1.0", "@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^10.0.0", "@rollup/plugin-node-resolve": "^10.0.0",
"babel-plugin-istanbul": "^6.0.0",
"babel-preset-es2015-rollup": "^3.0.0",
"chartjs-adapter-moment": "^0.1.2", "chartjs-adapter-moment": "^0.1.2",
"concurrently": "^5.3.0", "concurrently": "^5.3.0",
"coveralls": "^3.1.0", "coveralls": "^3.1.0",
@ -76,12 +71,10 @@
"karma-safari-private-launcher": "^1.0.0", "karma-safari-private-launcher": "^1.0.0",
"moment": "^2.29.1", "moment": "^2.29.1",
"pixelmatch": "^5.2.1", "pixelmatch": "^5.2.1",
"promise-polyfill": "^8.2.0",
"resize-observer-polyfill": "^1.5.1",
"rollup": "^2.33.1", "rollup": "^2.33.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-cleanup": "^3.2.1", "rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-dts": "^1.4.13", "rollup-plugin-dts": "^1.4.13",
"rollup-plugin-istanbul": "^2.0.1",
"rollup-plugin-terser": "^7.0.2", "rollup-plugin-terser": "^7.0.2",
"typedoc": "^0.19.2", "typedoc": "^0.19.2",
"typescript": "^4.0.5", "typescript": "^4.0.5",

View File

@ -1,10 +1,8 @@
/* eslint-disable import/no-commonjs */ /* eslint-disable import/no-commonjs */
/* eslint-env es6 */ /* eslint-env es6 */
const babel = require('rollup-plugin-babel');
const cleanup = require('rollup-plugin-cleanup'); const cleanup = require('rollup-plugin-cleanup');
const dts = require('rollup-plugin-dts').default; const dts = require('rollup-plugin-dts').default;
const inject = require('@rollup/plugin-inject');
const json = require('@rollup/plugin-json'); const json = require('@rollup/plugin-json');
const resolve = require('@rollup/plugin-node-resolve').default; const resolve = require('@rollup/plugin-node-resolve').default;
const terser = require('rollup-plugin-terser').terser; const terser = require('rollup-plugin-terser').terser;
@ -34,13 +32,8 @@ module.exports = [
{ {
input, input,
plugins: [ plugins: [
inject({
ResizeObserver: 'resize-observer-polyfill',
Promise: 'promise-polyfill'
}),
json(), json(),
resolve(), resolve(),
babel(),
cleanup({ cleanup({
sourcemap: true sourcemap: true
}) })
@ -56,13 +49,8 @@ module.exports = [
{ {
input, input,
plugins: [ plugins: [
inject({
ResizeObserver: 'resize-observer-polyfill',
Promise: 'promise-polyfill'
}),
json(), json(),
resolve(), resolve(),
babel(),
terser({ terser({
output: { output: {
preamble: banner preamble: banner

View File

@ -345,10 +345,7 @@ export class Legend extends Element {
ctx.lineWidth = lineWidth; ctx.lineWidth = lineWidth;
ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor); ctx.strokeStyle = valueOrDefault(legendItem.strokeStyle, defaultColor);
if (ctx.setLineDash) { ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));
// IE 9 and 10 do not support line dash
ctx.setLineDash(valueOrDefault(legendItem.lineDash, []));
}
if (labelOpts && labelOpts.usePointStyle) { if (labelOpts && labelOpts.usePointStyle) {
// Recalculate x and y for drawPoint() because its expecting // Recalculate x and y for drawPoint() because its expecting