Skip to content

Commit

Permalink
[build] 1.4.0
Browse files Browse the repository at this point in the history
support startLoad and stopLoad as required in Chimeejs/chimee#70
  • Loading branch information
toxic-johann committed Jan 17, 2018
1 parent cbb9a54 commit f8c577c
Show file tree
Hide file tree
Showing 14 changed files with 333 additions and 153 deletions.
22 changes: 13 additions & 9 deletions build/rollup.config.base.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
const { version, name, author, license, dependencies } = require('../package.json');
const banner = `
export const banner = `
/**
* ${name} v${version}
* (c) 2017-${(new Date().getFullYear())} ${author}
* (c) 2017-${(new Date()).getFullYear()} ${author}
* Released under ${license}
*/
`;
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
const babelConfig = {
common: {
presets: [
Expand Down Expand Up @@ -119,16 +119,20 @@ const externalRegExp = new RegExp(Object.keys(dependencies).join('|'));
export default function(mode) {
return {
input: 'src/index.js',
banner,
external(id) {
return !/min|umd|iife/.test(mode) && externalRegExp.test(id);
},
plugins: [
babel(babelConfig[mode]),
resolve(),
resolve({
customResolveOptions: {
moduleDirectory: [ 'src', 'node_modules' ],
},
preferBuiltins: true,
}),
commonjs(),
replace({
'process.env.KERNEL_VERSION': `'${version}'`,
'process.env.VERSION': `'${version}'`,
}),
],
};
Expand Down
3 changes: 2 additions & 1 deletion build/rollup.config.common.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base from './rollup.config.base';
import base, { banner } from './rollup.config.base';
export default Object.assign(base('common'), {
output: {
banner,
format: 'cjs',
file: 'lib/index.js',
},
Expand Down
16 changes: 5 additions & 11 deletions build/rollup.config.dev.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
import base from './rollup.config.base';
import base, { banner } from './rollup.config.base';
import serve from 'rollup-plugin-serve';
import livereload from 'rollup-plugin-livereload';
import replace from 'rollup-plugin-replace';
import { camelize } from 'toxic-utils';
const { name } = require('../package.json');

const config = base('iife');
config.plugins.push(
serve({
open: false,
verbose: true,
contentBase: '',
historyApiFallback: false,
host: 'localhost',
}),
serve(),
livereload()
);
config.plugins.unshift(replace({
'process.env.NODE_ENV': '"development"',
}));
export default Object.assign(config, {
output: {
format: 'iife',
banner,
format: 'umd',
file: 'lib/index.dev.js',
name: camelize(name, true),
},
name: camelize(name, true),
});
3 changes: 2 additions & 1 deletion build/rollup.config.es.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import base from './rollup.config.base';
import base, { banner } from './rollup.config.base';
export default Object.assign(base('es'), {
output: {
banner,
format: 'es',
file: 'lib/index.mjs',
},
Expand Down
7 changes: 4 additions & 3 deletions build/rollup.config.min.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import base from './rollup.config.base';
import base, { banner } from './rollup.config.base';
import uglify from 'rollup-plugin-uglify';
import replace from 'rollup-plugin-replace';
const { name } = require('../package.json');
Expand All @@ -7,11 +7,12 @@ const config = base('min');
config.plugins.unshift(replace({
'process.env.NODE_ENV': '"production"',
}));
config.plugins.push(uglify());
config.plugins.push(uglify({}));
export default Object.assign(config, {
output: {
banner,
format: 'umd',
file: 'lib/index.min.js',
name: camelize(name, true),
},
name: camelize(name, true),
});
5 changes: 3 additions & 2 deletions build/rollup.config.umd.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import base from './rollup.config.base';
import base, { banner } from './rollup.config.base';
const { name } = require('../package.json');
import { camelize } from 'toxic-utils';
import replace from 'rollup-plugin-replace';
Expand All @@ -8,8 +8,9 @@ config.plugins.unshift(replace({
}));
export default Object.assign(config, {
output: {
banner,
format: 'umd',
file: 'lib/index.browser.js',
name: camelize(name, true),
},
name: camelize(name, true),
});
61 changes: 61 additions & 0 deletions demo/min/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
html, body {
width: 100%;
margin: 0;
padding: 0;
}
html {
background-color: #FFFBE6;
font-family: "Oswald", "HelveticaNeue-CondensedBold", "Arial Narrow", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", sans-serif;
background-repeat: no-repeat;
min-height: 100%;
}
body {
padding: 10px;
box-sizing: border-box;
color: #36384A;
max-width: 800px;
margin: auto;
}
#wrapper {
position: relative;
width: 100%;
height: 100%;
}
container {
position: relative;
display: block;
/* width: 100%;
height: 100%; */
}
video {
/* width: 100%;
height: 100%; */
display: block;
background-color: #000;
}
video:focus,
video:active {
outline: none;
}
button {
color: #fff;
background-color: #3F4F68;
padding: 6px 12px;
text-decoration: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
border-radius: 4px;
text-transform: none;
outline: none;
border: none;
margin-bottom: 2px;
}
h1 {
color: #9D295A;
}
button:active {
background-color: #36384A;
}

33 changes: 33 additions & 0 deletions demo/min/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<title>Native test demo</title>
<meta charset="utf-8">
<meta name="description" content="Chimee Player Demo">
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1, maximum-scale=1">
<meta name="mobile-web-app-capable" content="yes">
<link rel="stylesheet" type="text/css" href="./index.css">
</head>
<body>
<header>
<h1>Native Demo</h1>
</header>
<video id="player" controls="controls" width="800" height="500" muted></video>
</body>
<script type="text/javascript" src="../../lib/index.min.js"></script>
<script type="text/javascript" src="../base.js"></script>
<script type="text/javascript">
// mp4 http://cdn.toxicjohann.com/lostStar.mp4
// hls http://yunxianchang.live.ujne7.com/vod-system-bj/44_176_20170224113626af3a75cd-3508-4bc3-b51f-366fca3c7e39.m3u8
// flv直播 http://pf.live.360vcloud.net/live_customers3/6818c55761856069a0ce
// flv直播 http://flv.jia.360.cn/live_jia_public/_LC_RE_non_3605375765815007736131516144_BX.flv
// flv点播 http://yunxianchang.live.ujne7.com/vod-system-bj/TL1ce1196bce348070bfeef2116efbdea6.flv
// flv点播 http://yunxianchang.live.ujne7.com/vod-system-bj/TL2791e64b69ea0bea234c284c694986aa.flv
window.kernelConfig = {
src: 'http://cdn.toxicjohann.com/lostStar.mp4',
box: 'native',
isLive: false,
};
window.start();
</script>
</html>
Loading

0 comments on commit f8c577c

Please sign in to comment.