Skip to content

Commit

Permalink
misc: re-enable pubads after esm migration (#14241)
Browse files Browse the repository at this point in the history
  • Loading branch information
connorjclark authored Sep 9, 2022
1 parent e41519f commit 6b92590
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 23 deletions.
21 changes: 10 additions & 11 deletions build/build-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ import {createRequire} from 'module';

import esMain from 'es-main';
import {rollup} from 'rollup';
// TODO(esmodules): convert pubads to esm
// // @ts-expect-error: plugin has no types.
// import PubAdsPlugin from 'lighthouse-plugin-publisher-ads/plugin.js';
// @ts-expect-error: plugin has no types.
import PubAdsPlugin from 'lighthouse-plugin-publisher-ads';

import * as rollupPlugins from './rollup-plugins.js';
import {Runner} from '../core/runner.js';
Expand All @@ -37,8 +36,8 @@ const GIT_READABLE_REF =

// HACK: manually include the lighthouse-plugin-publisher-ads audits.
/** @type {Array<string>} */
// // @ts-expect-error
// const pubAdsAudits = PubAdsPlugin.audits.map(a => a.path);
// @ts-expect-error
const pubAdsAudits = PubAdsPlugin.audits.map(a => a.path);

/** @param {string} file */
const isDevtools = file =>
Expand Down Expand Up @@ -89,12 +88,12 @@ async function buildBundle(entryPath, distPath, opts = {minify: true}) {
];

// Include lighthouse-plugin-publisher-ads.
// if (isDevtools(entryPath) || isLightrider(entryPath)) {
// dynamicModulePaths.push('lighthouse-plugin-publisher-ads');
// pubAdsAudits.forEach(pubAdAudit => {
// dynamicModulePaths.push(pubAdAudit);
// });
// }
if (isDevtools(entryPath) || isLightrider(entryPath)) {
dynamicModulePaths.push('lighthouse-plugin-publisher-ads');
pubAdsAudits.forEach(pubAdAudit => {
dynamicModulePaths.push(pubAdAudit);
});
}

const bundledMapEntriesCode = dynamicModulePaths.map(modulePath => {
const pathNoExt = modulePath.replace('.js', '');
Expand Down
5 changes: 2 additions & 3 deletions cli/test/smokehouse/core-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ 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 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';
Expand Down Expand Up @@ -103,8 +103,7 @@ const smokeTests = [
perfFrameMetrics,
perfPreload,
perfTraceElements,
// TODO(esmodules): enable when pubads is bundled again
// pubads,
pubads,
pwaAirhorner,
pwaChromestatus,
pwaSvgomg,
Expand Down
3 changes: 1 addition & 2 deletions clients/devtools/devtools-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ function createConfig(categoryIDs, device) {

return {
extends: 'lighthouse:default',
// TODO(esmodules): re-enable when pubads works again
// plugins: ['lighthouse-plugin-publisher-ads'],
plugins: ['lighthouse-plugin-publisher-ads'],
settings,
};
}
Expand Down
2 changes: 1 addition & 1 deletion core/scripts/release/package-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ cd /tmp/lighthouse-local-test

npm init -y
npm install "$LH_ROOT/lighthouse-$VERSION.tgz"
npm install lighthouse-plugin-publisher-ads
npm install lighthouse-plugin-publisher-ads@next
npm explore lighthouse -- npm run fast -- http://example.com

# Packaged smokehouse/lighthouse using root's static-server and test fixtures.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
"jsdom": "^12.2.0",
"jsonld": "^5.2.0",
"jsonlint-mod": "^1.7.6",
"lighthouse-plugin-publisher-ads": "^1.5.6",
"lighthouse-plugin-publisher-ads": "1.5.7-beta",
"magic-string": "^0.25.7",
"mime-types": "^2.1.30",
"mocha": "^10.0.0",
Expand Down
9 changes: 4 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5094,10 +5094,10 @@ lighthouse-logger@^1.0.0, lighthouse-logger@^1.3.0:
debug "^2.6.9"
marky "^1.2.2"

lighthouse-plugin-publisher-ads@^1.5.6:
version "1.5.6"
resolved "https://registry.yarnpkg.com/lighthouse-plugin-publisher-ads/-/lighthouse-plugin-publisher-ads-1.5.6.tgz#243ccb77bed4985229c7238f902d4398ba963851"
integrity sha512-EejkyHMy3m+f4AgsyufijoNaH052+7Y258gjJ0NRohGjokpsU/D41L2MZEPNWjJm+n0+IbY+nJEsH3AyS43irA==
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"
Expand Down Expand Up @@ -6128,7 +6128,6 @@ query-string@^4.1.0:

quibble@^0.6.7, quibble@connorjclark/quibble#mod-cache:
version "0.6.14"
uid "68d53b087d4c9117cc86c7e5f19e7953a219582b"
resolved "https://codeload.github.com/connorjclark/quibble/tar.gz/68d53b087d4c9117cc86c7e5f19e7953a219582b"
dependencies:
lodash "^4.17.21"
Expand Down

0 comments on commit 6b92590

Please sign in to comment.