-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from Automattic/add/status-codes
Add status code checks while generating critical CSS using playwright
- Loading branch information
Showing
5 changed files
with
105 additions
and
34 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ | |
"node-fetch": "^3.2.10", | ||
"os-browserify": "^0.3.0", | ||
"path-browserify": "^1.0.1", | ||
"playwright": "^1.25.1", | ||
"playwright-core": "^1.33.0", | ||
"prettier": "npm:[email protected]", | ||
"puppeteer": "^16.2.0", | ||
"rollup": "^2.78.1", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* Given an object full of promises, resolves all of them and returns an object containing resultant values. | ||
* Roughly equivalent of Promise.all, but applies to an object. | ||
* | ||
* @param { Object } object - containing promises to resolve | ||
* @return { Object } - Promise which resolves to an object containing resultant values | ||
*/ | ||
export async function objectPromiseAll< ValueType >( object: { | ||
[ key: string ]: Promise< ValueType >; | ||
} ): Promise< { [ key: string ]: ValueType } > { | ||
const keys = Object.keys( object ); | ||
const values = await Promise.all( keys.map( key => object[ key ] ) ); | ||
|
||
return keys.reduce( ( acc, key, index ) => { | ||
acc[ key ] = values[ index ]; | ||
return acc; | ||
}, {} as { [ key: string ]: ValueType } ); | ||
} |