mirror of
https://github.com/videojs/video.js.git
synced 2025-01-10 23:30:03 +02:00
chore: Update preset env, drop IE11 and older browser support (#7708)
This commit is contained in:
parent
3faa866834
commit
1281d68d78
13
.babelrc
13
.babelrc
@ -3,6 +3,19 @@
|
|||||||
[
|
[
|
||||||
"@babel/preset-env",
|
"@babel/preset-env",
|
||||||
{
|
{
|
||||||
|
"targets": [
|
||||||
|
"last 3 major versions",
|
||||||
|
"Firefox ESR",
|
||||||
|
"Chrome >= 53",
|
||||||
|
"not dead",
|
||||||
|
"not ie 11",
|
||||||
|
"not baidu 7",
|
||||||
|
"not and_qq 11",
|
||||||
|
"not and_uc 12",
|
||||||
|
"not kaios 2",
|
||||||
|
"not op_mini all",
|
||||||
|
"not op_mob 64"
|
||||||
|
],
|
||||||
"bugfixes": true,
|
"bugfixes": true,
|
||||||
"loose": true
|
"loose": true
|
||||||
}
|
}
|
||||||
|
13
.browserslistrc
Normal file
13
.browserslistrc
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Browsers that we support
|
||||||
|
|
||||||
|
last 3 major versions
|
||||||
|
Firefox ESR
|
||||||
|
Chrome >= 53
|
||||||
|
not dead
|
||||||
|
not ie 11
|
||||||
|
not baidu 7
|
||||||
|
not and_qq 11
|
||||||
|
not and_uc 12
|
||||||
|
not kaios 2
|
||||||
|
not op_mini all
|
||||||
|
not op_mob 64
|
@ -1,7 +1,5 @@
|
|||||||
// default is: > 0.5%, last 2 versions, Firefox ESR, not dead
|
|
||||||
// we add on ie 11 since we still support that.
|
|
||||||
// see https://github.com/browserslist/browserslist for more info
|
// see https://github.com/browserslist/browserslist for more info
|
||||||
const browsersList = ['defaults', 'ie 11'];
|
const browsersList = ['last 3 major version', 'Firefox ESR', 'Chrome >= 53', 'not dead', 'not ie 11'];
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
plugins: [
|
plugins: [
|
||||||
|
@ -57,6 +57,20 @@ const primedBabel = babel({
|
|||||||
compact: false,
|
compact: false,
|
||||||
presets: [
|
presets: [
|
||||||
['@babel/preset-env', {
|
['@babel/preset-env', {
|
||||||
|
targets: [
|
||||||
|
'last 3 major versions',
|
||||||
|
'Firefox ESR',
|
||||||
|
// This ensures support for certain smart TVs (ex. LG WebOS 4)
|
||||||
|
'Chrome >= 53',
|
||||||
|
'not dead',
|
||||||
|
'not ie 11',
|
||||||
|
'not baidu 7',
|
||||||
|
'not and_qq 11',
|
||||||
|
'not and_uc 12',
|
||||||
|
'not kaios 2',
|
||||||
|
'not op_mini all',
|
||||||
|
'not op_mob 64'
|
||||||
|
],
|
||||||
bugfixes: true,
|
bugfixes: true,
|
||||||
loose: true,
|
loose: true,
|
||||||
modules: false
|
modules: false
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import _inherits from '@babel/runtime/helpers/inherits';
|
import _inherits from '@babel/runtime/helpers/inherits';
|
||||||
import log from './utils/log.js';
|
import log from './utils/log';
|
||||||
|
|
||||||
let hasLogged = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to subclass an existing class by emulating ES subclassing using the
|
* Used to subclass an existing class by emulating ES subclassing using the
|
||||||
@ -29,21 +27,24 @@ let hasLogged = false;
|
|||||||
*
|
*
|
||||||
* @return {Function}
|
* @return {Function}
|
||||||
* The new class with subClassMethods that inherited superClass.
|
* The new class with subClassMethods that inherited superClass.
|
||||||
|
*
|
||||||
|
* @deprecated videojs.extend() is deprecated as of v8; use native ES6 classes instead
|
||||||
*/
|
*/
|
||||||
const extend = function(superClass, subClassMethods = {}) {
|
const extend = function(superClass, subClassMethods = {}) {
|
||||||
|
log.warn('The extend() method is deprecated. Please use native ES6 classes instead.');
|
||||||
|
|
||||||
// Log a warning the first time extend is called to note that it is deprecated
|
const isNativeClass = superClass && /^class/.test(superClass.toString());
|
||||||
// It was previously deprecated in our documentation (guides, specifically),
|
|
||||||
// but was never formally deprecated in code.
|
|
||||||
if (!hasLogged) {
|
|
||||||
log.warn('videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0');
|
|
||||||
hasLogged = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
let subClass = function() {
|
let subClass = function() {
|
||||||
superClass.apply(this, arguments);
|
superClass.apply(this, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// If the provided super class is a native ES6 class,
|
||||||
|
// make the sub class one as well.
|
||||||
|
if (isNativeClass) {
|
||||||
|
subClass = class SubClass extends superClass {};
|
||||||
|
}
|
||||||
|
|
||||||
let methods = {};
|
let methods = {};
|
||||||
|
|
||||||
if (typeof subClassMethods === 'object') {
|
if (typeof subClassMethods === 'object') {
|
||||||
@ -55,7 +56,9 @@ const extend = function(superClass, subClassMethods = {}) {
|
|||||||
subClass = subClassMethods;
|
subClass = subClassMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
_inherits(subClass, superClass);
|
if (!isNativeClass) {
|
||||||
|
_inherits(subClass, superClass);
|
||||||
|
}
|
||||||
|
|
||||||
// this is needed for backward-compatibility and node compatibility.
|
// this is needed for backward-compatibility and node compatibility.
|
||||||
if (superClass) {
|
if (superClass) {
|
||||||
|
@ -4,27 +4,52 @@ import extend from '../../src/js/extend.js';
|
|||||||
QUnit.module('extend.js');
|
QUnit.module('extend.js');
|
||||||
|
|
||||||
QUnit.test('should add implicit parent constructor call', function(assert) {
|
QUnit.test('should add implicit parent constructor call', function(assert) {
|
||||||
let superCalled = false;
|
assert.expect(4);
|
||||||
const Parent = function() {
|
|
||||||
superCalled = true;
|
|
||||||
};
|
|
||||||
const Child = extend(Parent, {
|
|
||||||
foo: 'bar'
|
|
||||||
});
|
|
||||||
const child = new Child();
|
|
||||||
|
|
||||||
assert.ok(superCalled, 'super constructor called');
|
let superCalled = false;
|
||||||
assert.ok(child.foo, 'child properties set');
|
|
||||||
|
[
|
||||||
|
function() {
|
||||||
|
superCalled = true;
|
||||||
|
},
|
||||||
|
class Parent {
|
||||||
|
constructor() {
|
||||||
|
superCalled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
].forEach(Parent => {
|
||||||
|
const Child = extend(Parent, {
|
||||||
|
foo: 'bar'
|
||||||
|
});
|
||||||
|
const child = new Child();
|
||||||
|
|
||||||
|
assert.ok(superCalled, 'super constructor called');
|
||||||
|
assert.ok(child.foo, 'child properties set');
|
||||||
|
|
||||||
|
superCalled = false;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should have a super_ pointer', function(assert) {
|
QUnit.test('should have a super_ pointer', function(assert) {
|
||||||
const Parent = function() {};
|
assert.expect(4);
|
||||||
|
|
||||||
|
[function() {}, class Parent {}].forEach(Parent => {
|
||||||
|
const Child = extend(Parent, {
|
||||||
|
foo: 'bar'
|
||||||
|
});
|
||||||
|
const child = new Child();
|
||||||
|
|
||||||
|
assert.ok(child.foo, 'child properties set');
|
||||||
|
assert.equal(child.constructor.super_, Parent, 'super_ is present and equal to the super class');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
QUnit.test('sub class is an ES6 class if the super class is', function(assert) {
|
||||||
|
class Parent {}
|
||||||
|
|
||||||
const Child = extend(Parent, {
|
const Child = extend(Parent, {
|
||||||
foo: 'bar'
|
foo: 'bar'
|
||||||
});
|
});
|
||||||
|
|
||||||
const child = new Child();
|
assert.ok(/^class/.test(Child.toString()), 'sub class is native es6 class');
|
||||||
|
|
||||||
assert.ok(child.foo, 'child properties set');
|
|
||||||
assert.equal(child.constructor.super_, Parent, 'super_ is present and equal to the super class');
|
|
||||||
});
|
});
|
||||||
|
@ -463,7 +463,9 @@ QUnit.test('if preloadTextTracks is false, default tracks are not parsed until m
|
|||||||
|
|
||||||
window.WebVTT = () => {};
|
window.WebVTT = () => {};
|
||||||
window.WebVTT.StringDecoder = () => {};
|
window.WebVTT.StringDecoder = () => {};
|
||||||
window.WebVTT.Parser = () => {
|
|
||||||
|
// This needs to be function expression rather than arrow function so it is constructable
|
||||||
|
window.WebVTT.Parser = function() {
|
||||||
parserCreated = true;
|
parserCreated = true;
|
||||||
return {
|
return {
|
||||||
oncue() {},
|
oncue() {},
|
||||||
@ -508,7 +510,9 @@ QUnit.test('tracks are parsed if vttjs is loaded', function(assert) {
|
|||||||
|
|
||||||
window.WebVTT = () => {};
|
window.WebVTT = () => {};
|
||||||
window.WebVTT.StringDecoder = () => {};
|
window.WebVTT.StringDecoder = () => {};
|
||||||
window.WebVTT.Parser = () => {
|
|
||||||
|
// This needs to be function expression rather than arrow function so it is constructable
|
||||||
|
window.WebVTT.Parser = function() {
|
||||||
parserCreated = true;
|
parserCreated = true;
|
||||||
return {
|
return {
|
||||||
oncue() {},
|
oncue() {},
|
||||||
@ -547,7 +551,9 @@ QUnit.test('tracks are loaded withCredentials is crossorigin is set to use-crede
|
|||||||
|
|
||||||
window.WebVTT = () => {};
|
window.WebVTT = () => {};
|
||||||
window.WebVTT.StringDecoder = () => {};
|
window.WebVTT.StringDecoder = () => {};
|
||||||
window.WebVTT.Parser = () => {
|
|
||||||
|
// This needs to be function expression rather than arrow function so it is constructable
|
||||||
|
window.WebVTT.Parser = function() {
|
||||||
return {
|
return {
|
||||||
oncue() {},
|
oncue() {},
|
||||||
onparsingerror() {},
|
onparsingerror() {},
|
||||||
@ -619,7 +625,9 @@ QUnit.test('tracks are parsed once vttjs is loaded', function(assert) {
|
|||||||
|
|
||||||
window.WebVTT = () => {};
|
window.WebVTT = () => {};
|
||||||
window.WebVTT.StringDecoder = () => {};
|
window.WebVTT.StringDecoder = () => {};
|
||||||
window.WebVTT.Parser = () => {
|
|
||||||
|
// This needs to be function expression rather than arrow function so it is constructable
|
||||||
|
window.WebVTT.Parser = function() {
|
||||||
parserCreated = true;
|
parserCreated = true;
|
||||||
return {
|
return {
|
||||||
oncue() {},
|
oncue() {},
|
||||||
|
Loading…
Reference in New Issue
Block a user