Merge branch 'the1812:preview-fixes' into preview-fixes

This commit is contained in:
imshixin 2022-06-10 11:10:44 +08:00 committed by GitHub
commit 40532b688a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 3 deletions

View File

@ -26,7 +26,7 @@ jobs:
run: yarn type
- name: ESLint check
run: yarn lint
run: yarn lint-check
- name: Build core
run: yarn build-core

View File

@ -9,6 +9,7 @@
"build-core": "webpack --config ./webpack/webpack.prod.js --bail",
"build-features": "webpack --config ./registry/webpack/all.js --bail",
"lint": "eslint --config ./.eslintrc.js --quiet --fix \"src/**/*.@(js|ts|vue)\" \"registry/lib/**/*.@(js|ts|vue)\"",
"lint-check": "eslint --config ./.eslintrc.js \"src/**/*.@(js|ts|vue)\" \"registry/lib/**/*.@(js|ts|vue)\"",
"type": "tsc -p tsconfig.type-check.json --noEmit"
},
"devDependencies": {

View File

@ -13,7 +13,7 @@ const entry = styledComponentEntry(() => import('./charge-list.scss'), async ()
if (document.body.classList.contains(SkipChargeListDisabledClass)) {
return
}
//选择2.X或3.X的跳过按钮
// 选择2.X或3.X的跳过按钮
const jumpButton = await select('.bilibili-player-electric-panel-jump,.bpx-player-electric-jump') as HTMLElement
jumpButton?.click()
})

View File

@ -90,13 +90,17 @@ const loadFeatureCode = async <X extends FeatureBase>(
): Promise<LoadFeatureCodeResult<X>> => {
// 收集代码导出值
const exports = {}
let result: X
try {
eval(code)
result = eval(code)
} catch (thrown) {
return codeThrewResult(thrown)
}
const values = Object.values(exports)
if (values.length === 0) {
if (typeof result === 'object') {
return okResult(result)
}
return noExportResult
}
return okResult(values[0] as X)