From 8e9d3df20667e8d0aebccb011f8b97baf5253491 Mon Sep 17 00:00:00 2001 From: the1812 Date: Thu, 9 Jun 2022 22:05:13 +0800 Subject: [PATCH 1/2] Fix PR check --- .github/workflows/pull-request-check.yml | 2 +- package.json | 1 + registry/lib/components/video/player/skip-charge-list/index.ts | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pull-request-check.yml b/.github/workflows/pull-request-check.yml index 5eebcb40a..897881609 100644 --- a/.github/workflows/pull-request-check.yml +++ b/.github/workflows/pull-request-check.yml @@ -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 diff --git a/package.json b/package.json index 137c2b7db..fedf7a28b 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/registry/lib/components/video/player/skip-charge-list/index.ts b/registry/lib/components/video/player/skip-charge-list/index.ts index 86cfc90bb..f0b7e006e 100644 --- a/registry/lib/components/video/player/skip-charge-list/index.ts +++ b/registry/lib/components/video/player/skip-charge-list/index.ts @@ -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() }) From 5106c95401c4eed537910df2bd06bfa0544153c6 Mon Sep 17 00:00:00 2001 From: the1812 Date: Fri, 10 Jun 2022 08:40:43 +0800 Subject: [PATCH 2/2] Fix feature code return value --- src/core/external-input/load-feature-code.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/external-input/load-feature-code.ts b/src/core/external-input/load-feature-code.ts index 0314bff79..53031976a 100644 --- a/src/core/external-input/load-feature-code.ts +++ b/src/core/external-input/load-feature-code.ts @@ -90,13 +90,17 @@ const loadFeatureCode = async ( ): Promise> => { // 收集代码导出值 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)