Skip to content

Commit f5bfce7

Browse files
authored
update dependencies (projectwallace#22)
1 parent be2abda commit f5bfce7

File tree

5 files changed

+352
-264
lines changed

5 files changed

+352
-264
lines changed

_chromium.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
const puppeteer = require('puppeteer-core')
22
const chrome = require('chrome-aws-lambda')
3-
const exePath = process.platform === 'win32' ?
4-
'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe' :
5-
'/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
3+
const exePath =
4+
process.platform === 'win32'
5+
? 'C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe'
6+
: '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
67

78
const isDev = process.env.NOW_REGION === 'dev1'
89

@@ -45,7 +46,7 @@ exports.extractCss = async url => {
4546
// Fail silently if it's already enabled
4647
await page.coverage.startCSSCoverage().catch(() => {})
4748

48-
const response = await page.goto(url, {waitUntil: 'networkidle2'})
49+
const response = await page.goto(url, { waitUntil: 'networkidle2' })
4950

5051
// Make sure that we only try to extract CSS from valid pages.
5152
// Bail out if the response is an invalid request (400, 500)
@@ -83,7 +84,7 @@ exports.extractCss = async url => {
8384
// we requested is an indication that this was a <style> tag
8485
.filter(styles => styles.url !== url)
8586
// The `text` property contains the actual CSS
86-
.map(({text}) => text)
87+
.map(({ text }) => text)
8788
.join('')
8889

8990
return Promise.resolve(styleSheetsApiCss + coverageCss)

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
const normalizeUrl = require('normalize-url')
22
const isUrl = require('is-url')
33
const LRU = require('lru-cache')
4-
const {extractCss} = require('./_chromium')
4+
const { extractCss } = require('./_chromium')
55

66
const cssCache = new LRU({
77
max: 500,
8-
maxAge: 60 * 1000 // 1 minute
8+
maxAge: 3 * 60 * 1000 // 3 minutes
99
})
1010

1111
module.exports = async (req, res) => {
12-
const url = normalizeUrl(req.url.slice(1), {stripWWW: false})
12+
const url = normalizeUrl(req.url.slice(1), { stripWWW: false })
1313

1414
if (!isUrl(url)) {
1515
res.statusCode = 406
@@ -37,6 +37,6 @@ module.exports = async (req, res) => {
3737
} catch (error) {
3838
res.statusCode = 500
3939
res.setHeader('Content-Type', 'application/json')
40-
return res.send({message: error.message})
40+
return res.send({ message: error.message })
4141
}
4242
}

0 commit comments

Comments
 (0)