Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: re-enable pubads after esm migration #14241

Merged
merged 11 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 '../lighthouse-core/runner.js';
Expand All @@ -32,8 +31,8 @@ const COMMIT_HASH = execSync('git rev-parse HEAD').toString().trim();

// 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 @@ -84,12 +83,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
3 changes: 3 additions & 0 deletions build/plugins/inline-fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ async function inlineFs(code, filepath) {
continue;
}

// For now, ignore try/catch and other conditional expressions.
// if (parsed.type === 'ConditionalExpression') continue;

connorjclark marked this conversation as resolved.
Show resolved Hide resolved
// If root of expression isn't the fs call, descend down chained methods on
// the result (e.g. `fs.readdirSync().map(...)`) until reaching the fs call.
for (;;) {
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
5 changes: 2 additions & 3 deletions lighthouse-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
Empty file modified lighthouse-cli/test/smokehouse/frontends/smokehouse-bin.js
100644 → 100755
Empty file.
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": "https://gitpkg.now.sh/connorjclark/publisher-ads-lighthouse-plugin/lighthouse-plugin-publisher-ads?esm",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i love this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this lock to a commit / tag? or what happens when you add more commits that aren't ready for integration?

"magic-string": "^0.25.7",
"mime-types": "^2.1.30",
"mocha": "^10.0.0",
Expand Down
5 changes: 2 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5094,10 +5094,9 @@ 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:
"lighthouse-plugin-publisher-ads@https://gitpkg.now.sh/connorjclark/publisher-ads-lighthouse-plugin/lighthouse-plugin-publisher-ads?esm":
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==
resolved "https://gitpkg.now.sh/connorjclark/publisher-ads-lighthouse-plugin/lighthouse-plugin-publisher-ads?esm#8267212cfbc122fbe1bfcc66dfb339849918b6d5"
dependencies:
"@tusbar/cache-control" "^0.3.1"
esprima "^4.0.1"
Expand Down