add build:all

This commit is contained in:
Harvey committed 2022-04-28 13:28:51 +08:00
1 parent db66272555
commit c551231edc
3 files changed
+33 -25

No files matched your search

+1
View File
@@ -4,6 +4,7 @@
"type": "module",
"description": "ArtPlayer.js is a modern and full featured HTML5 video player",
"scripts": {
"build:all": "npm run build all",
"bootstrap": "npx lerna bootstrap",
"lint": "npx eslint packages/*/src",
"build:sw": "node ./scripts/build-sw.js",
+1 -1
View File
@@ -4,4 +4,4 @@
* (c) 2017-2022 Harvey Zack
* Released under the MIT License.
*/
!function(e,t,r,o,i){var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof n.parcelRequire4dc0&&n.parcelRequire4dc0,a=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!a[t]){if(!e[t]){var o="function"==typeof n.parcelRequire4dc0&&n.parcelRequire4dc0;if(!r&&o)return o(t,!0);if(s)return s(t,!0);if(l&&"string"==typeof t)return l(t);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},u.cache={};var p=a[t]=new c.Module(t);e[t][0].call(p.exports,u,p,p.exports,this)}return a[t].exports;function u(e){var t=u.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=a,c.parent=s,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return n.parcelRequire4dc0}}),n.parcelRequire4dc0=c;for(var p=0;p<t.length;p++)c(t[p]);var u=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({"6SN6P":[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("bundle-text:./style/index.less"),n=o.interopDefault(i),s=e("option-validator"),a=o.interopDefault(s),l=e("./utils/emitter"),c=o.interopDefault(l),p=e("./utils"),u=e("./scheme"),d=o.interopDefault(u),f=e("./config"),h=o.interopDefault(f),m=e("./whitelist"),g=o.interopDefault(m),v=e("./template"),y=o.interopDefault(v),b=e("./i18n"),x=o.interopDefault(b),w=e("./player"),j=o.interopDefault(w),k=e("./control"),S=o.interopDefault(k),I=e("./contextmenu"),R=o.interopDefault(I),$=e("./info"),O=o.interopDefault($),T=e("./subtitle"),M=o.interopDefault(T),E=e("./events"),F=o.interopDefault(E),C=e("./hotkey"),D=o.interopDefault(C),A=e("./layer"),P=o.interopDefault(A),z=e("./loading"),U=o.interopDefault(z),_=e("./notice"),Z=o.interopDefault(_),H=e("./mask"),L=o.interopDefault(H),q=e("./icons"),N=o.interopDefault(q),W=e("./setting"),V=o.interopDefault(W),B=e("./storage"),Y=o.interopDefault(B),Q=e("./plugins"),X=o.interopDefault(Q),J=e("./ads"),K=o.interopDefault(J),G=e("./mobile"),ee=o.interopDefault(G);let te=0;const re=[];class oe extends c.default{constructor(e,t){super(),this.id=++te;const r=p.mergeDeep(oe.option,e);this.option=a.default(r,d.default),this.isReady=!1,this.isFocus=!1,this.isDestroy=!1,this.whitelist=new g.default(this),this.template=new y.default(this),this.events=new F.default(this),this.whitelist.state?(this.storage=new Y.default(this),this.icons=new N.default(this),this.i18n=new x.default(this),this.notice=new Z.default(this),this.player=new j.default(this),this.layers=new P.default(this),this.controls=new S.default(this),this.contextmenu=new R.default(this),this.subtitle=new M.default(this),this.ads=new K.default(this),this.info=new O.default(this),this.loading=new U.default(this),this.hotkey=new D.default(this),this.mask=new L.default(this),this.setting=new V.default(this),this.plugins=new X.default(this)):this.mobile=new ee.default(this),"function"==typeof t&&this.on("ready",(()=>t.call(this))),re.push(this)}static get instances(){return re}static get version(){return"4.3.12"}static get env(){return"production"}static get build(){return"1651122925814"}static get config(){return h.default}static get utils(){return p}static get scheme(){return d.default}static get Emitter(){return c.default}static get validator(){return a.default}static get kindOf(){return a.default.kindOf}static get html(){return y.default.html}static get option(){return{container:"#artplayer",url:"",poster:"",title:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!1,fastForward:!1,autoPlayback:!1,autoOrientation:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:p.isSafari?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}destroy(e=!0){this.events.destroy(),this.template.destroy(e),re.splice(re.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}r.default=oe,oe.NOTICE_TIME=2e3,oe.SETTING_WIDTH=250,oe.SETTING_ITEM_WIDTH=200,oe.INDICATOR_SIZE=14,oe.INDICATOR_SIZE_ICON=16,oe.INDICATOR_SIZE_MOBILE=18,oe.INDICATOR_SIZE_MOBILE_ICON=20,oe.VOLUME_PANEL_WIDTH=60,oe.VOLUME_HANDLE_WIDTH=12,oe.RESIZE_TIME=500,oe.SCROLL_TIME=200,oe.SCROLL_Line truncated
!function(e,t,r,o,i){var n="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},s="function"==typeof n.parcelRequire4dc0&&n.parcelRequire4dc0,a=s.cache||{},l="undefined"!=typeof module&&"function"==typeof module.require&&module.require.bind(module);function c(t,r){if(!a[t]){if(!e[t]){var o="function"==typeof n.parcelRequire4dc0&&n.parcelRequire4dc0;if(!r&&o)return o(t,!0);if(s)return s(t,!0);if(l&&"string"==typeof t)return l(t);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}u.resolve=function(r){var o=e[t][1][r];return null!=o?o:r},u.cache={};var p=a[t]=new c.Module(t);e[t][0].call(p.exports,u,p,p.exports,this)}return a[t].exports;function u(e){var t=u.resolve(e);return!1===t?{}:c(t)}}c.isParcelRequire=!0,c.Module=function(e){this.id=e,this.bundle=c,this.exports={}},c.modules=e,c.cache=a,c.parent=s,c.register=function(t,r){e[t]=[function(e,t){t.exports=r},{}]},Object.defineProperty(c,"root",{get:function(){return n.parcelRequire4dc0}}),n.parcelRequire4dc0=c;for(var p=0;p<t.length;p++)c(t[p]);var u=c(r);"object"==typeof exports&&"undefined"!=typeof module?module.exports=u:"function"==typeof define&&define.amd&&define((function(){return u}))}({"6SN6P":[function(e,t,r){var o=e("@parcel/transformer-js/src/esmodule-helpers.js");o.defineInteropFlag(r);var i=e("bundle-text:./style/index.less"),n=o.interopDefault(i),s=e("option-validator"),a=o.interopDefault(s),l=e("./utils/emitter"),c=o.interopDefault(l),p=e("./utils"),u=e("./scheme"),d=o.interopDefault(u),f=e("./config"),h=o.interopDefault(f),m=e("./whitelist"),g=o.interopDefault(m),v=e("./template"),y=o.interopDefault(v),b=e("./i18n"),x=o.interopDefault(b),w=e("./player"),j=o.interopDefault(w),k=e("./control"),S=o.interopDefault(k),I=e("./contextmenu"),R=o.interopDefault(I),$=e("./info"),O=o.interopDefault($),T=e("./subtitle"),M=o.interopDefault(T),E=e("./events"),F=o.interopDefault(E),C=e("./hotkey"),D=o.interopDefault(C),A=e("./layer"),P=o.interopDefault(A),z=e("./loading"),U=o.interopDefault(z),_=e("./notice"),Z=o.interopDefault(_),H=e("./mask"),L=o.interopDefault(H),q=e("./icons"),N=o.interopDefault(q),W=e("./setting"),V=o.interopDefault(W),B=e("./storage"),Y=o.interopDefault(B),Q=e("./plugins"),X=o.interopDefault(Q),J=e("./ads"),K=o.interopDefault(J),G=e("./mobile"),ee=o.interopDefault(G);let te=0;const re=[];class oe extends c.default{constructor(e,t){super(),this.id=++te;const r=p.mergeDeep(oe.option,e);this.option=a.default(r,d.default),this.isReady=!1,this.isFocus=!1,this.isDestroy=!1,this.whitelist=new g.default(this),this.template=new y.default(this),this.events=new F.default(this),this.whitelist.state?(this.storage=new Y.default(this),this.icons=new N.default(this),this.i18n=new x.default(this),this.notice=new Z.default(this),this.player=new j.default(this),this.layers=new P.default(this),this.controls=new S.default(this),this.contextmenu=new R.default(this),this.subtitle=new M.default(this),this.ads=new K.default(this),this.info=new O.default(this),this.loading=new U.default(this),this.hotkey=new D.default(this),this.mask=new L.default(this),this.setting=new V.default(this),this.plugins=new X.default(this)):this.mobile=new ee.default(this),"function"==typeof t&&this.on("ready",(()=>t.call(this))),re.push(this)}static get instances(){return re}static get version(){return"4.3.12"}static get env(){return"production"}static get build(){return"1651123710801"}static get config(){return h.default}static get utils(){return p}static get scheme(){return d.default}static get Emitter(){return c.default}static get validator(){return a.default}static get kindOf(){return a.default.kindOf}static get html(){return y.default.html}static get option(){return{container:"#artplayer",url:"",poster:"",title:"",type:"",theme:"#f00",volume:.7,isLive:!1,muted:!1,autoplay:!1,autoSize:!1,autoMini:!1,loop:!1,flip:!1,playbackRate:!1,aspectRatio:!1,screenshot:!1,setting:!1,hotkey:!0,pip:!1,mutex:!0,backdrop:!0,fullscreen:!1,fullscreenWeb:!1,subtitleOffset:!1,miniProgressBar:!1,useSSR:!1,playsInline:!0,lock:!1,fastForward:!1,autoPlayback:!1,autoOrientation:!1,ads:[],layers:[],contextmenu:[],controls:[],settings:[],quality:[],highlight:[],plugins:[],whitelist:[],thumbnails:{url:"",number:60,column:10},subtitle:{url:"",type:"",style:{},encoding:"utf-8"},moreVideoAttr:{controls:!1,preload:p.isSafari?"auto":"metadata"},icons:{},customType:{},lang:navigator.language.toLowerCase()}}get proxy(){return this.events.proxy}get query(){return this.template.query}destroy(e=!0){this.events.destroy(),this.template.destroy(e),re.splice(re.indexOf(this),1),this.isDestroy=!0,this.emit("destroy")}}r.default=oe,oe.NOTICE_TIME=2e3,oe.SETTING_WIDTH=250,oe.SETTING_ITEM_WIDTH=200,oe.INDICATOR_SIZE=14,oe.INDICATOR_SIZE_ICON=16,oe.INDICATOR_SIZE_MOBILE=18,oe.INDICATOR_SIZE_MOBILE_ICON=20,oe.VOLUME_PANEL_WIDTH=60,oe.VOLUME_HANDLE_WIDTH=12,oe.RESIZE_TIME=500,oe.SCROLL_TIME=200,oe.SCROLL_Line truncated
+31 -24
View File
@@ -3,7 +3,7 @@ import inquirer from 'inquirer';
import projects from './projects.js';
import { Parcel } from '@parcel/core';
async function develop(name) {
async function build(name) {
const { version } = JSON.parse(fs.readFileSync(`${projects[name]}/package.json`, 'utf-8'));
process.chdir(projects[name]);
@@ -36,29 +36,36 @@ async function develop(name) {
' * Released under the MIT License.\n' +
' */\n';
try {
const { bundleGraph, buildTime } = await bundler.run();
const bundles = bundleGraph.getBundles();
const filePath = `${projects[name]}/dist/index.js`;
const newFilePath = `${projects[name]}/dist/${name}.js`;
const code = banner + fs.readFileSync(filePath);
fs.writeFileSync(filePath, code);
fs.renameSync(filePath, newFilePath);
console.log(`✨ Built ${name} ${bundles.length} bundles in ${buildTime}ms!`);
} catch (err) {
console.log(err.diagnostics);
}
const { bundleGraph, buildTime } = await bundler.run();
const bundles = bundleGraph.getBundles();
const filePath = `${projects[name]}/dist/index.js`;
const newFilePath = `${projects[name]}/dist/${name}.js`;
const code = banner + fs.readFileSync(filePath);
fs.writeFileSync(filePath, code);
fs.renameSync(filePath, newFilePath);
console.log(`✨ Built ${name} ${bundles.length} bundles in ${buildTime}ms!`);
}
inquirer
.prompt([
{
type: 'list',
message: 'Which project do you want to build?',
name: 'project',
choices: Object.keys(projects),
},
])
.then((answers) => {
develop(answers.project);
function runPromisesInSeries(ps) {
return ps.reduce((p, next) => p.then(next), Promise.resolve());
}
if (process.argv.pop() === 'all') {
const bundles = Object.keys(projects).map((name) => () => build(name));
runPromisesInSeries(bundles).then(() => {
console.log(`✨ Finished building all packages!`);
});
} else {
inquirer
.prompt([
{
type: 'list',
message: 'Which project do you want to build?',
name: 'project',
choices: Object.keys(projects),
},
])
.then((answers) => {
build(answers.project);
});
}