@lighthouse/common
Advanced tools
Comparing version 4.27.4 to 4.27.5-canary.118.1527
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports.LIGHTHOUSE_LOGO_URL = exports.DEFAULT_PAGE_SIZE = exports.DEFAULT_PAGE_ORIENTATION = exports.DEFAULT_PAGE_MARGINS = exports.DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH = exports.DEFAULT_IMAGE_COLUMN_LENGTH = void 0; | ||
exports.DEFAULT_IMAGE_URL = exports.LIGHTHOUSE_LOGO_URL = exports.DEFAULT_PAGE_SIZE = exports.DEFAULT_PAGE_ORIENTATION = exports.DEFAULT_PAGE_MARGINS = exports.DEFAULT_SUMMARY_FIELDS_COLUMN_LENGTH = exports.DEFAULT_IMAGE_COLUMN_LENGTH = void 0; | ||
@@ -20,2 +20,4 @@ const DEFAULT_IMAGE_COLUMN_LENGTH = 2; | ||
const LIGHTHOUSE_LOGO_URL = 'https://assets-lighthouse-io.s3.amazonaws.com/img/lighthouse-color-logo-2023.png'; | ||
exports.LIGHTHOUSE_LOGO_URL = LIGHTHOUSE_LOGO_URL; | ||
exports.LIGHTHOUSE_LOGO_URL = LIGHTHOUSE_LOGO_URL; | ||
const DEFAULT_IMAGE_URL = 'https://assets-lighthouse-io.s3.amazonaws.com/img/default.png'; | ||
exports.DEFAULT_IMAGE_URL = DEFAULT_IMAGE_URL; |
@@ -42,3 +42,3 @@ "use strict"; | ||
function fetchImage(url, options = {}) { | ||
function fetchImage(url, options = {}, retriesLeft = 2) { | ||
const encodedUrl = encodeURI(url); | ||
@@ -92,2 +92,7 @@ const fetchOptions = { ...defaultOptions, | ||
console.error(error); | ||
if (retriesLeft > 0) { | ||
return fetchImage(_constants.DEFAULT_IMAGE_URL, defaultOptions, retriesLeft - 1); | ||
} | ||
throw error; | ||
@@ -94,0 +99,0 @@ }); |
@@ -8,2 +8,3 @@ // pdf | ||
export var LIGHTHOUSE_LOGO_URL = 'https://assets-lighthouse-io.s3.amazonaws.com/img/lighthouse-color-logo-2023.png'; | ||
export var DEFAULT_IMAGE_URL = 'https://assets-lighthouse-io.s3.amazonaws.com/img/default.png'; | ||
//# sourceMappingURL=constants.js.map |
@@ -11,3 +11,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
import Promise from 'bluebird'; | ||
import { LIGHTHOUSE_LOGO_URL } from '../../constants'; // NOTE use the native fetch if it's available in the browser, because the | ||
import { DEFAULT_IMAGE_URL, LIGHTHOUSE_LOGO_URL } from '../../constants'; // NOTE use the native fetch if it's available in the browser, because the | ||
// ponyfill (which actually uses the github polyfill) does not support all the | ||
@@ -35,2 +35,3 @@ // same options as native fetch | ||
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
var retriesLeft = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 2; | ||
var encodedUrl = encodeURI(url); | ||
@@ -84,2 +85,7 @@ | ||
console.error(error); | ||
if (retriesLeft > 0) { | ||
return fetchImage(DEFAULT_IMAGE_URL, defaultOptions, retriesLeft - 1); | ||
} | ||
throw error; | ||
@@ -86,0 +92,0 @@ }); |
{ | ||
"name": "@lighthouse/common", | ||
"version": "4.27.4", | ||
"version": "4.27.5-canary.118.1527", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1245558
11991
2