Socket
Socket
Sign inDemoInstall

gpagespeed

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpagespeed - npm Package Compare versions

Comparing version 4.0.5 to 5.0.0

renovate.json

63

index.js

@@ -1,15 +0,10 @@

'use strict'
const google = require('googleapis')
const { google } = require('googleapis')
const validUrl = require('valid-url')
const getResults = require('./lib/get-result')
module.exports = (options, callback) => {
return new Promise((resolve, reject) => {
module.exports = options => {
return new Promise(async (resolve, reject) => {
if (!options.key && !options.nokey) {
const error = new Error('Missing required param: key')
if (callback) {
return callback(error, null)
}
reject(error)
return reject(error)
}

@@ -19,6 +14,3 @@

const error = new Error('Missing required param: url')
if (callback) {
return callback(error, null)
}
reject(error)
return reject(error)
}

@@ -28,42 +20,25 @@

const error = new Error('Invalid url')
if (callback) {
return callback(error, null)
}
reject(error)
return reject(error)
}
const apiVersion = options.apiversion || 'v2'
const apiVersion = options.apiversion || 'v4'
if (options.useweb) {
const pagespeedUrl = `https://www.googleapis.com/pagespeedonline/${apiVersion}/runPagespeed`
getResults({apiUrl: pagespeedUrl, qs: options}, (error, data) => {
if (error) {
if (callback) {
return callback(error, null)
}
reject(error)
} else {
if (callback) {
return callback(null, data)
}
resolve(data)
}
})
try {
const data = await getResults({apiUrl: pagespeedUrl, qs: options})
return resolve(data)
} catch (error) {
return reject(error)
}
} else {
const pagespeedonline = google.pagespeedonline(apiVersion)
pagespeedonline.pagespeedapi.runpagespeed(options, (error, req) => {
if (error) {
if (callback) {
return callback(error, null)
}
reject(error)
} else {
if (callback) {
return callback(null, req)
}
resolve(req)
}
})
try {
const { data } = await pagespeedonline.pagespeedapi.runpagespeed(options)
return resolve(data)
} catch (error) {
return reject(error)
}
}
})
}

@@ -1,22 +0,22 @@

'use strict'
const https = require('https')
const querystring = require('querystring')
module.exports = (options, callback) => {
let body = ''
const url = `${options.apiUrl}?${querystring.stringify(options.qs)}`
module.exports = options => {
return new Promise((resolve, reject) => {
let body = ''
const url = `${options.apiUrl}?${querystring.stringify(options.qs)}`
https.get(url, (response) => {
response.on('data', (chunk) => {
body += chunk.toString()
})
https.get(url, response => {
response.on('data', (chunk) => {
body += chunk.toString()
})
response.on('end', () => {
return callback(null, JSON.parse(body))
response.on('end', () => {
return resolve(JSON.parse(body))
})
})
.on('error', error => {
return reject(error)
})
})
.on('error', (error) => {
return callback(error, null)
})
}
{
"name": "gpagespeed",
"description": "Analyze a webpage with Google PageSpeed",
"version": "4.0.5",
"version": "5.0.0",
"license": "MIT",

@@ -13,3 +13,3 @@ "author": {

"engines": {
"node": ">=6.11.1"
"node": ">=8.11.2"
},

@@ -21,4 +21,4 @@ "scripts": {

"coveralls": "tap --cov --coverage-report=lcov test/**/*.js && cat coverage/lcov.info | coveralls",
"setup": "npm install",
"standard-fix": "standard --fix"
"standard-fix": "standard --fix",
"refresh": "rm -rf node_modules && rm package-lock.json && npm install"
},

@@ -31,3 +31,3 @@ "keywords": [

"type": "git",
"url": "https://github.com/zrrrzzt/gpagespeed.git"
"url": "git+https://github.com/zrrrzzt/gpagespeed.git"
},

@@ -37,13 +37,13 @@ "bugs": {

},
"homepage": "https://github.com/zrrrzzt/gpagespeed",
"homepage": "https://github.com/zrrrzzt/gpagespeed#readme",
"dependencies": {
"googleapis": "20.1.0",
"googleapis": "30.0.0",
"valid-url": "1.0.9"
},
"devDependencies": {
"coveralls": "2.13.1",
"nsp": "2.6.3",
"standard": "10.0.2",
"tap": "10.7.0"
"coveralls": "3.0.1",
"nsp": "3.2.1",
"standard": "11.0.1",
"tap": "12.0.1"
}
}

@@ -10,12 +10,2 @@ [![Build Status](https://travis-ci.org/zrrrzzt/gpagespeed.svg?branch=master)](https://travis-ci.org/zrrrzzt/gpagespeed)

Supports promises and callback interface.
## Installation
From npm
```bash
$ npm i gpagespeed --save
```
## Usage

@@ -27,6 +17,4 @@

You can see a list of all alternatives on the page for [Google PageSpeed standard query parameters](https://developers.google.com/speed/docs/insights/v2/reference/pagespeedapi/runpagespeed).
You can see a list of all alternatives on the page for [Google PageSpeed standard query parameters](https://developers.google.com/speed/docs/insights/v4/reference/pagespeedapi/runpagespeed).
### Promises
```JavaScript

@@ -40,6 +28,6 @@ const pagespeed = require('gpagespeed')

pagespeed(options)
.then((data) => {
.then(data => {
console.log(data)
})
.catch((error) => {
.catch(error => {
console.error(error)

@@ -49,26 +37,6 @@ })

### Callback
```JavaScript
const pagespeed = require('gpagespeed')
const options = {
url: 'http://url-to-check',
key: 'insert-your-key'
}
pagespeed(options, (error, data) => {
if (error) {
console.error(error)
} else {
console.log(data)
}
})
```
## Alternative api
In addition you can choose to use https instead of googleapis and another version of the PageSpeed api (defaults to v2).
In addition you can choose to use https instead of googleapis and another version of the PageSpeed api (defaults to v4).
### Promises
```JavaScript

@@ -91,22 +59,2 @@ const pagespeed = require('gpagespeed')

```
### Callback
```JavaScript
const pagespeed = require('gpagespeed')
const options = {
url: 'http://url-to-check',
key: 'insert-your-key',
useweb: true,
apiversion: 'v3beta1'
}
pagespeed(options, (error, data) => {
if (error) {
console.error(error)
} else {
console.log(data)
}
})
```
## Returns

@@ -124,2 +72,2 @@

![alt text](https://robots.kebabstudios.party/gpagespeed.png "Robohash image of gpagespeed")
![Robohash image of gpagespeed](https://robots.kebabstudios.party/gpagespeed.png "Robohash image of gpagespeed")

@@ -7,23 +7,70 @@ # Return example

"kind": "pagespeedonline#result",
"id": "https://www.npmjs.com/",
"id": "https://www.google.com/",
"responseCode": 200,
"title": "npm",
"title": "Google",
"ruleGroups": {
"SPEED": {
"score": 70
"score": 95
}
},
"loadingExperience": {
"id": "https://www.google.com/",
"metrics": {
"FIRST_CONTENTFUL_PAINT_MS": {
"median": 675,
"distributions": [
{
"min": 0,
"max": 984,
"proportion": 0.6493244163829708
},
{
"min": 984,
"max": 2073,
"proportion": 0.1719613615949542
},
{
"min": 2073,
"proportion": 0.17871422202207507
}
],
"category": "FAST"
},
"DOM_CONTENT_LOADED_EVENT_FIRED_MS": {
"median": 738,
"distributions": [
{
"min": 0,
"max": 1366,
"proportion": 0.7176583317020245
},
{
"min": 1366,
"max": 2787,
"proportion": 0.13515601984023135
},
{
"min": 2787,
"proportion": 0.147185648457744
}
],
"category": "FAST"
}
},
"overall_category": "FAST",
"initial_url": "https://www.google.com/"
},
"pageStats": {
"numberResources": 50,
"numberHosts": 15,
"totalRequestBytes": "4652",
"numberStaticResources": 31,
"htmlResponseBytes": "570573",
"overTheWireResponeBytes": "2244324",
"cssResponseBytes": "316271",
"imageResponseBytes": "557960",
"javascriptResponseBytes": "550906",
"otherResponseBytes": "129213",
"numberJsResources": 8,
"numberCssResources": 2
"numberResources": 16,
"numberHosts": 7,
"totalRequestBytes": "2759",
"numberStaticResources": 11,
"htmlResponseBytes": "227543",
"overTheWireResponseBytes": "415879",
"imageResponseBytes": "42287",
"javascriptResponseBytes": "873988",
"otherResponseBytes": "1459",
"numberJsResources": 5,
"numTotalRoundTrips": 10,
"numRenderBlockingRoundTrips": 0
},

@@ -69,3 +116,3 @@ "formattedResults": {

"localizedRuleName": "Leverage browser caching",
"ruleImpact": 11.361140873015875,
"ruleImpact": 0,
"groups": [

@@ -75,432 +122,28 @@ "SPEED"

"summary": {
"format": "Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network."
},
"urlBlocks": [
{
"header": {
"format": "{{BEGIN_LINK}}Leverage browser caching{{END_LINK}} for the following cacheable resources:",
"args": [
{
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/LeverageBrowserCaching"
}
]
},
"urls": [
{
"result": {
"format": "{{URL}} (expiration not specified)",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://partners.npmjs.com/hiring"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://cdn.optimizely.com/js/3318080746.js"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "2.1 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "5 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/css/@npmcorp/pui-css-typography/OpenSans-Bold-webfont.woff"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/css/@npmcorp/pui-css-typography/OpenSans-ExtraBold-webfont.woff"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/css/@npmcorp/pui-css-typography/OpenSans-Light-webfont.woff"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/css/@npmcorp/pui-css-typography/OpenSans-Regular-webfont.woff"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/css/@npmcorp/pui-css-typography/OpenSans-Semibold-webfont.woff"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/css/components.css?last-changed=557628d0dd3d70f924b73f62b93c5859"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/avatars/Avatar1.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/avatars/Avatar2.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/avatars/Avatar4.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/binoculars-dot.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/collaboration-security.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/hero-cityscape.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/mountain-dot.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/npm-enterprise.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/npm-is-BOXES.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/images/rucksack-dot.svg"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/js/componentized.min.js?last-changed=33a73092bc70d0308c9370b146871fef"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/js/vendor.min.js?last-changed=1d4a4436c0b4dcadb967d94da68ac9f5"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "10 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.google-analytics.com/plugins/ua/ec.js"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "60 minutes"
}
]
}
},
{
"result": {
"format": "{{URL}} ({{LIFETIME}})",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.google-analytics.com/analytics.js"
},
{
"type": "DURATION",
"key": "LIFETIME",
"value": "2 hours"
}
]
}
}
]
}
]
"format": "You have enabled browser caching. Learn more about {{BEGIN_LINK}}browser caching recommendations{{END_LINK}}.",
"args": [
{
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/LeverageBrowserCaching"
}
]
}
},
"MainResourceServerResponseTime": {
"localizedRuleName": "Reduce server response time",
"ruleImpact": 7.5,
"ruleImpact": 0,
"groups": [
"SPEED"
],
"urlBlocks": [
{
"header": {
"format": "In our test, your server responded in {{RESPONSE_TIME}}. There are many factors that can slow down your server response time. {{BEGIN_LINK}}Please read our recommendations{{END_LINK}} to learn how you can monitor and measure where your server is spending the most time.",
"args": [
{
"type": "DURATION",
"key": "RESPONSE_TIME",
"value": "0.95 seconds"
},
{
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/Server"
}
]
"summary": {
"format": "Your server responded quickly. Learn more about {{BEGIN_LINK}}server response time optimization{{END_LINK}}.",
"args": [
{
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/Server"
}
}
]
]
}
},

@@ -560,3 +203,3 @@ "MinifyCss": {

"localizedRuleName": "Eliminate render-blocking JavaScript and CSS in above-the-fold content",
"ruleImpact": 10,
"ruleImpact": 0,
"groups": [

@@ -566,91 +209,15 @@ "SPEED"

"summary": {
"format": "Your page has {{NUM_SCRIPTS}} blocking script resources and {{NUM_CSS}} blocking CSS resources. This causes a delay in rendering your page.",
"format": "You have no render-blocking resources. Learn more about {{BEGIN_LINK}}removing render-blocking resources{{END_LINK}}.",
"args": [
{
"type": "INT_LITERAL",
"key": "NUM_SCRIPTS",
"value": "1"
},
{
"type": "INT_LITERAL",
"key": "NUM_CSS",
"value": "2"
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/BlockingJS"
}
]
},
"urlBlocks": [
{
"header": {
"format": "None of the above-the-fold content on your page could be rendered without waiting for the following resources to load. Try to defer or asynchronously load blocking resources, or inline the critical portions of those resources directly in the HTML."
}
},
{
"header": {
"format": "{{BEGIN_LINK}}Remove render-blocking JavaScript{{END_LINK}}:",
"args": [
{
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/BlockingJS"
}
]
},
"urls": [
{
"result": {
"format": "{{URL}}",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/js/componentized.min.js?last-changed=33a73092bc70d0308c9370b146871fef"
}
]
}
}
]
},
{
"header": {
"format": "{{BEGIN_LINK}}Optimize CSS Delivery{{END_LINK}} of the following:",
"args": [
{
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery"
}
]
},
"urls": [
{
"result": {
"format": "{{URL}}",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://www.npmjs.com/static/css/components.css?last-changed=557628d0dd3d70f924b73f62b93c5859"
}
]
}
},
{
"result": {
"format": "{{URL}}",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700"
}
]
}
}
]
}
]
}
},
"OptimizeImages": {
"localizedRuleName": "Optimize images",
"ruleImpact": 14.8882,
"ruleImpact": 0.078,
"groups": [

@@ -675,3 +242,3 @@ "SPEED"

"key": "SIZE_IN_BYTES",
"value": "145.4KiB"
"value": "780B"
},

@@ -681,3 +248,3 @@ {

"key": "PERCENTAGE",
"value": "89%"
"value": "18%"
}

@@ -689,3 +256,3 @@ ]

"result": {
"format": "Compressing and resizing {{URL}} could save {{SIZE_IN_BYTES}} ({{PERCENTAGE}} reduction).",
"format": "Compressing {{URL}} could save {{SIZE_IN_BYTES}} ({{PERCENTAGE}} reduction).",
"args": [

@@ -695,3 +262,3 @@ {

"key": "URL",
"value": "https://i.cloudup.com/Ka0R3QvWRs.png"
"value": "https://www.google.com/images/hpp/shield_privacy_checkup_green_2x_web_96dp.png"
},

@@ -701,3 +268,3 @@ {

"key": "SIZE_IN_BYTES",
"value": "85.9KiB"
"value": "780B"
},

@@ -707,47 +274,41 @@ {

"key": "PERCENTAGE",
"value": "95%"
"value": "18%"
}
]
}
},
{
"result": {
"format": "Compressing and resizing {{URL}} could save {{SIZE_IN_BYTES}} ({{PERCENTAGE}} reduction).",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://i.cloudup.com/bDkmXyEmr5.png"
},
{
"type": "BYTES",
"key": "SIZE_IN_BYTES",
"value": "32.9KiB"
},
{
"type": "PERCENTAGE",
"key": "PERCENTAGE",
"value": "88%"
}
]
}
]
}
]
},
"PrioritizeVisibleContent": {
"localizedRuleName": "Prioritize visible content",
"ruleImpact": 4,
"groups": [
"SPEED"
],
"summary": {
"format": "Your page requires additional network round trips to render the above-the-fold content. For best performance, reduce the amount of HTML needed to render above-the-fold content."
},
"urlBlocks": [
{
"header": {
"format": "The entire HTML response was not sufficient to render the above-the-fold content. This usually indicates that additional resources, loaded after HTML parsing, were required to render above-the-fold content. {{BEGIN_LINK}}Prioritize visible content{{END_LINK}} that is needed for rendering above-the-fold by including it directly in the HTML response.",
"args": [
{
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/PrioritizeVisibleContent"
}
},
]
},
"urls": [
{
"result": {
"format": "Compressing and resizing {{URL}} could save {{SIZE_IN_BYTES}} ({{PERCENTAGE}} reduction).",
"format": "Only about {{PERCENTAGE}} of the final above-the-fold content could be rendered with the full HTML response.",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://raw.githubusercontent.com/gulpjs/artwork/master/gulp-2x.png"
},
{
"type": "BYTES",
"key": "SIZE_IN_BYTES",
"value": "12.2KiB"
},
{
"type": "PERCENTAGE",
"key": "PERCENTAGE",
"value": "76%"
"value": "64%"
}

@@ -759,43 +320,11 @@ ]

"result": {
"format": "Compressing and resizing {{URL}} could save {{SIZE_IN_BYTES}} ({{PERCENTAGE}} reduction).",
"format": "Click to see the screenshot with only the HTML response: {{SCREENSHOT}}",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://cldup.com/wpGXm1cWwB.png"
},
{
"type": "BYTES",
"key": "SIZE_IN_BYTES",
"value": "11.9KiB"
},
{
"type": "PERCENTAGE",
"key": "PERCENTAGE",
"value": "97%"
"type": "SNAPSHOT_RECT",
"key": "SCREENSHOT",
"value": "snapshot:2"
}
]
}
},
{
"result": {
"format": "Compressing and resizing {{URL}} could save {{SIZE_IN_BYTES}} ({{PERCENTAGE}} reduction).",
"args": [
{
"type": "URL",
"key": "URL",
"value": "https://d21ii91i3y6o6h.cloudfront.net/gallery_images/from_proof/1647/small/1405586570/browserify-2-hexagon-sticker.png"
},
{
"type": "BYTES",
"key": "SIZE_IN_BYTES",
"value": "2.4KiB"
},
{
"type": "PERCENTAGE",
"key": "PERCENTAGE",
"value": "37%"
}
]
}
}

@@ -805,19 +334,2 @@ ]

]
},
"PrioritizeVisibleContent": {
"localizedRuleName": "Prioritize visible content",
"ruleImpact": 0,
"groups": [
"SPEED"
],
"summary": {
"format": "You have the above-the-fold content properly prioritized. Learn more about {{BEGIN_LINK}}prioritizing visible content{{END_LINK}}.",
"args": [
{
"type": "HYPERLINK",
"key": "LINK",
"value": "https://developers.google.com/speed/docs/insights/PrioritizeVisibleContent"
}
]
}
}

@@ -831,2 +343,3 @@ }

}
```

@@ -1,3 +0,1 @@

'use strict'
const tap = require('tap')

@@ -12,6 +10,11 @@ const gps = require('../../index')

const expectedErrorMessage = 'Missing required param: url'
gps(options, (error, data) => {
tap.equal(error.message, expectedErrorMessage, expectedErrorMessage)
test.done()
})
gps(options)
.then(data => {
console.log(data)
})
.catch((error) => {
tap.equal(error.message, expectedErrorMessage, expectedErrorMessage)
test.done()
})
})

@@ -25,6 +28,11 @@

const expectedErrorMessage = 'Invalid url'
gps(options, (error, data) => {
tap.equal(error.message, expectedErrorMessage, expectedErrorMessage)
test.done()
})
gps(options)
.then(data => {
console.log(data)
})
.catch((error) => {
tap.equal(error.message, expectedErrorMessage, expectedErrorMessage)
test.done()
})
})

@@ -38,6 +46,11 @@

const expectedErrorMessage = 'Missing required param: key'
gps(options, (error, data) => {
tap.equal(error.message, expectedErrorMessage, expectedErrorMessage)
test.done()
})
gps(options)
.then(data => {
console.log(data)
})
.catch((error) => {
tap.equal(error.message, expectedErrorMessage, expectedErrorMessage)
test.done()
})
})

@@ -1,3 +0,1 @@

'use strict'
const tap = require('tap')

@@ -9,9 +7,11 @@ const pagespeed = require('../../index')

const options = {nokey: true, url: url}
pagespeed(options, (error, data) => {
if (error) {
pagespeed(options)
.then(data => {
tap.equal('pagespeedonline#result', data.kind, 'data ok')
test.done()
})
.catch(error => {
throw error
}
tap.equal('pagespeedonline#result', data.kind, 'data ok')
test.done()
})
})
})

@@ -21,9 +21,10 @@

const options = {nokey: true, url: url, useweb: true}
pagespeed(options, (error, data) => {
if (error) {
pagespeed(options)
.then(data => {
tap.equal('pagespeedonline#result', data.kind, 'data ok')
test.done()
})
.catch((error) => {
throw error
}
tap.equal('pagespeedonline#result', data.kind, 'data ok')
test.done()
})
})
})

@@ -1,3 +0,1 @@

'use strict'
const tap = require('tap')

@@ -4,0 +2,0 @@ const pkg = require('../../package.json')

@@ -1,3 +0,1 @@

'use strict'
const tap = require('tap')

@@ -4,0 +2,0 @@ const pkg = require('../../package.json')

@@ -1,5 +0,3 @@

'use strict'
const tap = require('tap')
tap.equal(true, true, 'tap works ok')

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc