Skip to content

Commit

Permalink
switcheroo
Browse files Browse the repository at this point in the history
  • Loading branch information
brendankenny committed Sep 8, 2018
1 parent 2e52a90 commit d8e6372
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
3 changes: 2 additions & 1 deletion lighthouse-core/audits/manifest-short-name-length.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ class ManifestShortNameLength extends Audit {
* @return {Promise<LH.Audit.Product>}
*/
static async audit(artifacts, context) {
const manifestValues = await new ManifestValues().request(artifacts.Manifest, context);
const manifestValues = await new ManifestValues().request(context.computedCaches,
artifacts.Manifest);
// If there's no valid manifest, this audit is not applicable
if (manifestValues.isParseFailure) {
return {
Expand Down
3 changes: 2 additions & 1 deletion lighthouse-core/audits/splash-screen.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ class SplashScreen extends MultiCheckAudit {
/** @type {Array<string>} */
const failures = [];

const manifestValues = await new ManifestValues().request(artifacts.Manifest, context);
const manifestValues = await new ManifestValues().request(context.computedCaches,
artifacts.Manifest);
SplashScreen.assessManifest(manifestValues, failures);

return {
Expand Down
3 changes: 2 additions & 1 deletion lighthouse-core/audits/themed-omnibox.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ class ThemedOmnibox extends MultiCheckAudit {
/** @type {Array<string>} */
const failures = [];

const manifestValues = await new ManifestValues().request(artifacts.Manifest, context);
const manifestValues = await new ManifestValues().request(context.computedCaches,
artifacts.Manifest);
ThemedOmnibox.assessManifest(manifestValues, failures);
ThemedOmnibox.assessMetaThemecolor(artifacts.ThemeColor, failures);

Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/webapp-install-banner.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ class WebappInstallBanner extends MultiCheckAudit {
/** @type {Array<string>} */
let offlineWarnings = [];

const manifestValues = await new ManifestValues()
.request(artifacts.Manifest, context);
const manifestValues = await new ManifestValues().request(context.computedCaches,
artifacts.Manifest);
const manifestFailures = WebappInstallBanner.assessManifest(manifestValues);
const swFailures = WebappInstallBanner.assessServiceWorker(artifacts);
if (!swFailures.length) {
Expand Down
8 changes: 4 additions & 4 deletions lighthouse-core/gather/computed/new-computed-artifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ class ComputedArtifact {
* Request a computed artifact, caching the result based on the input
* artifact(s). Types of `artifact` and the return value are inferred from the
* `compute_` method on classes derived from ComputedArtifact.
* @param {LH.Audit.Context['computedCaches']} caches
* @param {FirstParamType<this['compute_']>} artifact
* @param {LH.Audit.Context} context
* @return {Promise<ReturnType<this['compute_']>>}
*/
async request(artifact, context) {
const cache = context.computedCaches.get(this.name) || new ArbitraryEqualityMap();
context.computedCaches.set(this.name, cache);
async request(caches, artifact) {
const cache = caches.get(this.name) || new ArbitraryEqualityMap();
caches.set(this.name, cache);

const computed = /** @type {ReturnType<this['compute_']>|undefined} */ (cache.get(artifact));
if (computed) {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"checkJs": true,
"strict": true,
// "listFiles": true,
"noErrorTruncation": true,
// "noErrorTruncation": true,
"typeRoots": [
"@types",
"./typings"
Expand Down

0 comments on commit d8e6372

Please sign in to comment.