From 3189ac1e7fea892030b150b97d5327ae47f36806 Mon Sep 17 00:00:00 2001 From: shiyiya Date: Fri, 15 Mar 2024 22:29:14 +0800 Subject: [PATCH] update scripts. --- packages/core/src/player.ts | 1 + packages/plugins/build-plugins.js | 11 ++++++----- packages/plugins/package.json | 12 ++++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/packages/core/src/player.ts b/packages/core/src/player.ts index 15090c81..ddee9c36 100644 --- a/packages/core/src/player.ts +++ b/packages/core/src/player.ts @@ -415,6 +415,7 @@ export class Player = Record> { return new Promise((resolve, reject) => { if (this.isSourceChanging) return reject(Error('Previous Source is Changing.')) + this.pause() this.hasError = false this.isSourceChanging = true this.emit(options.preEvent, sourceLike) diff --git a/packages/plugins/build-plugins.js b/packages/plugins/build-plugins.js index f4229c06..3ea006ab 100644 --- a/packages/plugins/build-plugins.js +++ b/packages/plugins/build-plugins.js @@ -15,7 +15,8 @@ const globals = { async function buildPlugin(name, dev) { const { version, description, author, homepage } = JSON.parse(fs.readFileSync(`package.json`, 'utf-8')) - const pluginName = name.split('.').shift() + const outfileName = name + const pluginName = name=='index'?'@oplayer/plugins':`@oplayer/${outfileName}` const now = Date.now() console.log(`👾 Start built ${pluginName} ··· `) @@ -27,15 +28,15 @@ async function buildPlugin(name, dev) { lib: { entry: plugins[name], formats: dev ? ['es'] : ['es', 'umd'], - name: dev ? undefined : 'O' + pluginName.charAt(0).toUpperCase() + pluginName.slice(1), - fileName: (format) => `${pluginName}.${{ es: 'es', umd: 'min' }[format]}.js` + name: dev ? undefined : 'O' + outfileName.charAt(0).toUpperCase() + outfileName.slice(1), + fileName: (format) => `${outfileName}.${{ es: 'es', umd: 'min' }[format]}.js` }, rollupOptions: { external, output: { dir: 'dist', globals } } }, plugins: [ cssInjectedByJsPlugin(), banner( - `/**\n * name: ${name}\n * version: v${version}\n * description: ${description}\n * author: ${author}\n * homepage: ${homepage}\n */` + `/**\n * name: ${pluginName}\n * version: v${version}\n * description: ${description}\n * author: ${author}\n * homepage: ${homepage}\n */` ) ], define: { __VERSION__: `'${version}'` } @@ -85,5 +86,5 @@ if (process.argv.pop() == '--watch') { console.log(`✨ Finished building all plugins!`) }) - buildPlugin('index', true) + // buildPlugin('index', true) } diff --git a/packages/plugins/package.json b/packages/plugins/package.json index 6ff9b7c2..bd43a888 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,7 +1,14 @@ { "name": "@oplayer/plugins", "version": "1.0.10-beta.2", + "author": "shiyiya", "description": "oplayer's plugin", + "homepage": "https://github.com/shiyiya/oplayer", + "keywords": [ + "oplayer", + "oplayer-plugins" + ], + "license": "MIT", "type": "module", "main": "dist/index.es.js", "types": "dist/index.d.ts", @@ -22,8 +29,5 @@ "glob": "^10.3.10", "m3u8-parser": "^7.1.0", "vite-plugin-css-injected-by-js": "^3.4.0" - }, - "keywords": [], - "author": "", - "license": "ISC" + } }