From 7a300d365c4117859bd520a68aa2cdfb55c24f7b Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Wed, 28 Feb 2024 15:22:00 -0800 Subject: [PATCH] core: remove pubads plugin --- build/build-bundle.js | 11 +--- cli/test/smokehouse/core-tests.js | 2 - .../smokehouse/test-definitions/pubads.js | 54 ------------------- clients/devtools/devtools-entry.js | 3 -- core/config/config-helpers.js | 2 +- core/scripts/release/package-test.sh | 3 -- package.json | 1 - .../e2e/lighthouse/navigation_test.ts | 1 - yarn.lock | 27 ---------- 9 files changed, 2 insertions(+), 102 deletions(-) delete mode 100644 cli/test/smokehouse/test-definitions/pubads.js diff --git a/build/build-bundle.js b/build/build-bundle.js index 93bcd1929300..51476e0b7bf5 100644 --- a/build/build-bundle.js +++ b/build/build-bundle.js @@ -17,8 +17,6 @@ import {createRequire} from 'module'; import esMain from 'es-main'; import esbuild from 'esbuild'; // @ts-expect-error: plugin has no types. -import PubAdsPlugin from 'lighthouse-plugin-publisher-ads'; -// @ts-expect-error: plugin has no types. import SoftNavPlugin from 'lighthouse-plugin-soft-navigation'; import * as plugins from './esbuild-plugins.js'; @@ -37,10 +35,7 @@ const require = createRequire(import.meta.url); const GIT_READABLE_REF = execSync(process.env.CI ? 'git rev-parse HEAD' : 'git describe').toString().trim(); -// HACK: manually include the lighthouse-plugin-publisher-ads audits. -/** @type {Array} */ -// @ts-expect-error -const pubAdsAudits = PubAdsPlugin.audits.map(a => a.path); +// HACK: manually include plugin audits. /** @type {Array} */ // @ts-expect-error const softNavAudits = SoftNavPlugin.audits.map(a => a.path); @@ -93,10 +88,6 @@ async function buildBundle(entryPath, distPath, opts = {minify: true}) { // Include plugins. if (isDevtools(entryPath) || isLightrider(entryPath)) { - dynamicModulePaths.push('lighthouse-plugin-publisher-ads'); - pubAdsAudits.forEach(pubAdAudit => { - dynamicModulePaths.push(pubAdAudit); - }); dynamicModulePaths.push('lighthouse-plugin-soft-navigation'); softNavAudits.forEach(softNavAudit => { dynamicModulePaths.push(softNavAudit); diff --git a/cli/test/smokehouse/core-tests.js b/cli/test/smokehouse/core-tests.js index f035211d31b1..14125209dd4d 100644 --- a/cli/test/smokehouse/core-tests.js +++ b/cli/test/smokehouse/core-tests.js @@ -44,7 +44,6 @@ import perfFonts from './test-definitions/perf-fonts.js'; import perfFrameMetrics from './test-definitions/perf-frame-metrics.js'; import perfPreload from './test-definitions/perf-preload.js'; import perfTraceElements from './test-definitions/perf-trace-elements.js'; -import pubads from './test-definitions/pubads.js'; import pwaAirhorner from './test-definitions/pwa-airhorner.js'; import pwaCaltrain from './test-definitions/pwa-caltrain.js'; import pwaChromestatus from './test-definitions/pwa-chromestatus.js'; @@ -109,7 +108,6 @@ const smokeTests = [ perfFrameMetrics, perfPreload, perfTraceElements, - pubads, pwaAirhorner, pwaCaltrain, pwaChromestatus, diff --git a/cli/test/smokehouse/test-definitions/pubads.js b/cli/test/smokehouse/test-definitions/pubads.js deleted file mode 100644 index 83e4126cf38a..000000000000 --- a/cli/test/smokehouse/test-definitions/pubads.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * @license Copyright 2020 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -/** @type {LH.Config} */ -const config = { - extends: 'lighthouse:default', - plugins: ['lighthouse-plugin-publisher-ads'], -}; - -/** - * @type {Smokehouse.ExpectedRunnerResult} - */ -const expectations = { - lhr: { - requestedUrl: 'http://localhost:10200/online-only.html', - finalDisplayedUrl: 'http://localhost:10200/online-only.html', - // We should receive warnings about no ads being on the page. - runWarnings: {length: '>0'}, - audits: { - // We just want to ensure the plugin had a chance to run without error. - 'tag-load-time': {scoreDisplayMode: 'notApplicable'}, - 'bid-request-from-page-start': {scoreDisplayMode: 'notApplicable'}, - 'ad-request-from-page-start': {scoreDisplayMode: 'notApplicable'}, - 'first-ad-render': {scoreDisplayMode: 'notApplicable'}, - 'cumulative-ad-shift': {scoreDisplayMode: 'notApplicable'}, - 'total-ad-blocking-time': {scoreDisplayMode: 'notApplicable'}, - 'gpt-bids-parallel': {scoreDisplayMode: 'notApplicable'}, - 'serial-header-bidding': {scoreDisplayMode: 'notApplicable'}, - 'bottleneck-requests': {scoreDisplayMode: 'notApplicable'}, - 'script-injected-tags': {scoreDisplayMode: 'notApplicable'}, - 'blocking-load-events': {scoreDisplayMode: 'notApplicable'}, - 'ad-render-blocking-resources': {scoreDisplayMode: 'notApplicable'}, - 'ad-blocking-tasks': {scoreDisplayMode: 'notApplicable'}, - 'ad-request-critical-path': {scoreDisplayMode: 'notApplicable'}, - 'ads-in-viewport': {scoreDisplayMode: 'notApplicable'}, - 'async-ad-tags': {scoreDisplayMode: 'notApplicable'}, - 'loads-ad-tag-over-https': {scoreDisplayMode: 'notApplicable'}, - 'loads-gpt-from-official-source': {scoreDisplayMode: 'notApplicable'}, - 'viewport-ad-density': {scoreDisplayMode: 'notApplicable'}, - 'ad-top-of-viewport': {scoreDisplayMode: 'notApplicable'}, - 'duplicate-tags': {scoreDisplayMode: 'notApplicable'}, - 'deprecated-gpt-api-usage': {scoreDisplayMode: 'notApplicable'}, - 'gpt-errors-overall': {scoreDisplayMode: 'notApplicable'}, - }, - }, -}; - -export default { - id: 'pubads', - expectations, - config, -}; diff --git a/clients/devtools/devtools-entry.js b/clients/devtools/devtools-entry.js index ec1ed11c965c..74c231482244 100644 --- a/clients/devtools/devtools-entry.js +++ b/clients/devtools/devtools-entry.js @@ -23,8 +23,6 @@ globalThis.Buffer = Buffer; /** * Returns a config, which runs only certain categories. * Varies the config to use based on device. - * If `lighthouse-plugin-publisher-ads` is in the list of - * `categoryIDs` the plugin will also be run. * Counterpart to the CDT code that sets flags. * @see https://source.chromium.org/chromium/chromium/src/+/main:third_party/devtools-frontend/src/front_end/panels/lighthouse/LighthouseController.ts;l=280 * @param {Array} categoryIDs @@ -49,7 +47,6 @@ function createConfig(categoryIDs, device) { return { extends: 'lighthouse:default', - plugins: ['lighthouse-plugin-publisher-ads'], settings, }; } diff --git a/core/config/config-helpers.js b/core/config/config-helpers.js index 39d6675e3e1c..27fd2e5640d1 100644 --- a/core/config/config-helpers.js +++ b/core/config/config-helpers.js @@ -287,7 +287,7 @@ function requireAudit(auditPath, coreAuditList, configDir) { let requirePath = `../audits/${auditPath}`; if (!coreAudit) { if (isBundledEnvironment()) { - // This is for pubads bundling. + // This is for plugin bundling. requirePath = auditPath; } else { // Otherwise, attempt to find it elsewhere. This throws if not found. diff --git a/core/scripts/release/package-test.sh b/core/scripts/release/package-test.sh index ebf166284aa8..5a63e21d977a 100644 --- a/core/scripts/release/package-test.sh +++ b/core/scripts/release/package-test.sh @@ -20,9 +20,6 @@ cd /tmp/lighthouse-local-test npm init -y npm install "$LH_ROOT/lighthouse-$VERSION.tgz" -# --force to ignore potentially off peer dependency on Lighthouse itself. This just ignores whatever -# Lighthouse version pubads declares, and defers to the version installed above. -npm install lighthouse-plugin-publisher-ads@next --force npm explore lighthouse -- npm run fast -- http://example.com --chrome-flags=--headless=new # Packaged smokehouse/lighthouse using root's static-server and test fixtures. diff --git a/package.json b/package.json index a9406136689a..6b3e9fab7289 100644 --- a/package.json +++ b/package.json @@ -156,7 +156,6 @@ "jest-mock": "^27.3.0", "jest-snapshot": "^28.1.0", "jsdom": "^12.2.0", - "lighthouse-plugin-publisher-ads": "1.5.7-beta", "lighthouse-plugin-soft-navigation": "^1.0.1", "magic-string": "^0.25.7", "mime-types": "^2.1.30", diff --git a/third-party/devtools-tests/e2e/lighthouse/navigation_test.ts b/third-party/devtools-tests/e2e/lighthouse/navigation_test.ts index 024f36d808f0..15b762049492 100644 --- a/third-party/devtools-tests/e2e/lighthouse/navigation_test.ts +++ b/third-party/devtools-tests/e2e/lighthouse/navigation_test.ts @@ -78,7 +78,6 @@ describe('Navigation', function() { 'best-practices', 'seo', 'pwa', - 'lighthouse-plugin-publisher-ads', ]); let numNavigations = 0; diff --git a/yarn.lock b/yarn.lock index c0209258267e..ac32503a43b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1287,11 +1287,6 @@ resolved "https://registry.yarnpkg.com/@tootallnate/quickjs-emscripten/-/quickjs-emscripten-0.23.0.tgz#db4ecfd499a9765ab24002c3b696d02e6d32a12c" integrity sha512-C5Mc6rdnsaJDjO3UpGW/CQTHtCKaYlScZTly4JIu97Jxo/odCiH0ITnDXSJPTOrEKk/ycSZ0AOgTmkDtkOsvIA== -"@tusbar/cache-control@^0.3.1": - version "0.3.2" - resolved "https://registry.yarnpkg.com/@tusbar/cache-control/-/cache-control-0.3.2.tgz#6b59cd0ba8fe376fc472012cecde556f667ae4a1" - integrity sha512-69QNun7QkjTAXwvO4J/dvBW19M5q/mcqAnMawPseAEv7DNEAr7flhlW3I9Cp3N4MO0RY/StZYXBq+xkik6Z+VA== - "@types/archiver@^2.1.2": version "2.1.2" resolved "https://registry.yarnpkg.com/@types/archiver/-/archiver-2.1.2.tgz#e84960d4872570d7c826589cd57f2c076bf198c5" @@ -4364,11 +4359,6 @@ internal-slot@^1.0.3: has "^1.0.3" side-channel "^1.0.4" -intl-messageformat-parser@^1.8.1: - version "1.8.1" - resolved "https://registry.yarnpkg.com/intl-messageformat-parser/-/intl-messageformat-parser-1.8.1.tgz#0eb14c5618333be4c95c409457b66c8c33ddcc01" - integrity sha512-IMSCKVf0USrM/959vj3xac7s8f87sc+80Y/ipBzdKy4ifBv5Gsj2tZ41EAaURVg01QU71fYr77uA8Meh6kELbg== - intl-messageformat@^10.5.3: version "10.5.3" resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-10.5.3.tgz#db0779d4a1988faa2977d76574489b7a25f0d5d0" @@ -4379,13 +4369,6 @@ intl-messageformat@^10.5.3: "@formatjs/icu-messageformat-parser" "2.6.2" tslib "^2.4.0" -intl-messageformat@^4.1.2: - version "4.4.0" - resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-4.4.0.tgz#aa196a4d04b573f4090bc417f982d81de4f74fad" - integrity sha512-z+Bj2rS3LZSYU4+sNitdHrwnBhr0wO80ZJSW8EzKDBowwUe3Q/UsvgCGjrwa+HPzoGCLEb9HAjfJgo4j2Sac8w== - dependencies: - intl-messageformat-parser "^1.8.1" - ip@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/ip/-/ip-1.1.8.tgz#ae05948f6b075435ed3307acce04629da8cdbf48" @@ -5065,16 +5048,6 @@ lighthouse-logger@^2.0.1: debug "^2.6.9" marky "^1.2.2" -lighthouse-plugin-publisher-ads@1.5.7-beta: - version "1.5.7-beta" - resolved "https://registry.yarnpkg.com/lighthouse-plugin-publisher-ads/-/lighthouse-plugin-publisher-ads-1.5.7-beta.tgz#ac35b0d8f9ee01c774d45a18fee109cded6395ec" - integrity sha512-Wh9A0RNEPtJowJ34LflMX/g8IDtJh4/ie757UIrsBLc1swWCrKvl2bVzuXRuzmr9ErTkNlqtm8wbdXEoD6bDCw== - dependencies: - "@tusbar/cache-control" "^0.3.1" - esprima "^4.0.1" - intl-messageformat "^4.1.2" - yargs "^16.1.1" - lighthouse-plugin-soft-navigation@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lighthouse-plugin-soft-navigation/-/lighthouse-plugin-soft-navigation-1.0.1.tgz#82fb2008991458d753a819dd3e1f076d55eb2bfb"