From 0e0c6ecb8d8b7713092e4b455e7a9f9ed22d1b43 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 31 Jul 2018 10:32:53 -0400 Subject: [PATCH 001/164] CI tests fail on end-to-end test with Wikipedia, fixes #241 (#242) * CI tests fail on end-to-end test with Wikipedia, fixes #241 * use travis-ci.org instead of nodejs.org --- bin/e2e.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bin/e2e.js b/bin/e2e.js index b1101d96..b0731902 100755 --- a/bin/e2e.js +++ b/bin/e2e.js @@ -41,23 +41,21 @@ function openUrl(url, ...options) { } // Simplest form of opening -openUrl('https://en.wikipedia.org/wiki/List_of_HTTP_status_codes').then( - spawned => { - const css = spawned.stdout.toString(); - assert( - css.length > 20000 && css.length < 30000, - 'Expect CSS to be between 20,000...30,000' - ); - } -); +openUrl('https://minimalcss.app/').then(spawned => { + const css = spawned.stdout.toString(); + assert( + css.length > 8000 && css.length < 10000, + 'Expect CSS to be between 8,000...10,000' + ); +}); // Open with -o -openUrl('https://nodejs.org/', '-o', '/tmp/nodejs.css').then(spawned => { +openUrl('https://travis-ci.org/', '-o', '/tmp/travisci.css').then(spawned => { const stdout = spawned.stdout.toString(); assert(!stdout.trim(), 'Output should be empty'); - const css = fs.readFileSync('/tmp/nodejs.css').toString(); + const css = fs.readFileSync('/tmp/travisci.css').toString(); assert( - css.length > 1000 && css.length < 15000, + css.length > 10000 && css.length < 40000, 'Expect CSS to be between 1K...15K' ); }); From d3175b06b2fa7d2a09502c11007fadbf9dfd0084 Mon Sep 17 00:00:00 2001 From: Harry Green Date: Thu, 2 Aug 2018 15:11:16 +0100 Subject: [PATCH 002/164] Throw error if invalid CSS is encountered (#237) This throws an error if invalid CSS is found during `csstree.walk`. I couldn't find a nice way to output the line or surrounding nodes to help the dev. --- src/run.js | 8 ++++++++ tests/examples/invalid-css.css | 3 +++ tests/examples/invalid-css.html | 13 +++++++++++++ tests/main.test.js | 14 ++++++++++++++ 4 files changed, 38 insertions(+) create mode 100644 tests/examples/invalid-css.css create mode 100644 tests/examples/invalid-css.html diff --git a/src/run.js b/src/run.js index 3e154145..3ff4b2fb 100644 --- a/src/run.js +++ b/src/run.js @@ -456,6 +456,14 @@ const minimalcss = async options => { return; } + if (!node.prelude.children) { + throw new Error( + `Invalid CSS found while evaluating ${href}: "${ + node.prelude.value + }"` + ); + } + node.prelude.children.forEach((node, item, list) => { // Translate selector's AST to a string and filter pseudos from it // This changes things like `a.button:active` to `a.button` diff --git a/tests/examples/invalid-css.css b/tests/examples/invalid-css.css new file mode 100644 index 00000000..5aa65e75 --- /dev/null +++ b/tests/examples/invalid-css.css @@ -0,0 +1,3 @@ +$body { + color: violet; +} diff --git a/tests/examples/invalid-css.html b/tests/examples/invalid-css.html new file mode 100644 index 00000000..799dc451 --- /dev/null +++ b/tests/examples/invalid-css.html @@ -0,0 +1,13 @@ + + + + + + + + + +

Invalid css

+ + + \ No newline at end of file diff --git a/tests/main.test.js b/tests/main.test.js index 22971c4a..4ededb63 100644 --- a/tests/main.test.js +++ b/tests/main.test.js @@ -145,6 +145,20 @@ test('form elements', async () => { expect(finalCss).toMatch('option:selected'); }); +test.only('invalid css', async () => { + expect.assertions(1); + + try { + await runMinimalcss('invalid-css'); + } catch (error) { + const expectedUrl = 'http://localhost:3000/invalid-css.css'; + const expectedInvalidCSS = '$body'; + expect(error.toString()).toMatch( + `Invalid CSS found while evaluating ${expectedUrl}: "${expectedInvalidCSS}"` + ); + } +}); + test('handles 307 CSS file', async () => { const { finalCss } = await runMinimalcss('307css'); expect(finalCss).toEqual('p{color:violet}'); From 25373b4d25857bb9891522ce460d64be14513ae4 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 2 Aug 2018 10:50:26 -0400 Subject: [PATCH 003/164] update CHANGELOG for 0.7.7 --- CHANGELOG.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 247d82e4..d477a7ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +# 0.7.7 + +* Throw explicit errors on invalid CSS + [pull#237](https://github.com/peterbe/minimalcss/pull/237) + Thanks @harrygreen + +# 0.7.6 + +* List what timed out. Useful for debugging which resources failed. + [pull#199](https://github.com/peterbe/minimalcss/pull/199) + Thanks @stereobooster + +* Upgrade to puppeteer 1.4.0 + [pull#214](https://github.com/peterbe/minimalcss/pull/214) + # 0.7.5 * Ability to pass an object of options to `csso.compress()` From 5b354e6e27575c1b1e1e1c2fbe066bbe3767adcd Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 2 Aug 2018 10:50:41 -0400 Subject: [PATCH 004/164] 0.7.7 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3d3bceee..af09ce53 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minimalcss", - "version": "0.7.6", + "version": "0.7.7", "description": "Extract the minimal CSS used in a set of URLs with puppeteer", "main": "./index.js", "author": "Peter Bengtsson", From fe2d4ae35eb1b8089a3e353e0dbfde577b8701c7 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 6 Aug 2018 23:21:13 +0000 Subject: [PATCH 005/164] Update dependency @types/node to v8.10.24 --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index af09ce53..dcd3c08e 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "@types/cheerio": "0.22.8", - "@types/node": "8.10.20", + "@types/node": "8.10.24", "@types/puppeteer": "1.3.4", "fastify": "1.8.0", "fastify-static": "0.12.0", diff --git a/yarn.lock b/yarn.lock index 94a8a38b..a950bc3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -28,9 +28,9 @@ version "9.4.7" resolved "http://registry.npmjs.org/@types/node/-/node-9.4.7.tgz#57d81cd98719df2c9de118f2d5f3b1120dcd7275" -"@types/node@8.10.20": - version "8.10.20" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.20.tgz#fe674ea52e13950ab10954433a7824438aabbcac" +"@types/node@8.10.24": + version "8.10.24" + resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.24.tgz#302a8f0c00bd1bf364471b6687258617c5d410fc" "@types/pino@^4.16.0": version "4.16.0" From 9c63ca4e74d0a7ef9d019fe4d7fa8c8a3d924aa2 Mon Sep 17 00:00:00 2001 From: jc275 Date: Wed, 8 Aug 2018 10:51:25 +0100 Subject: [PATCH 006/164] fulfilledPromise Lines 132-143 are moved outside the if-block, but are otherwise unchanged. --- src/run.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/run.js b/src/run.js index 3ff4b2fb..90cce914 100644 --- a/src/run.js +++ b/src/run.js @@ -127,20 +127,20 @@ const processPage = ({ const tracker = createTracker(page); const safeReject = error => { - if (!fulfilledPromise) { - if (error.message.startsWith('Navigation Timeout Exceeded')) { - const urls = tracker.urls(); - if (urls.length > 1) { - error.message += `\nTracked URLs that have not finished: ${urls.join( - ', ' - )}`; - } else if (urls.length > 0) { - error.message += `\nFor ${urls[0]}`; - } + if (fulfilledPromise) return; + fulfilledPromise = true; + if (error.message.startsWith('Navigation Timeout Exceeded')) { + const urls = tracker.urls(); + if (urls.length > 1) { + error.message += `\nTracked URLs that have not finished: ${urls.join( + ', ' + )}`; + } else if (urls.length > 0) { + error.message += `\nFor ${urls[0]}`; } - tracker.dispose(); - reject(error); } + tracker.dispose(); + reject(error); }; const debug = options.debug || false; From 9edda389ec8ee67a692f769cde9b9b1e4dfb734d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Wed, 8 Aug 2018 09:01:33 -0400 Subject: [PATCH 007/164] Update dependency prettier to v1.14.0 (#238) --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index af09ce53..0917e0dc 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "fastify": "1.8.0", "fastify-static": "0.12.0", "jest": "23.3.0", - "prettier": "1.13.7", + "prettier": "1.14.0", "typescript": "2.9.2" }, "scripts": { diff --git a/yarn.lock b/yarn.lock index 94a8a38b..bc93fa65 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2726,9 +2726,9 @@ prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" -prettier@1.13.7: - version "1.13.7" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.13.7.tgz#850f3b8af784a49a6ea2d2eaa7ed1428a34b7281" +prettier@1.14.0: + version "1.14.0" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372" pretty-format@^23.2.0: version "23.2.0" From a693cbc5adfe83446cc4694fdeddd36d95343134 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 8 Aug 2018 16:55:22 +0000 Subject: [PATCH 008/164] Update dependency prettier to v1.14.1 --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 0917e0dc..afbde3e5 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ "fastify": "1.8.0", "fastify-static": "0.12.0", "jest": "23.3.0", - "prettier": "1.14.0", + "prettier": "1.14.1", "typescript": "2.9.2" }, "scripts": { diff --git a/yarn.lock b/yarn.lock index bc93fa65..1ac5f308 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2726,9 +2726,9 @@ prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" -prettier@1.14.0: - version "1.14.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.0.tgz#847c235522035fd988100f1f43cf20a7d24f9372" +prettier@1.14.1: + version "1.14.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.1.tgz#4ead68e66b5ec9e771de311570c90da822f5a17a" pretty-format@^23.2.0: version "23.2.0" From 1d6dd8ab12d26dae1a780ea1c5a37fd3cd46ae9f Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 8 Aug 2018 17:23:33 +0000 Subject: [PATCH 009/164] Update dependency jest to v23.4.2 --- package.json | 2 +- yarn.lock | 403 ++++++++++++++++++++++++++++++++++----------------- 2 files changed, 273 insertions(+), 132 deletions(-) diff --git a/package.json b/package.json index afbde3e5..17431922 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "@types/puppeteer": "1.3.4", "fastify": "1.8.0", "fastify-static": "0.12.0", - "jest": "23.3.0", + "jest": "23.4.2", "prettier": "1.14.1", "typescript": "2.9.2" }, diff --git a/yarn.lock b/yarn.lock index 1ac5f308..a9427559 100644 --- a/yarn.lock +++ b/yarn.lock @@ -171,11 +171,17 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +arr-diff@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-2.0.0.tgz#8f3b827f955a8bd669697e4a4256ac3ceae356cf" + dependencies: + arr-flatten "^1.0.1" + arr-diff@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520" -arr-flatten@^1.1.0: +arr-flatten@^1.0.1, arr-flatten@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/arr-flatten/-/arr-flatten-1.1.0.tgz#36048bbff4e7b47e136644316c99669ea5ae91f1" @@ -187,6 +193,10 @@ array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" +array-unique@^0.2.1: + version "0.2.1" + resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.2.1.tgz#a1d97ccafcbc2625cc70fadceb36a50c58b01a53" + array-unique@^0.3.2: version "0.3.2" resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" @@ -308,9 +318,9 @@ babel-helpers@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-jest@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.2.0.tgz#14a9d6a3f4122dfea6069d37085adf26a53a4dba" +babel-jest@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.4.2.tgz#f276de67798a5d68f2d6e87ff518c2f6e1609877" dependencies: babel-plugin-istanbul "^4.1.6" babel-preset-jest "^23.2.0" @@ -458,6 +468,14 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +braces@^1.8.2: + version "1.8.5" + resolved "https://registry.yarnpkg.com/braces/-/braces-1.8.5.tgz#ba77962e12dff969d6b76711e914b737857bf6a7" + dependencies: + expand-range "^1.8.1" + preserve "^0.2.0" + repeat-element "^1.1.2" + braces@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/braces/-/braces-2.3.1.tgz#7086c913b4e5a08dbe37ac0ee6a2500c4ba691bb" @@ -1012,6 +1030,12 @@ exit@^0.1.2: version "0.1.2" resolved "https://registry.yarnpkg.com/exit/-/exit-0.1.2.tgz#0632638f8d877cc82107d30a0fff1a17cba1cd0c" +expand-brackets@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-0.1.5.tgz#df07284e342a807cd733ac5af72411e581d1177b" + dependencies: + is-posix-bracket "^0.1.0" + expand-brackets@^2.1.4: version "2.1.4" resolved "https://registry.yarnpkg.com/expand-brackets/-/expand-brackets-2.1.4.tgz#b77735e315ce30f6b6eff0f83b04151a22449622" @@ -1024,15 +1048,21 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-23.3.0.tgz#ecb051adcbdc40ac4db576c16067f12fdb13cc61" +expand-range@^1.8.1: + version "1.8.2" + resolved "https://registry.yarnpkg.com/expand-range/-/expand-range-1.8.2.tgz#a299effd335fe2721ebae8e257ec79644fc85337" + dependencies: + fill-range "^2.1.0" + +expect@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-23.4.0.tgz#6da4ecc99c1471253e7288338983ad1ebadb60c3" dependencies: ansi-styles "^3.2.0" jest-diff "^23.2.0" jest-get-type "^22.1.0" jest-matcher-utils "^23.2.0" - jest-message-util "^23.3.0" + jest-message-util "^23.4.0" jest-regex-util "^23.3.0" extend-shallow@^2.0.1: @@ -1052,6 +1082,12 @@ extend@~3.0.0, extend@~3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/extend/-/extend-3.0.1.tgz#a755ea7bc1adfcc5a31ce7e762dbaadc5e636444" +extglob@^0.3.1: + version "0.3.2" + resolved "https://registry.yarnpkg.com/extglob/-/extglob-0.3.2.tgz#2e18ff3d2f49ab2765cec9023f011daa8d8349a1" + dependencies: + is-extglob "^1.0.0" + extglob@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/extglob/-/extglob-2.0.4.tgz#ad00fe4dc612a9232e8718711dc5cb5ab0285543" @@ -1166,6 +1202,10 @@ fd-slicer@~1.0.1: dependencies: pend "~1.2.0" +filename-regex@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/filename-regex/-/filename-regex-2.0.1.tgz#c1c4b9bee3e09725ddb106b75c1e301fe2f18b26" + fileset@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/fileset/-/fileset-2.0.3.tgz#8e7548a96d3cc2327ee5e674168723a333bba2a0" @@ -1177,6 +1217,16 @@ filesize@^3.5.11: version "3.6.0" resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.0.tgz#22d079615624bb6fd3c04026120628a41b3f4efa" +fill-range@^2.1.0: + version "2.2.4" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.4.tgz#eb1e773abb056dcd8df2bfdf6af59b8b3a936565" + dependencies: + is-number "^2.1.0" + isobject "^2.0.0" + randomatic "^3.0.0" + repeat-element "^1.1.2" + repeat-string "^1.5.2" + fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -1215,10 +1265,16 @@ flatstr@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/flatstr/-/flatstr-1.0.8.tgz#0e849229751f2b9f6a0919f8e81e1229e84ba901" -for-in@^1.0.2: +for-in@^1.0.1, for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" +for-own@^0.1.4: + version "0.1.5" + resolved "https://registry.yarnpkg.com/for-own/-/for-own-0.1.5.tgz#5265c681a4f294dabbf17c9509b6763aa84510ce" + dependencies: + for-in "^1.0.1" + foreach@^2.0.5: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" @@ -1316,6 +1372,19 @@ getpass@^0.1.1: dependencies: assert-plus "^1.0.0" +glob-base@^0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4" + dependencies: + glob-parent "^2.0.0" + is-glob "^2.0.0" + +glob-parent@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-2.0.0.tgz#81383d72db054fcccf5336daa902f182f6edbb28" + dependencies: + is-glob "^2.0.0" + glob@^7.0.3, glob@^7.0.5, glob@^7.1.1, glob@^7.1.2: version "7.1.2" resolved "https://registry.yarnpkg.com/glob/-/glob-7.1.2.tgz#c19c9df9a028702d678612384a6552404c636d15" @@ -1616,6 +1685,16 @@ is-descriptor@^1.0.0, is-descriptor@^1.0.2: is-data-descriptor "^1.0.0" kind-of "^6.0.2" +is-dotfile@^1.0.0: + version "1.0.3" + resolved "https://registry.yarnpkg.com/is-dotfile/-/is-dotfile-1.0.3.tgz#a6a2f32ffd2dfb04f5ca25ecd0f6b83cf798a1e1" + +is-equal-shallow@^0.1.3: + version "0.1.3" + resolved "https://registry.yarnpkg.com/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz#2238098fc221de0bcfa5d9eac4c45d638aa1c534" + dependencies: + is-primitive "^2.0.0" + is-extendable@^0.1.0, is-extendable@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89" @@ -1626,6 +1705,10 @@ is-extendable@^1.0.1: dependencies: is-plain-object "^2.0.4" +is-extglob@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/is-extglob/-/is-extglob-1.0.0.tgz#ac468177c4943405a092fc8f29760c6ffc6206c0" + is-finite@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/is-finite/-/is-finite-1.0.2.tgz#cc6677695602be550ef11e8b4aa6305342b6d0aa" @@ -1646,6 +1729,18 @@ is-generator-fn@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-generator-fn/-/is-generator-fn-1.0.0.tgz#969d49e1bb3329f6bb7f09089be26578b2ddd46a" +is-glob@^2.0.0, is-glob@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-2.0.1.tgz#d096f926a3ded5600f3fdfd91198cb0888c2d863" + dependencies: + is-extglob "^1.0.0" + +is-number@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-2.1.0.tgz#01fcbbb393463a548f2f466cce16dece49db908f" + dependencies: + kind-of "^3.0.2" + is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -1668,6 +1763,14 @@ is-plain-object@^2.0.1, is-plain-object@^2.0.3, is-plain-object@^2.0.4: dependencies: isobject "^3.0.1" +is-posix-bracket@^0.1.0: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz#3334dc79774368e92f016e6fbc0a88f5cd6e6bc4" + +is-primitive@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/is-primitive/-/is-primitive-2.0.0.tgz#207bab91638499c07b2adf240a41a87210034575" + is-regex@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.0.4.tgz#5517489b547091b0930e095654ced25ee97e9491" @@ -1780,15 +1883,15 @@ istanbul-reports@^1.3.0: dependencies: handlebars "^4.0.3" -jest-changed-files@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-23.2.0.tgz#a145a6e4b66d0129fc7c99cee134dc937a643d9c" +jest-changed-files@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-23.4.2.tgz#1eed688370cd5eebafe4ae93d34bb3b64968fe83" dependencies: throat "^4.0.0" -jest-cli@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-23.3.0.tgz#307e9be7733443b789a8279d694054d051a9e5e2" +jest-cli@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-23.4.2.tgz#49d56bcfe6cf01871bfcc4a0494e08edaf2b61d0" dependencies: ansi-escapes "^3.0.0" chalk "^2.0.1" @@ -1801,22 +1904,22 @@ jest-cli@^23.3.0: istanbul-lib-coverage "^1.2.0" istanbul-lib-instrument "^1.10.1" istanbul-lib-source-maps "^1.2.4" - jest-changed-files "^23.2.0" - jest-config "^23.3.0" - jest-environment-jsdom "^23.3.0" + jest-changed-files "^23.4.2" + jest-config "^23.4.2" + jest-environment-jsdom "^23.4.0" jest-get-type "^22.1.0" - jest-haste-map "^23.2.0" - jest-message-util "^23.3.0" + jest-haste-map "^23.4.1" + jest-message-util "^23.4.0" jest-regex-util "^23.3.0" - jest-resolve-dependencies "^23.3.0" - jest-runner "^23.3.0" - jest-runtime "^23.3.0" - jest-snapshot "^23.3.0" - jest-util "^23.3.0" - jest-validate "^23.3.0" - jest-watcher "^23.2.0" + jest-resolve-dependencies "^23.4.2" + jest-runner "^23.4.2" + jest-runtime "^23.4.2" + jest-snapshot "^23.4.2" + jest-util "^23.4.0" + jest-validate "^23.4.0" + jest-watcher "^23.4.0" jest-worker "^23.2.0" - micromatch "^3.1.10" + micromatch "^2.3.11" node-notifier "^5.2.1" prompts "^0.1.9" realpath-native "^1.0.0" @@ -1827,22 +1930,22 @@ jest-cli@^23.3.0: which "^1.2.12" yargs "^11.0.0" -jest-config@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.3.0.tgz#bb4d53b70f9500fafddf718d226abb53b13b8323" +jest-config@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.4.2.tgz#62a105e14b8266458f2bf4d32403b2c44418fa77" dependencies: babel-core "^6.0.0" - babel-jest "^23.2.0" + babel-jest "^23.4.2" chalk "^2.0.1" glob "^7.1.1" - jest-environment-jsdom "^23.3.0" - jest-environment-node "^23.3.0" + jest-environment-jsdom "^23.4.0" + jest-environment-node "^23.4.0" jest-get-type "^22.1.0" - jest-jasmine2 "^23.3.0" + jest-jasmine2 "^23.4.2" jest-regex-util "^23.3.0" - jest-resolve "^23.2.0" - jest-util "^23.3.0" - jest-validate "^23.3.0" + jest-resolve "^23.4.1" + jest-util "^23.4.0" + jest-validate "^23.4.0" pretty-format "^23.2.0" jest-diff@^23.2.0: @@ -1860,58 +1963,59 @@ jest-docblock@^23.2.0: dependencies: detect-newline "^2.1.0" -jest-each@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.2.0.tgz#a400f81c857083f50c4f53399b109f12023fb19d" +jest-each@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.4.0.tgz#2fa9edd89daa1a4edc9ff9bf6062a36b71345143" dependencies: chalk "^2.0.1" pretty-format "^23.2.0" -jest-environment-jsdom@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-23.3.0.tgz#190457f91c9e615454c4186056065db6ed7a4e2a" +jest-environment-jsdom@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-23.4.0.tgz#056a7952b3fea513ac62a140a2c368c79d9e6023" dependencies: jest-mock "^23.2.0" - jest-util "^23.3.0" + jest-util "^23.4.0" jsdom "^11.5.1" -jest-environment-node@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-23.3.0.tgz#1e8df21c847aa5d03b76573f0dc16fcde5034c32" +jest-environment-node@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-23.4.0.tgz#57e80ed0841dea303167cce8cd79521debafde10" dependencies: jest-mock "^23.2.0" - jest-util "^23.3.0" + jest-util "^23.4.0" jest-get-type@^22.1.0: version "22.4.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" -jest-haste-map@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.2.0.tgz#d10cbac007c695948c8ef1821a2b2ed2d4f2d4d8" +jest-haste-map@^23.4.1: + version "23.4.1" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.4.1.tgz#43a174ba7ac079ae1dd74eaf5a5fe78989474dd2" dependencies: fb-watchman "^2.0.0" graceful-fs "^4.1.11" jest-docblock "^23.2.0" jest-serializer "^23.0.1" jest-worker "^23.2.0" - micromatch "^3.1.10" + micromatch "^2.3.11" sane "^2.0.0" -jest-jasmine2@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.3.0.tgz#a8706baac23c8a130d5aa8ef5464a9d49096d1b5" +jest-jasmine2@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.4.2.tgz#2fbf52f93e43ed4c5e7326a90bb1d785be4321ac" dependencies: + babel-traverse "^6.0.0" chalk "^2.0.1" co "^4.6.0" - expect "^23.3.0" + expect "^23.4.0" is-generator-fn "^1.0.0" jest-diff "^23.2.0" - jest-each "^23.2.0" + jest-each "^23.4.0" jest-matcher-utils "^23.2.0" - jest-message-util "^23.3.0" - jest-snapshot "^23.3.0" - jest-util "^23.3.0" + jest-message-util "^23.4.0" + jest-snapshot "^23.4.2" + jest-util "^23.4.0" pretty-format "^23.2.0" jest-leak-detector@^23.2.0: @@ -1928,13 +2032,13 @@ jest-matcher-utils@^23.2.0: jest-get-type "^22.1.0" pretty-format "^23.2.0" -jest-message-util@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-23.3.0.tgz#bc07b11cec6971fb5dd9de2dfb60ebc22150c160" +jest-message-util@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-23.4.0.tgz#17610c50942349508d01a3d1e0bda2c079086a9f" dependencies: "@babel/code-frame" "^7.0.0-beta.35" chalk "^2.0.1" - micromatch "^3.1.10" + micromatch "^2.3.11" slash "^1.0.0" stack-utils "^1.0.1" @@ -1946,42 +2050,42 @@ jest-regex-util@^23.3.0: version "23.3.0" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-23.3.0.tgz#5f86729547c2785c4002ceaa8f849fe8ca471bc5" -jest-resolve-dependencies@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.3.0.tgz#8444d3b0b1288b80864d8801ff50b44a4d695d1d" +jest-resolve-dependencies@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.4.2.tgz#0675ba876a5b819deffc449ad72e9985c2592048" dependencies: jest-regex-util "^23.3.0" - jest-snapshot "^23.3.0" + jest-snapshot "^23.4.2" -jest-resolve@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.2.0.tgz#a0790ad5a3b99002ab4dbfcbf8d9e2d6a69b3d99" +jest-resolve@^23.4.1: + version "23.4.1" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.4.1.tgz#7f3c17104732a2c0c940a01256025ed745814982" dependencies: browser-resolve "^1.11.3" chalk "^2.0.1" realpath-native "^1.0.0" -jest-runner@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.3.0.tgz#04c7e458a617501a4875db0d7ffbe0e3cbd43bfb" +jest-runner@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.4.2.tgz#579a88524ac52c846075b0129a21c7b483e75a7e" dependencies: exit "^0.1.2" graceful-fs "^4.1.11" - jest-config "^23.3.0" + jest-config "^23.4.2" jest-docblock "^23.2.0" - jest-haste-map "^23.2.0" - jest-jasmine2 "^23.3.0" + jest-haste-map "^23.4.1" + jest-jasmine2 "^23.4.2" jest-leak-detector "^23.2.0" - jest-message-util "^23.3.0" - jest-runtime "^23.3.0" - jest-util "^23.3.0" + jest-message-util "^23.4.0" + jest-runtime "^23.4.2" + jest-util "^23.4.0" jest-worker "^23.2.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-23.3.0.tgz#4865aab4ceff82f9cec6335fd7ae1422cc1de7df" +jest-runtime@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-23.4.2.tgz#00c3bb8385253d401a394a27d1112d3615e5a65c" dependencies: babel-core "^6.0.0" babel-plugin-istanbul "^4.1.6" @@ -1990,15 +2094,15 @@ jest-runtime@^23.3.0: exit "^0.1.2" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.1.11" - jest-config "^23.3.0" - jest-haste-map "^23.2.0" - jest-message-util "^23.3.0" + jest-config "^23.4.2" + jest-haste-map "^23.4.1" + jest-message-util "^23.4.0" jest-regex-util "^23.3.0" - jest-resolve "^23.2.0" - jest-snapshot "^23.3.0" - jest-util "^23.3.0" - jest-validate "^23.3.0" - micromatch "^3.1.10" + jest-resolve "^23.4.1" + jest-snapshot "^23.4.2" + jest-util "^23.4.0" + jest-validate "^23.4.0" + micromatch "^2.3.11" realpath-native "^1.0.0" slash "^1.0.0" strip-bom "3.0.0" @@ -2009,47 +2113,46 @@ jest-serializer@^23.0.1: version "23.0.1" resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-23.0.1.tgz#a3776aeb311e90fe83fab9e533e85102bd164165" -jest-snapshot@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.3.0.tgz#fc4e9f81e45432d10507e27f50bce60f44d81424" +jest-snapshot@^23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.4.2.tgz#8fa6130feb5a527dac73e5fa80d86f29f7c42ab6" dependencies: - babel-traverse "^6.0.0" babel-types "^6.0.0" chalk "^2.0.1" jest-diff "^23.2.0" jest-matcher-utils "^23.2.0" - jest-message-util "^23.3.0" - jest-resolve "^23.2.0" + jest-message-util "^23.4.0" + jest-resolve "^23.4.1" mkdirp "^0.5.1" natural-compare "^1.4.0" pretty-format "^23.2.0" semver "^5.5.0" -jest-util@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-23.3.0.tgz#79f35bb0c30100ef611d963ee6b88f8ed873a81d" +jest-util@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-23.4.0.tgz#4d063cb927baf0a23831ff61bec2cbbf49793561" dependencies: callsites "^2.0.0" chalk "^2.0.1" graceful-fs "^4.1.11" is-ci "^1.0.10" - jest-message-util "^23.3.0" + jest-message-util "^23.4.0" mkdirp "^0.5.1" slash "^1.0.0" source-map "^0.6.0" -jest-validate@^23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.3.0.tgz#d49bea6aad98c30acd2cbb542434798a0cc13f76" +jest-validate@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.4.0.tgz#d96eede01ef03ac909c009e9c8e455197d48c201" dependencies: chalk "^2.0.1" jest-get-type "^22.1.0" leven "^2.1.0" pretty-format "^23.2.0" -jest-watcher@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-23.2.0.tgz#678e852896e919e9d9a0eb4b8baf1ae279620ea9" +jest-watcher@^23.4.0: + version "23.4.0" + resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-23.4.0.tgz#d2e28ce74f8dad6c6afc922b92cabef6ed05c91c" dependencies: ansi-escapes "^3.0.0" chalk "^2.0.1" @@ -2061,12 +2164,12 @@ jest-worker@^23.2.0: dependencies: merge-stream "^1.0.1" -jest@23.3.0: - version "23.3.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-23.3.0.tgz#1355cd792f38cf20fba4da02dddb7ca14d9484b5" +jest@23.4.2: + version "23.4.2" + resolved "https://registry.yarnpkg.com/jest/-/jest-23.4.2.tgz#1fae3ed832192143070ae85156b25cea891a1260" dependencies: import-local "^1.0.0" - jest-cli "^23.3.0" + jest-cli "^23.4.2" js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" @@ -2268,6 +2371,10 @@ map-visit@^1.0.0: dependencies: object-visit "^1.0.0" +math-random@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/math-random/-/math-random-1.0.1.tgz#8b3aac588b8a66e4975e3cdea67f7bb329601fac" + mdn-data@^1.0.0, mdn-data@~1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/mdn-data/-/mdn-data-1.1.0.tgz#a7056319da95a2d0881267d7263075042eb061e2" @@ -2288,23 +2395,23 @@ merge@^1.1.3: version "1.2.0" resolved "https://registry.yarnpkg.com/merge/-/merge-1.2.0.tgz#7531e39d4949c281a66b8c5a6e0265e8b05894da" -micromatch@^3.1.10: - version "3.1.10" - resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-3.1.10.tgz#70859bc95c9840952f359a068a3fc49f9ecfac23" - dependencies: - arr-diff "^4.0.0" - array-unique "^0.3.2" - braces "^2.3.1" - define-property "^2.0.2" - extend-shallow "^3.0.2" - extglob "^2.0.4" - fragment-cache "^0.2.1" - kind-of "^6.0.2" - nanomatch "^1.2.9" - object.pick "^1.3.0" - regex-not "^1.0.0" - snapdragon "^0.8.1" - to-regex "^3.0.2" +micromatch@^2.3.11: + version "2.3.11" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565" + dependencies: + arr-diff "^2.0.0" + array-unique "^0.2.1" + braces "^1.8.2" + expand-brackets "^0.1.4" + extglob "^0.3.1" + filename-regex "^2.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.1" + kind-of "^3.0.2" + normalize-path "^2.0.1" + object.omit "^2.0.0" + parse-glob "^3.0.4" + regex-cache "^0.4.2" micromatch@^3.1.4, micromatch@^3.1.8: version "3.1.9" @@ -2464,7 +2571,7 @@ normalize-package-data@^2.3.2: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^2.1.1: +normalize-path@^2.0.1, normalize-path@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.1.1.tgz#1ab28b556e198363a8c1a6f7e6fa20137fe6aed9" dependencies: @@ -2532,6 +2639,13 @@ object.getownpropertydescriptors@^2.0.3: define-properties "^1.1.2" es-abstract "^1.5.1" +object.omit@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/object.omit/-/object.omit-2.0.1.tgz#1a9c744829f39dbb858c76ca3579ae2a54ebd1fa" + dependencies: + for-own "^0.1.4" + is-extendable "^0.1.1" + object.pick@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/object.pick/-/object.pick-1.3.0.tgz#87a10ac4c1694bd2e1cbf53591a66141fb5dd747" @@ -2611,6 +2725,15 @@ p-try@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3" +parse-glob@^3.0.4: + version "3.0.4" + resolved "https://registry.yarnpkg.com/parse-glob/-/parse-glob-3.0.4.tgz#b2c376cfb11f35513badd173ef0bb6e3a388391c" + dependencies: + glob-base "^0.3.0" + is-dotfile "^1.0.0" + is-extglob "^1.0.0" + is-glob "^2.0.0" + parse-json@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-2.2.0.tgz#f480f40434ef80741f8469099f8dea18f55a4dc9" @@ -2726,6 +2849,10 @@ prelude-ls@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" +preserve@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" + prettier@1.14.1: version "1.14.1" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.1.tgz#4ead68e66b5ec9e771de311570c90da822f5a17a" @@ -2806,6 +2933,14 @@ quick-format-unescaped@^1.1.2: dependencies: fast-safe-stringify "^1.0.8" +randomatic@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-3.0.0.tgz#d35490030eb4f7578de292ce6dfb04a91a128923" + dependencies: + is-number "^4.0.0" + kind-of "^6.0.0" + math-random "^1.0.1" + range-parser@~1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/range-parser/-/range-parser-1.2.0.tgz#f49be6b487894ddc40dcc94a322f611092e00d5e" @@ -2868,6 +3003,12 @@ regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" +regex-cache@^0.4.2: + version "0.4.4" + resolved "https://registry.yarnpkg.com/regex-cache/-/regex-cache-0.4.4.tgz#75bdc58a2a1496cec48a12835bc54c8d562336dd" + dependencies: + is-equal-shallow "^0.1.3" + regex-not@^1.0.0, regex-not@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/regex-not/-/regex-not-1.0.2.tgz#1f4ece27e00b0b65e0247a6810e6a85d83a5752c" @@ -3423,7 +3564,7 @@ to-regex-range@^2.1.0: is-number "^3.0.0" repeat-string "^1.6.1" -to-regex@^3.0.1, to-regex@^3.0.2: +to-regex@^3.0.1: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" dependencies: From 191a28af3a40cfced1986d260e0f3f95eb85ffa2 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 8 Aug 2018 17:33:59 +0000 Subject: [PATCH 010/164] Update dependency typescript to v3 --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 17431922..934edace 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "fastify-static": "0.12.0", "jest": "23.4.2", "prettier": "1.14.1", - "typescript": "2.9.2" + "typescript": "3.0.1" }, "scripts": { "tsc": "tsc -p .", diff --git a/yarn.lock b/yarn.lock index a9427559..7d807135 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3609,9 +3609,9 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript@2.9.2: - version "2.9.2" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.9.2.tgz#1cbf61d05d6b96269244eb6a3bce4bd914e0f00c" +typescript@3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb" uglify-js@^2.6: version "2.8.29" From 981419e86e1686f4b70bb5ca34c28bbb327f51bd Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 23 Jul 2018 12:58:47 +0000 Subject: [PATCH 011/164] Update dependency fastify to v1.9.0 --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index c77a5043..419814e3 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@types/cheerio": "0.22.8", "@types/node": "8.10.24", "@types/puppeteer": "1.3.4", - "fastify": "1.8.0", + "fastify": "1.9.0", "fastify-static": "0.12.0", "jest": "23.4.2", "prettier": "1.14.1", diff --git a/yarn.lock b/yarn.lock index c028738b..7e2579e9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1167,9 +1167,9 @@ fastify-static@0.12.0: readable-stream "^2.3.6" send "^0.16.0" -fastify@1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.8.0.tgz#dbf8e15d92873c47f708d12cc49175dcfc80ec3c" +fastify@1.9.0: + version "1.9.0" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.9.0.tgz#8ce7c4e4eb06077f45aa56c514c1498a42a71039" dependencies: "@types/pino" "^4.16.0" abstract-logging "^1.0.0" From 734e490721e9b84aa16560059910876ed6326a61 Mon Sep 17 00:00:00 2001 From: stereobooster Date: Wed, 8 Aug 2018 20:49:59 +0200 Subject: [PATCH 012/164] It seems we gave up idea of TS, so lets remove it --- .travis.yml | 1 - README.md | 11 ----------- package.json | 6 +----- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 175d167b..9002000d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,6 @@ branches: before_install: - docker build -t minimalcss:tests . script: - - docker container run -it minimalcss:tests yarn tsc - docker container run -it minimalcss:tests yarn lintcheck - docker container run -it minimalcss:tests yarn test - docker container run -it --env CI=$CI minimalcss:tests yarn e2e diff --git a/README.md b/README.md index 8b2e17a8..c4e24c2a 100644 --- a/README.md +++ b/README.md @@ -308,17 +308,6 @@ yarn jest Best way to get into writing tests is to look at existing tests and copy. -### Type checking - -We use ES6+ with jsdoc comments and TypeScript to do static type checking, -like [puppeeteer does](https://github.com/GoogleChrome/puppeteer/pull/986/files). - -Run `tsc` to check types. - -```sh -yarn tsc -``` - ### Prettier All code is expected to conform with [Prettier](https://prettier.io/) according diff --git a/package.json b/package.json index 419814e3..dae46820 100644 --- a/package.json +++ b/package.json @@ -31,14 +31,10 @@ "puppeteer": "^1.4.0" }, "devDependencies": { - "@types/cheerio": "0.22.8", - "@types/node": "8.10.24", - "@types/puppeteer": "1.3.4", "fastify": "1.9.0", "fastify-static": "0.12.0", "jest": "23.4.2", - "prettier": "1.14.1", - "typescript": "3.0.1" + "prettier": "1.14.1" }, "scripts": { "tsc": "tsc -p .", From 3cfcf5f96ec6a9fa86cc59a35a5d77db778d7c76 Mon Sep 17 00:00:00 2001 From: stereobooster Date: Wed, 8 Aug 2018 21:24:11 +0200 Subject: [PATCH 013/164] Add ignoreCSSErrors option --- README.md | 1 + src/run.js | 54 +++++++++++++++++++++++++--------------------- tests/main.test.js | 9 +++++++- 3 files changed, 38 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 8b2e17a8..b5599de1 100644 --- a/README.md +++ b/README.md @@ -176,6 +176,7 @@ key is `urls`. Other optional options are: of strings for headless Chrome](https://peter.sh/experiments/chromium-command-line-switches/). * `cssoOptions` - CSSO compress function [options](https://github.com/css/csso#compressast-options) * `timeout` - Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. +* `ignoreCSSErrors` - By default, any CSS parsing error throws an error in minimalcss. If you know it's safe to ignore (for example, third-party CSS resources), set this to true. ## Warnings diff --git a/src/run.js b/src/run.js index 90cce914..0c8ac3a0 100644 --- a/src/run.js +++ b/src/run.js @@ -339,7 +339,7 @@ const processPage = ({ /** * - * @param {{ urls: Array, debug: boolean, loadimages: boolean, skippable: function, browser: any, userAgent: string, withoutjavascript: boolean, viewport: any, puppeteerArgs: Array, cssoOptions: Object }} options + * @param {{ urls: Array, debug: boolean, loadimages: boolean, skippable: function, browser: any, userAgent: string, withoutjavascript: boolean, viewport: any, puppeteerArgs: Array, cssoOptions: Object, ignoreCSSErrors?: boolean }} options * @return Promise<{ finalCss: string, stylesheetContents: { [key: string]: string } }> */ const minimalcss = async options => { @@ -457,33 +457,37 @@ const minimalcss = async options => { } if (!node.prelude.children) { - throw new Error( - `Invalid CSS found while evaluating ${href}: "${ - node.prelude.value - }"` - ); - } - - node.prelude.children.forEach((node, item, list) => { - // Translate selector's AST to a string and filter pseudos from it - // This changes things like `a.button:active` to `a.button` - const selectorString = utils.reduceCSSSelector( - csstree.generate(node) - ); - if (selectorString in decisionsCache === false) { - decisionsCache[selectorString] = isSelectorMatchToAnyElement( - selectorString - ); - } - if (!decisionsCache[selectorString]) { - // delete selector from a list of selectors + const cssErrorMessage = `Invalid CSS found while evaluating ${href}: "${ + node.prelude.value + }"`; + if (options.ignoreCSSErrors) { + console.warn(cssErrorMessage); list.remove(item); + } else { + throw new Error(cssErrorMessage); } - }); + } else { + node.prelude.children.forEach((node, item, list) => { + // Translate selector's AST to a string and filter pseudos from it + // This changes things like `a.button:active` to `a.button` + const selectorString = utils.reduceCSSSelector( + csstree.generate(node) + ); + if (selectorString in decisionsCache === false) { + decisionsCache[selectorString] = isSelectorMatchToAnyElement( + selectorString + ); + } + if (!decisionsCache[selectorString]) { + // delete selector from a list of selectors + list.remove(item); + } + }); - if (node.prelude.children.isEmpty()) { - // delete rule from a list - list.remove(item); + if (node.prelude.children.isEmpty()) { + // delete rule from a list + list.remove(item); + } } } }); diff --git a/tests/main.test.js b/tests/main.test.js index 4ededb63..ad0c2446 100644 --- a/tests/main.test.js +++ b/tests/main.test.js @@ -145,7 +145,7 @@ test('form elements', async () => { expect(finalCss).toMatch('option:selected'); }); -test.only('invalid css', async () => { +test('invalid css', async () => { expect.assertions(1); try { @@ -159,6 +159,13 @@ test.only('invalid css', async () => { } }); +test('ignoreCSSErrors', async () => { + const { finalCss } = await runMinimalcss('invalid-css', { + ignoreCSSErrors: true + }); + expect(finalCss).toEqual(''); +}); + test('handles 307 CSS file', async () => { const { finalCss } = await runMinimalcss('307css'); expect(finalCss).toEqual('p{color:violet}'); From 9c9015ca963a00b529b5dcef7d8e47e228ebceae Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Wed, 8 Aug 2018 17:04:41 -0400 Subject: [PATCH 014/164] prep for 0.7.8 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d477a7ca..a639987d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.7.8 + +* New option `ignoreCSSErrors` to ignore possible CSS parsing errors. + [pull#249](https://github.com/peterbe/minimalcss/pull/249) + Thanks @stereobooster + # 0.7.7 * Throw explicit errors on invalid CSS From 9b756476ff03371fdd5c2ace16483f9a1f931b3a Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Wed, 8 Aug 2018 17:04:48 -0400 Subject: [PATCH 015/164] 0.7.8 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dae46820..6855e284 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minimalcss", - "version": "0.7.7", + "version": "0.7.8", "description": "Extract the minimal CSS used in a set of URLs with puppeteer", "main": "./index.js", "author": "Peter Bengtsson", From a255f6d3f108e303d79ea8a3e3cbe524e0475ba5 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 9 Aug 2018 03:07:05 +0000 Subject: [PATCH 016/164] Update dependency prettier to v1.14.2 --- package.json | 2 +- yarn.lock | 25 +++---------------------- 2 files changed, 4 insertions(+), 23 deletions(-) diff --git a/package.json b/package.json index 6855e284..a1a135d8 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "fastify": "1.9.0", "fastify-static": "0.12.0", "jest": "23.4.2", - "prettier": "1.14.1" + "prettier": "1.14.2" }, "scripts": { "tsc": "tsc -p .", diff --git a/yarn.lock b/yarn.lock index 7e2579e9..b9cb7c3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16,10 +16,6 @@ esutils "^2.0.2" js-tokens "^3.0.0" -"@types/cheerio@0.22.8": - version "0.22.8" - resolved "https://registry.yarnpkg.com/@types/cheerio/-/cheerio-0.22.8.tgz#5702f74f78b73e13f1eb1bd435c2c9de61a250d4" - "@types/events@*": version "1.2.0" resolved "https://registry.yarnpkg.com/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86" @@ -28,10 +24,6 @@ version "9.4.7" resolved "http://registry.npmjs.org/@types/node/-/node-9.4.7.tgz#57d81cd98719df2c9de118f2d5f3b1120dcd7275" -"@types/node@8.10.24": - version "8.10.24" - resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.24.tgz#302a8f0c00bd1bf364471b6687258617c5d410fc" - "@types/pino@^4.16.0": version "4.16.0" resolved "https://registry.yarnpkg.com/@types/pino/-/pino-4.16.0.tgz#802d0e8d36009a39c5c9163634a3344073f04be5" @@ -39,13 +31,6 @@ "@types/events" "*" "@types/node" "*" -"@types/puppeteer@1.3.4": - version "1.3.4" - resolved "https://registry.yarnpkg.com/@types/puppeteer/-/puppeteer-1.3.4.tgz#6fff43968792924ac2b68744641566e6acefdc20" - dependencies: - "@types/events" "*" - "@types/node" "*" - abab@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/abab/-/abab-1.0.4.tgz#5faad9c2c07f60dd76770f71cf025b62a63cfd4e" @@ -2853,9 +2838,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@1.14.1: - version "1.14.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.1.tgz#4ead68e66b5ec9e771de311570c90da822f5a17a" +prettier@1.14.2: + version "1.14.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" pretty-format@^23.2.0: version "23.2.0" @@ -3609,10 +3594,6 @@ typedarray@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777" -typescript@3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb" - uglify-js@^2.6: version "2.8.29" resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-2.8.29.tgz#29c5733148057bb4e1f75df35b7a9cb72e6a59dd" From 4e068621df4f467ac73eabd773a2a5eb7f179457 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Fri, 10 Aug 2018 14:28:19 -0400 Subject: [PATCH 017/164] Update dependency jest to v23.5.0 (#252) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit

This Pull Request updates dependency jest from v23.4.2 to v23.5.0


Release Notes

v23.5.0

Compare Source

Features
  • [jest-cli] Add package name to NotifyReporter notification (#​5898)
  • [jest-runner] print stack trace when process.exit is called from user code (#​6714)
  • [jest-each] introduces %# option to add index of the test to its title (#​6414)
  • [pretty-format] Support serializing DocumentFragment (#​6705)
  • [jest-validate] Add recursive and recursiveBlacklist options for deep config checks (#​6802)
  • [jest-cli] Check watch plugins for key conflicts (#​6697)
Fixes
  • [jest-snapshot Mark snapshots as obsolete when moved to an inline snapshot (#​6773)
  • [jest-config] Fix --coverage with --findRelatedTests overwriting collectCoverageFrom options (#​6736)
  • [jest-config] Update default config for testURL from 'about:blank' to 'http://localhost' to address latest JSDOM security warning. (#​6792)
  • [jest-cli] Fix testMatch not working with negations (#​6648)
  • [jest-cli] Don't report promises as open handles (#​6716)
  • [jest-each] Add timeout support to parameterised tests (#​6660)
  • [jest-cli] Improve the message when running coverage while there are no files matching global threshold (#​6334)
  • [jest-snapshot] Correctly merge property matchers with the rest of the snapshot in toMatchSnapshot. (#​6528)
  • [jest-snapshot] Add error messages for invalid property matchers. (#​6528)
  • [jest-cli] Show open handles from inside test files as well (#​6263)
  • [jest-haste-map] Fix a problem where creating folders ending with .js could cause a crash (#​6818)
Chore & Maintenance
  • [docs] Document another option to avoid warnings with React 16 (#​5258)
Chore & Maintenance
  • [docs] Add note explaining when jest.setTimeout should be called (#​6817)


This PR has been generated by Renovate Bot.

--- package.json | 2 +- yarn.lock | 186 ++++++++++++++++++++++++++------------------------- 2 files changed, 95 insertions(+), 93 deletions(-) diff --git a/package.json b/package.json index a1a135d8..bee5651f 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "devDependencies": { "fastify": "1.9.0", "fastify-static": "0.12.0", - "jest": "23.4.2", + "jest": "23.5.0", "prettier": "1.14.2" }, "scripts": { diff --git a/yarn.lock b/yarn.lock index b9cb7c3e..72362245 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1039,14 +1039,14 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -expect@^23.4.0: - version "23.4.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-23.4.0.tgz#6da4ecc99c1471253e7288338983ad1ebadb60c3" +expect@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-23.5.0.tgz#18999a0eef8f8acf99023fde766d9c323c2562ed" dependencies: ansi-styles "^3.2.0" - jest-diff "^23.2.0" + jest-diff "^23.5.0" jest-get-type "^22.1.0" - jest-matcher-utils "^23.2.0" + jest-matcher-utils "^23.5.0" jest-message-util "^23.4.0" jest-regex-util "^23.3.0" @@ -1592,7 +1592,7 @@ ini@~1.3.0: version "1.3.5" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.5.tgz#eee25f56db1c9ec6085e0c22778083f596abf927" -invariant@^2.2.2: +invariant@^2.2.2, invariant@^2.2.4: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" dependencies: @@ -1874,9 +1874,9 @@ jest-changed-files@^23.4.2: dependencies: throat "^4.0.0" -jest-cli@^23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-23.4.2.tgz#49d56bcfe6cf01871bfcc4a0494e08edaf2b61d0" +jest-cli@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-23.5.0.tgz#d316b8e34a38a610a1efc4f0403d8ef8a55e4492" dependencies: ansi-escapes "^3.0.0" chalk "^2.0.1" @@ -1890,18 +1890,18 @@ jest-cli@^23.4.2: istanbul-lib-instrument "^1.10.1" istanbul-lib-source-maps "^1.2.4" jest-changed-files "^23.4.2" - jest-config "^23.4.2" + jest-config "^23.5.0" jest-environment-jsdom "^23.4.0" jest-get-type "^22.1.0" - jest-haste-map "^23.4.1" + jest-haste-map "^23.5.0" jest-message-util "^23.4.0" jest-regex-util "^23.3.0" - jest-resolve-dependencies "^23.4.2" - jest-runner "^23.4.2" - jest-runtime "^23.4.2" - jest-snapshot "^23.4.2" + jest-resolve-dependencies "^23.5.0" + jest-runner "^23.5.0" + jest-runtime "^23.5.0" + jest-snapshot "^23.5.0" jest-util "^23.4.0" - jest-validate "^23.4.0" + jest-validate "^23.5.0" jest-watcher "^23.4.0" jest-worker "^23.2.0" micromatch "^2.3.11" @@ -1915,9 +1915,9 @@ jest-cli@^23.4.2: which "^1.2.12" yargs "^11.0.0" -jest-config@^23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.4.2.tgz#62a105e14b8266458f2bf4d32403b2c44418fa77" +jest-config@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.5.0.tgz#3770fba03f7507ee15f3b8867c742e48f31a9773" dependencies: babel-core "^6.0.0" babel-jest "^23.4.2" @@ -1926,21 +1926,22 @@ jest-config@^23.4.2: jest-environment-jsdom "^23.4.0" jest-environment-node "^23.4.0" jest-get-type "^22.1.0" - jest-jasmine2 "^23.4.2" + jest-jasmine2 "^23.5.0" jest-regex-util "^23.3.0" - jest-resolve "^23.4.1" + jest-resolve "^23.5.0" jest-util "^23.4.0" - jest-validate "^23.4.0" - pretty-format "^23.2.0" + jest-validate "^23.5.0" + micromatch "^2.3.11" + pretty-format "^23.5.0" -jest-diff@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-23.2.0.tgz#9f2cf4b51e12c791550200abc16b47130af1062a" +jest-diff@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-23.5.0.tgz#250651a433dd0050290a07642946cc9baaf06fba" dependencies: chalk "^2.0.1" diff "^3.2.0" jest-get-type "^22.1.0" - pretty-format "^23.2.0" + pretty-format "^23.5.0" jest-docblock@^23.2.0: version "23.2.0" @@ -1948,12 +1949,12 @@ jest-docblock@^23.2.0: dependencies: detect-newline "^2.1.0" -jest-each@^23.4.0: - version "23.4.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.4.0.tgz#2fa9edd89daa1a4edc9ff9bf6062a36b71345143" +jest-each@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.5.0.tgz#77f7e2afe6132a80954b920006e78239862b10ba" dependencies: chalk "^2.0.1" - pretty-format "^23.2.0" + pretty-format "^23.5.0" jest-environment-jsdom@^23.4.0: version "23.4.0" @@ -1974,48 +1975,49 @@ jest-get-type@^22.1.0: version "22.4.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" -jest-haste-map@^23.4.1: - version "23.4.1" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.4.1.tgz#43a174ba7ac079ae1dd74eaf5a5fe78989474dd2" +jest-haste-map@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.5.0.tgz#d4ca618188bd38caa6cb20349ce6610e194a8065" dependencies: fb-watchman "^2.0.0" graceful-fs "^4.1.11" + invariant "^2.2.4" jest-docblock "^23.2.0" jest-serializer "^23.0.1" jest-worker "^23.2.0" micromatch "^2.3.11" sane "^2.0.0" -jest-jasmine2@^23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.4.2.tgz#2fbf52f93e43ed4c5e7326a90bb1d785be4321ac" +jest-jasmine2@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.5.0.tgz#05fe7f1788e650eeb5a03929e6461ea2e9f3db53" dependencies: babel-traverse "^6.0.0" chalk "^2.0.1" co "^4.6.0" - expect "^23.4.0" + expect "^23.5.0" is-generator-fn "^1.0.0" - jest-diff "^23.2.0" - jest-each "^23.4.0" - jest-matcher-utils "^23.2.0" + jest-diff "^23.5.0" + jest-each "^23.5.0" + jest-matcher-utils "^23.5.0" jest-message-util "^23.4.0" - jest-snapshot "^23.4.2" + jest-snapshot "^23.5.0" jest-util "^23.4.0" - pretty-format "^23.2.0" + pretty-format "^23.5.0" -jest-leak-detector@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-23.2.0.tgz#c289d961dc638f14357d4ef96e0431ecc1aa377d" +jest-leak-detector@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-23.5.0.tgz#14ac2a785bd625160a2ea968fd5d98b7dcea3e64" dependencies: - pretty-format "^23.2.0" + pretty-format "^23.5.0" -jest-matcher-utils@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-23.2.0.tgz#4d4981f23213e939e3cedf23dc34c747b5ae1913" +jest-matcher-utils@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-23.5.0.tgz#0e2ea67744cab78c9ab15011c4d888bdd3e49e2a" dependencies: chalk "^2.0.1" jest-get-type "^22.1.0" - pretty-format "^23.2.0" + pretty-format "^23.5.0" jest-message-util@^23.4.0: version "23.4.0" @@ -2035,42 +2037,42 @@ jest-regex-util@^23.3.0: version "23.3.0" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-23.3.0.tgz#5f86729547c2785c4002ceaa8f849fe8ca471bc5" -jest-resolve-dependencies@^23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.4.2.tgz#0675ba876a5b819deffc449ad72e9985c2592048" +jest-resolve-dependencies@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.5.0.tgz#10c4d135beb9d2256de1fedc7094916c3ad74af7" dependencies: jest-regex-util "^23.3.0" - jest-snapshot "^23.4.2" + jest-snapshot "^23.5.0" -jest-resolve@^23.4.1: - version "23.4.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.4.1.tgz#7f3c17104732a2c0c940a01256025ed745814982" +jest-resolve@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.5.0.tgz#3b8e7f67e84598f0caf63d1530bd8534a189d0e6" dependencies: browser-resolve "^1.11.3" chalk "^2.0.1" realpath-native "^1.0.0" -jest-runner@^23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.4.2.tgz#579a88524ac52c846075b0129a21c7b483e75a7e" +jest-runner@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.5.0.tgz#570f7a044da91648b5bb9b6baacdd511076c71d7" dependencies: exit "^0.1.2" graceful-fs "^4.1.11" - jest-config "^23.4.2" + jest-config "^23.5.0" jest-docblock "^23.2.0" - jest-haste-map "^23.4.1" - jest-jasmine2 "^23.4.2" - jest-leak-detector "^23.2.0" + jest-haste-map "^23.5.0" + jest-jasmine2 "^23.5.0" + jest-leak-detector "^23.5.0" jest-message-util "^23.4.0" - jest-runtime "^23.4.2" + jest-runtime "^23.5.0" jest-util "^23.4.0" jest-worker "^23.2.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-23.4.2.tgz#00c3bb8385253d401a394a27d1112d3615e5a65c" +jest-runtime@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-23.5.0.tgz#eb503525a196dc32f2f9974e3482d26bdf7b63ce" dependencies: babel-core "^6.0.0" babel-plugin-istanbul "^4.1.6" @@ -2079,14 +2081,14 @@ jest-runtime@^23.4.2: exit "^0.1.2" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.1.11" - jest-config "^23.4.2" - jest-haste-map "^23.4.1" + jest-config "^23.5.0" + jest-haste-map "^23.5.0" jest-message-util "^23.4.0" jest-regex-util "^23.3.0" - jest-resolve "^23.4.1" - jest-snapshot "^23.4.2" + jest-resolve "^23.5.0" + jest-snapshot "^23.5.0" jest-util "^23.4.0" - jest-validate "^23.4.0" + jest-validate "^23.5.0" micromatch "^2.3.11" realpath-native "^1.0.0" slash "^1.0.0" @@ -2098,19 +2100,19 @@ jest-serializer@^23.0.1: version "23.0.1" resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-23.0.1.tgz#a3776aeb311e90fe83fab9e533e85102bd164165" -jest-snapshot@^23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.4.2.tgz#8fa6130feb5a527dac73e5fa80d86f29f7c42ab6" +jest-snapshot@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.5.0.tgz#cc368ebd8513e1175e2a7277f37a801b7358ae79" dependencies: babel-types "^6.0.0" chalk "^2.0.1" - jest-diff "^23.2.0" - jest-matcher-utils "^23.2.0" + jest-diff "^23.5.0" + jest-matcher-utils "^23.5.0" jest-message-util "^23.4.0" - jest-resolve "^23.4.1" + jest-resolve "^23.5.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^23.2.0" + pretty-format "^23.5.0" semver "^5.5.0" jest-util@^23.4.0: @@ -2126,14 +2128,14 @@ jest-util@^23.4.0: slash "^1.0.0" source-map "^0.6.0" -jest-validate@^23.4.0: - version "23.4.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.4.0.tgz#d96eede01ef03ac909c009e9c8e455197d48c201" +jest-validate@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.5.0.tgz#f5df8f761cf43155e1b2e21d6e9de8a2852d0231" dependencies: chalk "^2.0.1" jest-get-type "^22.1.0" leven "^2.1.0" - pretty-format "^23.2.0" + pretty-format "^23.5.0" jest-watcher@^23.4.0: version "23.4.0" @@ -2149,12 +2151,12 @@ jest-worker@^23.2.0: dependencies: merge-stream "^1.0.1" -jest@23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/jest/-/jest-23.4.2.tgz#1fae3ed832192143070ae85156b25cea891a1260" +jest@23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-23.5.0.tgz#80de353d156ea5ea4a7332f7962ac79135fbc62e" dependencies: import-local "^1.0.0" - jest-cli "^23.4.2" + jest-cli "^23.5.0" js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" @@ -2842,9 +2844,9 @@ prettier@1.14.2: version "1.14.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" -pretty-format@^23.2.0: - version "23.2.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.2.0.tgz#3b0aaa63c018a53583373c1cb3a5d96cc5e83017" +pretty-format@^23.5.0: + version "23.5.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.5.0.tgz#0f9601ad9da70fe690a269cd3efca732c210687c" dependencies: ansi-regex "^3.0.0" ansi-styles "^3.2.0" From 4033585abd0bf6c2f3561f3af97ced1db6436460 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Tue, 14 Aug 2018 10:49:08 -0400 Subject: [PATCH 018/164] Update dependency fastify-static to v0.13.0 (#254) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit

This Pull Request updates devDependency fastify-static from v0.12.0 to v0.13.0


Release Notes

v0.13.0

Compare Source

  • Updated readalbe-stream@​3 #​68
  • Dropped support for Node 9.


This PR has been generated by Renovate Bot.

--- package.json | 2 +- yarn.lock | 38 +++++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index bee5651f..9c12d52b 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "fastify": "1.9.0", - "fastify-static": "0.12.0", + "fastify-static": "0.13.0", "jest": "23.5.0", "prettier": "1.14.2" }, diff --git a/yarn.lock b/yarn.lock index 72362245..71bf15e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1138,18 +1138,18 @@ fast-safe-stringify@^1.0.8, fast-safe-stringify@^1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/fast-safe-stringify/-/fast-safe-stringify-1.2.3.tgz#9fe22c37fb2f7f86f06b8f004377dbf8f1ee7bc1" -fastify-plugin@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/fastify-plugin/-/fastify-plugin-1.0.0.tgz#cc28954bf256df6ba141e30966ab5c4be61a3400" +fastify-plugin@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/fastify-plugin/-/fastify-plugin-1.2.0.tgz#b87274ad9d14e41efcd3240c64f5dee4c39b2154" dependencies: semver "^5.5.0" -fastify-static@0.12.0: - version "0.12.0" - resolved "https://registry.yarnpkg.com/fastify-static/-/fastify-static-0.12.0.tgz#024d6cf37a6b64bb4486921bdc88315c7c98799c" +fastify-static@0.13.0: + version "0.13.0" + resolved "https://registry.yarnpkg.com/fastify-static/-/fastify-static-0.13.0.tgz#32edb9f42162bd23cc1ddf8ed1f9ea39675187bc" dependencies: - fastify-plugin "^1.0.0" - readable-stream "^2.3.6" + fastify-plugin "^1.2.0" + readable-stream "^3.0.0" send "^0.16.0" fastify@1.9.0: @@ -2980,6 +2980,14 @@ readable-stream@^2.3.6: string_decoder "~1.1.1" util-deprecate "~1.0.1" +readable-stream@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.0.1.tgz#a209a46ad933f9c8146591ac2c56ca0e39c141cf" + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + realpath-native@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/realpath-native/-/realpath-native-1.0.0.tgz#7885721a83b43bd5327609f0ddecb2482305fdf0" @@ -3418,15 +3426,15 @@ string-width@^2.0.0, string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string_decoder@~1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" +string_decoder@^1.1.1, string_decoder@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" dependencies: safe-buffer "~5.1.0" -string_decoder@~1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" +string_decoder@~1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.0.3.tgz#0fc67d7c141825de94282dd536bec6b9bce860ab" dependencies: safe-buffer "~5.1.0" @@ -3649,7 +3657,7 @@ use@^3.1.0: dependencies: kind-of "^6.0.2" -util-deprecate@~1.0.1: +util-deprecate@^1.0.1, util-deprecate@~1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" From e4fd1dcb836b2a0309c0d3d8d55adcdd8decc83d Mon Sep 17 00:00:00 2001 From: jc275 Date: Thu, 16 Aug 2018 21:02:04 +0100 Subject: [PATCH 019/164] ignoreJSErrors (#253) Aside from tests and documentation, this should be the only change needed. Camel-cased `ignoreJsErrors` (and `ignoreCssErrors`) might be more in keeping with the [style guide](https://github.com/peterbe/minimalcss/blob/master/CONTRIBUTING.md#style-guide). https://github.com/peterbe/minimalcss/pull/249 --- README.md | 7 +++++-- src/run.js | 8 ++++++-- tests/main.test.js | 7 +++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6a650e61..4aee757e 100644 --- a/README.md +++ b/README.md @@ -159,7 +159,7 @@ key is `urls`. Other optional options are: * `debug` - all console logging during page rendering are included in the stdout. Also, any malformed selector that cause errors in `document.querySelector` will be raised as new errors. -* `skippable` - function wich takes +* `skippable` - function which takes [request](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#class-request) as an argument and returns boolean. If it returns true then given request will be aborted (skipped). Can be used to block requests to Google Analytics @@ -176,7 +176,10 @@ key is `urls`. Other optional options are: of strings for headless Chrome](https://peter.sh/experiments/chromium-command-line-switches/). * `cssoOptions` - CSSO compress function [options](https://github.com/css/csso#compressast-options) * `timeout` - Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. -* `ignoreCSSErrors` - By default, any CSS parsing error throws an error in minimalcss. If you know it's safe to ignore (for example, third-party CSS resources), set this to true. +* `ignoreCSSErrors` - By default, any CSS parsing error throws an error in `minimalcss`. If you know it's safe to ignore (for example, third-party CSS resources), set this to true. +* `ignoreJSErrors` - By default, any JavaScript error encountered by puppeteer +will be thrown by `minimalcss`. If you know it's safe to ignore errors (for example, on +third-party webpages), set this to true. ## Warnings diff --git a/src/run.js b/src/run.js index 0c8ac3a0..bb172c15 100644 --- a/src/run.js +++ b/src/run.js @@ -254,7 +254,11 @@ const processPage = ({ }); page.on('pageerror', error => { - safeReject(error); + if (options.ignoreJSErrors) { + console.warn(error); + } else { + safeReject(error); + } }); let response; @@ -339,7 +343,7 @@ const processPage = ({ /** * - * @param {{ urls: Array, debug: boolean, loadimages: boolean, skippable: function, browser: any, userAgent: string, withoutjavascript: boolean, viewport: any, puppeteerArgs: Array, cssoOptions: Object, ignoreCSSErrors?: boolean }} options + * @param {{ urls: Array, debug: boolean, loadimages: boolean, skippable: function, browser: any, userAgent: string, withoutjavascript: boolean, viewport: any, puppeteerArgs: Array, cssoOptions: Object, ignoreCSSErrors?: boolean, ignoreJSErrors?: boolean }} options * @return Promise<{ finalCss: string, stylesheetContents: { [key: string]: string } }> */ const minimalcss = async options => { diff --git a/tests/main.test.js b/tests/main.test.js index ad0c2446..081cd0ef 100644 --- a/tests/main.test.js +++ b/tests/main.test.js @@ -166,6 +166,13 @@ test('ignoreCSSErrors', async () => { expect(finalCss).toEqual(''); }); +test('ignoreJSErrors', async () => { + const { finalCss } = await runMinimalcss('jserror', { + ignoreJSErrors: true + }); + expect(finalCss).toEqual(''); +}); + test('handles 307 CSS file', async () => { const { finalCss } = await runMinimalcss('307css'); expect(finalCss).toEqual('p{color:violet}'); From f05bc40d43ba2450c1b27ff47877a3c76dd01f43 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 16 Aug 2018 16:10:31 -0400 Subject: [PATCH 020/164] changelog for 0.7.9 --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a639987d..397cc437 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +# 0.7.9 + +* New option `ignoreJSErrors` to ignore possible JavaScript errors. + [pull#253](https://github.com/peterbe/minimalcss/pull/253) + Thanks @jc275 + # 0.7.8 * New option `ignoreCSSErrors` to ignore possible CSS parsing errors. From acce0296565649c484c31dfda5f1e044878ea2f5 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 16 Aug 2018 16:10:45 -0400 Subject: [PATCH 021/164] 0.7.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9c12d52b..692274e0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minimalcss", - "version": "0.7.8", + "version": "0.7.9", "description": "Extract the minimal CSS used in a set of URLs with puppeteer", "main": "./index.js", "author": "Peter Bengtsson", From 77d4a77fd81f00abd0c609e70e0c181a2acd1ab5 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Thu, 16 Aug 2018 21:03:31 +0000 Subject: [PATCH 022/164] Update dependency fastify-static to v0.14.0 --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 692274e0..2dde2be1 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ }, "devDependencies": { "fastify": "1.9.0", - "fastify-static": "0.13.0", + "fastify-static": "0.14.0", "jest": "23.5.0", "prettier": "1.14.2" }, diff --git a/yarn.lock b/yarn.lock index 71bf15e7..9e4df1bf 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1144,9 +1144,9 @@ fastify-plugin@^1.2.0: dependencies: semver "^5.5.0" -fastify-static@0.13.0: - version "0.13.0" - resolved "https://registry.yarnpkg.com/fastify-static/-/fastify-static-0.13.0.tgz#32edb9f42162bd23cc1ddf8ed1f9ea39675187bc" +fastify-static@0.14.0: + version "0.14.0" + resolved "https://registry.yarnpkg.com/fastify-static/-/fastify-static-0.14.0.tgz#e8f914cce72a8d6e40abfeb896c07458d4eaa3fe" dependencies: fastify-plugin "^1.2.0" readable-stream "^3.0.0" From 9f9c5bb0b7ffff1ce4e872f3b3e202695917b213 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 16 Aug 2018 20:26:35 -0400 Subject: [PATCH 023/164] tests for utility functions (#257) I didn't like that we had extracted out some utility functions but never had *any* tests for them. The most important tests are the tests that use the public API but if the code was sufficiently complex that utility functions had to be broken out, we should have at least some tests for them. --- tests/utils.test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests/utils.test.js diff --git a/tests/utils.test.js b/tests/utils.test.js new file mode 100644 index 00000000..b07e6080 --- /dev/null +++ b/tests/utils.test.js @@ -0,0 +1,21 @@ +const utils = require('../src/utils'); + +test('Test unquoteString', async () => { + const f = utils.unquoteString; + expect(f('"peter"')).toEqual('peter'); + expect(f(`'peter'`)).toEqual('peter'); + // but leave it if it isn't balanced + expect(f('"peter')).toEqual('"peter'); + // empty strings + expect(f('')).toEqual(''); +}); + +test('Test reduceCSSSelector', async () => { + const f = utils.reduceCSSSelector; + // Most basic case. + expect(f('a:hover')).toEqual('a'); + // More advanced case. + expect(f('a[href^="javascript:"]:after')).toEqual('a[href^="javascript:"]'); + // Should work with ' instead of " too. + expect(f("a[href^='javascript:']:after")).toEqual("a[href^='javascript:']"); +}); From 86f1f9695847f8e9af60ca948880693a9ecc1383 Mon Sep 17 00:00:00 2001 From: jc275 Date: Fri, 17 Aug 2018 14:40:22 +0100 Subject: [PATCH 024/164] Disregard #fragment identifier in stylesheet link.href, fixes #255 (#256) As described in https://github.com/peterbe/minimalcss/issues/255 --- src/run.js | 5 ++++- tests/examples/url-fragment.css | 3 +++ tests/examples/url-fragment.html | 10 ++++++++++ tests/main.test.js | 5 +++++ 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/examples/url-fragment.css create mode 100644 tests/examples/url-fragment.html diff --git a/src/run.js b/src/run.js index bb172c15..e220b45e 100644 --- a/src/run.js +++ b/src/run.js @@ -310,7 +310,10 @@ const processPage = ({ link.media !== 'print' && !link.href.toLowerCase().startsWith('data:') ) { - hrefs.push(link.href); + // Fragments are omitted from puppeteer's response.url(), + // so we need to strip them here, otherwise the hrefs + // won't always match when we check for missing ASTs. + hrefs.push(link.href.split('#')[0]); } }); return { diff --git a/tests/examples/url-fragment.css b/tests/examples/url-fragment.css new file mode 100644 index 00000000..3d9a2b2a --- /dev/null +++ b/tests/examples/url-fragment.css @@ -0,0 +1,3 @@ +p { + color: red; +} diff --git a/tests/examples/url-fragment.html b/tests/examples/url-fragment.html new file mode 100644 index 00000000..fdeb5c63 --- /dev/null +++ b/tests/examples/url-fragment.html @@ -0,0 +1,10 @@ + + + + + + + +

defragmenting...

+ + diff --git a/tests/main.test.js b/tests/main.test.js index 081cd0ef..4080b801 100644 --- a/tests/main.test.js +++ b/tests/main.test.js @@ -274,3 +274,8 @@ test('timeout error for resources', async () => { ); } }); + +test('handles #fragments in stylesheet hrefs', async () => { + const { finalCss } = await runMinimalcss('url-fragment'); + expect(finalCss).toMatch('p{color:red}'); +}); From f919876744e74948074878445b2c9ea092c7910e Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 17 Aug 2018 09:42:25 -0400 Subject: [PATCH 025/164] update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 397cc437..ed1e4c64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +* Stylesheet `link` tags whose `href` URL contains a `#fragment-example` + would cause an error because puppeteer doesn't include it in the + `response.url()`. + [pull#255](https://github.com/peterbe/minimalcss/pull/255) + Thanks @jc275 + + # 0.7.9 * New option `ignoreJSErrors` to ignore possible JavaScript errors. From 5efd93d49a47deef264179945687e82846bbe24b Mon Sep 17 00:00:00 2001 From: jc275 Date: Fri, 17 Aug 2018 18:21:22 +0100 Subject: [PATCH 026/164] Handle multiple semicolons to prevent csso crash, fixes #243 (#259) As discussed in https://github.com/peterbe/minimalcss/pull/244. All commits from that branch are merged and squashed into this one, along with a test in `utils.test.js`. --- src/run.js | 5 +++++ src/utils.js | 15 ++++++++++++++- tests/examples/extra-semicolons.css | 4 ++++ tests/examples/extra-semicolons.html | 10 ++++++++++ tests/main.test.js | 9 +++++++++ tests/utils.test.js | 12 ++++++++++++ 6 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 tests/examples/extra-semicolons.css create mode 100644 tests/examples/extra-semicolons.html diff --git a/src/run.js b/src/run.js index e220b45e..bd4526ba 100644 --- a/src/run.js +++ b/src/run.js @@ -218,6 +218,11 @@ const processPage = ({ redirectResponses[responseUrl] = redirectsTo; } else if (resourceType === 'stylesheet') { response.text().then(text => { + // Semicolon sequences can crash CSSO, + // so we remove the from the CSS text. + // https://github.com/peterbe/minimalcss/issues/243 + // https://github.com/css/csso/issues/378 + text = utils.removeSequentialSemis(text); const ast = csstree.parse(text); csstree.walk(ast, node => { if (node.type === 'Url') { diff --git a/src/utils.js b/src/utils.js index 408a74c1..35baa855 100644 --- a/src/utils.js +++ b/src/utils.js @@ -30,4 +30,17 @@ const unquoteString = string => { return string; }; -module.exports = { reduceCSSSelector, unquoteString }; +/** + * Removes all sequences of two-or-more semicolons separated by zero-or-more + * whitespace, replacing each sequence with a single semicolon. + * @param {string} css + * @return {string} + */ +const removeSequentialSemis = css => { + while (/;\s*;/.test(css)) { + css = css.replace(/;\s*;/g, ';'); + } + return css; +}; + +module.exports = { reduceCSSSelector, removeSequentialSemis, unquoteString }; diff --git a/tests/examples/extra-semicolons.css b/tests/examples/extra-semicolons.css new file mode 100644 index 00000000..79a6a57a --- /dev/null +++ b/tests/examples/extra-semicolons.css @@ -0,0 +1,4 @@ +a { + color: red;;; + ; +} diff --git a/tests/examples/extra-semicolons.html b/tests/examples/extra-semicolons.html new file mode 100644 index 00000000..86892538 --- /dev/null +++ b/tests/examples/extra-semicolons.html @@ -0,0 +1,10 @@ + + + + + + + + a + + diff --git a/tests/main.test.js b/tests/main.test.js index 4080b801..0e602718 100644 --- a/tests/main.test.js +++ b/tests/main.test.js @@ -253,6 +253,15 @@ test('accept CSSO options', async () => { expect(finalCss).not.toMatch('test css comment'); }); +test('handles extra semicolons', async () => { + // Extra semicolons can cause csso.minify() to throw: + // [TypeError: Cannot read property '0' of undefined] + // https://github.com/peterbe/minimalcss/issues/243 + // https://github.com/css/csso/issues/378 + const { finalCss } = await runMinimalcss('extra-semicolons'); + expect(finalCss).toMatch('a{color:red}'); +}); + test('timeout error for page', async () => { expect.assertions(2); try { diff --git a/tests/utils.test.js b/tests/utils.test.js index b07e6080..07c2044a 100644 --- a/tests/utils.test.js +++ b/tests/utils.test.js @@ -19,3 +19,15 @@ test('Test reduceCSSSelector', async () => { // Should work with ' instead of " too. expect(f("a[href^='javascript:']:after")).toEqual("a[href^='javascript:']"); }); + +test('Test removeSequentialSemis', () => { + const f = utils.removeSequentialSemis; + // empty string + expect(f('')).toEqual(''); + // more than two semicolons + expect(f(';;;')).toEqual(';'); + // whitespace between semicolons + expect(f(';\r\n\t;')).toEqual(';'); + // multiple semicolon sequences + expect(f('a;b;;c;;;d;;;;')).toEqual('a;b;c;d;'); +}); From 3362d7ba0ef2ec69392abdaf83fa8c187db4cb1d Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 17 Aug 2018 13:42:05 -0400 Subject: [PATCH 027/164] update change --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ed1e4c64..da578fd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,14 @@ +* Not crash if the CSS contains multiple semicolons which crashes + csso (https://github.com/css/csso/issues/378) + [pull#259](https://github.com/peterbe/minimalcss/pull/259) + Thanks @jc275 + * Stylesheet `link` tags whose `href` URL contains a `#fragment-example` would cause an error because puppeteer doesn't include it in the `response.url()`. [pull#255](https://github.com/peterbe/minimalcss/pull/255) Thanks @jc275 - # 0.7.9 * New option `ignoreJSErrors` to ignore possible JavaScript errors. From 42b9f42bcb6a85189cbba6346f4908df4779a5f7 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 17 Aug 2018 13:42:28 -0400 Subject: [PATCH 028/164] update change with new version --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index da578fd5..d8df18c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +# 0.7.10 + * Not crash if the CSS contains multiple semicolons which crashes csso (https://github.com/css/csso/issues/378) [pull#259](https://github.com/peterbe/minimalcss/pull/259) From 0888cd308ea8db248103b854c11d4b4b16e0d783 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 17 Aug 2018 13:42:37 -0400 Subject: [PATCH 029/164] 0.7.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 692274e0..805d490d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minimalcss", - "version": "0.7.9", + "version": "0.7.10", "description": "Extract the minimal CSS used in a set of URLs with puppeteer", "main": "./index.js", "author": "Peter Bengtsson", From b26bf630a12250ab0c98aeb5a86265e2f06c3a3c Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 22 Aug 2018 06:54:06 +0000 Subject: [PATCH 030/164] Update dependency fastify to v1.10.0 --- package.json | 2 +- yarn.lock | 51 +++++++++++++++++++++++++-------------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/package.json b/package.json index b1c21447..8499b62e 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "puppeteer": "^1.4.0" }, "devDependencies": { - "fastify": "1.9.0", + "fastify": "1.10.0", "fastify-static": "0.14.0", "jest": "23.5.0", "prettier": "1.14.2" diff --git a/yarn.lock b/yarn.lock index 9e4df1bf..ce5f92f5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1152,9 +1152,9 @@ fastify-static@0.14.0: readable-stream "^3.0.0" send "^0.16.0" -fastify@1.9.0: - version "1.9.0" - resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.9.0.tgz#8ce7c4e4eb06077f45aa56c514c1498a42a71039" +fastify@1.10.0: + version "1.10.0" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.10.0.tgz#26f662346d73d36f89ce93a886853a6b79b34eb4" dependencies: "@types/pino" "^4.16.0" abstract-logging "^1.0.0" @@ -1164,9 +1164,10 @@ fastify@1.9.0: fast-json-stringify "^1.5.4" find-my-way "^1.15.0" flatstr "^1.0.8" - light-my-request "^2.0.3" + light-my-request "^3.0.0" middie "^3.1.0" pino "^4.17.3" + proxy-addr "^2.0.3" tiny-lru "^1.6.1" fastq@^1.6.0: @@ -1284,6 +1285,10 @@ form-data@~2.3.1: combined-stream "1.0.6" mime-types "^2.1.12" +forwarded@~0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/forwarded/-/forwarded-0.1.2.tgz#98c23dab1175657b8c0573e8ceccd91b0ff18c84" + fragment-cache@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19" @@ -1602,6 +1607,10 @@ invert-kv@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/invert-kv/-/invert-kv-1.0.0.tgz#104a8e4aaca6d3d8cd157a8ef8bfab2d7a3ffdb6" +ipaddr.js@1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/ipaddr.js/-/ipaddr.js-1.8.0.tgz#eaa33d6ddd7ace8f7f6fe0c9ca0440e706738b1e" + is-accessor-descriptor@^0.1.6: version "0.1.6" resolved "https://registry.yarnpkg.com/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz#a9e12cb3ae8d876727eeef3843f8a0897b5c98d6" @@ -2292,13 +2301,12 @@ levn@~0.3.0: prelude-ls "~1.1.2" type-check "~0.3.2" -light-my-request@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/light-my-request/-/light-my-request-2.0.3.tgz#c1889b3226ea2182d7f11113e0a0de9ee4ba1b29" +light-my-request@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/light-my-request/-/light-my-request-3.0.0.tgz#04d56619baa46724487120fbe3c5e94331c549cf" dependencies: ajv "^6.0.0" - readable-stream "^2.3.6" - safe-buffer "^5.1.2" + readable-stream "^3.0.0" load-json-file@^1.0.0: version "1.1.0" @@ -2870,6 +2878,13 @@ prompts@^0.1.9: clorox "^1.0.1" sisteransi "^0.1.0" +proxy-addr@^2.0.3: + version "2.0.4" + resolved "https://registry.yarnpkg.com/proxy-addr/-/proxy-addr-2.0.4.tgz#ecfc733bf22ff8c6f407fa275327b9ab67e48b93" + dependencies: + forwarded "~0.1.2" + ipaddr.js "1.8.0" + proxy-from-env@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" @@ -2968,18 +2983,6 @@ readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable string_decoder "~1.0.3" util-deprecate "~1.0.1" -readable-stream@^2.3.6: - version "2.3.6" - resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" - dependencies: - core-util-is "~1.0.0" - inherits "~2.0.3" - isarray "~1.0.0" - process-nextick-args "~2.0.0" - safe-buffer "~5.1.1" - string_decoder "~1.1.1" - util-deprecate "~1.0.1" - readable-stream@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.0.1.tgz#a209a46ad933f9c8146591ac2c56ca0e39c141cf" @@ -3147,10 +3150,6 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.1.tgz#893312af69b2123def71f57889001671eeb2c853" -safe-buffer@^5.1.2: - version "5.1.2" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" - safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" @@ -3426,7 +3425,7 @@ string-width@^2.0.0, string-width@^2.1.1: is-fullwidth-code-point "^2.0.0" strip-ansi "^4.0.0" -string_decoder@^1.1.1, string_decoder@~1.1.1: +string_decoder@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.1.1.tgz#9cf1611ba62685d7030ae9e4ba34149c3af03fc8" dependencies: From 1b910b0682d75612a5567f8fa9ba813e07b4cfc8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Mon, 27 Aug 2018 13:40:02 -0400 Subject: [PATCH 031/164] Update dependency fastify to v1.11.0 (#262) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit

This Pull Request updates devDependency fastify (homepage, source) from v1.10.0 to v1.11.0


Release Notes

v1.11.0

Compare Source

Features

Internals

  • Override address in listen instead of listenPromise - #​1102
  • Rename and call unknown method tests from http2 - #​1095
  • Ensure that error-in-post test is run - #​1096
  • Add test for trust proxy with function - #​1098

Documentation

  • Move Server-Methods into Factory - #​1101
  • Update Validation-and-Serialization.md - #​1094


This PR has been generated by Renovate Bot.

--- package.json | 2 +- yarn.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 8499b62e..477415e7 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "puppeteer": "^1.4.0" }, "devDependencies": { - "fastify": "1.10.0", + "fastify": "1.11.0", "fastify-static": "0.14.0", "jest": "23.5.0", "prettier": "1.14.2" diff --git a/yarn.lock b/yarn.lock index ce5f92f5..b90e1a84 100644 --- a/yarn.lock +++ b/yarn.lock @@ -232,9 +232,9 @@ atob@^2.0.0: version "2.0.3" resolved "https://registry.yarnpkg.com/atob/-/atob-2.0.3.tgz#19c7a760473774468f20b2d2d03372ad7d4cbf5d" -avvio@^5.6.0: - version "5.6.0" - resolved "https://registry.yarnpkg.com/avvio/-/avvio-5.6.0.tgz#b9a5a38b7c5e816e4875e0efb3edfb1a4f1fcc1b" +avvio@^5.8.0: + version "5.8.0" + resolved "https://registry.yarnpkg.com/avvio/-/avvio-5.8.0.tgz#f3d2031ac8543448747b77a88a0b18ced015591e" dependencies: debug "^3.1.0" fastq "^1.6.0" @@ -1152,14 +1152,14 @@ fastify-static@0.14.0: readable-stream "^3.0.0" send "^0.16.0" -fastify@1.10.0: - version "1.10.0" - resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.10.0.tgz#26f662346d73d36f89ce93a886853a6b79b34eb4" +fastify@1.11.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.11.0.tgz#0a2ed6dd5677aa5fee0b6b5540503eb107f93be3" dependencies: "@types/pino" "^4.16.0" abstract-logging "^1.0.0" ajv "^6.5.2" - avvio "^5.6.0" + avvio "^5.8.0" end-of-stream "^1.4.1" fast-json-stringify "^1.5.4" find-my-way "^1.15.0" From fda2f774209f9c6b68089ee4dfd8d155fa2a211e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Wed, 5 Sep 2018 20:24:47 -0400 Subject: [PATCH 032/164] Update dependency fastify to v1.11.1 (#263) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit

This Pull Request updates devDependency fastify (homepage, source) from v1.11.0 to v1.11.1


Release Notes

v1.11.1

Compare Source



This PR has been generated by Renovate Bot.

--- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 477415e7..99235a82 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "puppeteer": "^1.4.0" }, "devDependencies": { - "fastify": "1.11.0", + "fastify": "1.11.1", "fastify-static": "0.14.0", "jest": "23.5.0", "prettier": "1.14.2" diff --git a/yarn.lock b/yarn.lock index b90e1a84..8d1b608e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1152,9 +1152,9 @@ fastify-static@0.14.0: readable-stream "^3.0.0" send "^0.16.0" -fastify@1.11.0: - version "1.11.0" - resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.11.0.tgz#0a2ed6dd5677aa5fee0b6b5540503eb107f93be3" +fastify@1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.11.1.tgz#b8fb1817932adf13d57e4a5370b8df0bc0c979a0" dependencies: "@types/pino" "^4.16.0" abstract-logging "^1.0.0" From 40b78d60f678c3f205a58085d596c41dbe004610 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Thu, 6 Sep 2018 13:47:53 -0400 Subject: [PATCH 033/164] Update dependency fastify to v1.11.2 (#264) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit

This Pull Request updates devDependency fastify (homepage, source) from v1.11.1 to v1.11.2


Release Notes

v1.11.2

Compare Source

Internals

  • Handle promises in the error handler with the same logic of normal handlers - #​1134
  • Rename ContentTypeParser - #​1123
  • after should not cause inject() to be called - #​1132

Documentation

  • Add trivikr@ to the collaborators list - #​1139
  • Updated ecosystem doc - #​1137


This PR has been generated by Renovate Bot.

--- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 99235a82..edef67c1 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "puppeteer": "^1.4.0" }, "devDependencies": { - "fastify": "1.11.1", + "fastify": "1.11.2", "fastify-static": "0.14.0", "jest": "23.5.0", "prettier": "1.14.2" diff --git a/yarn.lock b/yarn.lock index 8d1b608e..64e52671 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1152,9 +1152,9 @@ fastify-static@0.14.0: readable-stream "^3.0.0" send "^0.16.0" -fastify@1.11.1: - version "1.11.1" - resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.11.1.tgz#b8fb1817932adf13d57e4a5370b8df0bc0c979a0" +fastify@1.11.2: + version "1.11.2" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.11.2.tgz#7495c8134e21e13dccd6bc6b5d036f187faa276e" dependencies: "@types/pino" "^4.16.0" abstract-logging "^1.0.0" From 4aab04461d3f8d17a78f3a26116c2a7eec884fe4 Mon Sep 17 00:00:00 2001 From: jc275 Date: Fri, 7 Sep 2018 19:46:31 +0100 Subject: [PATCH 034/164] parse style tags (#260) - [x] Adds `options.styletags` to parse any on-page `` tags (in addition to external stylesheets). - [x] Processes style tag content exactly the same way as external stylesheet text. - [x] Preserves relative ordering of external stylesheets and on-page style tags. - [x] Includes `` tags that were created/modified after page load. - [x] Does not consider any inline `style="..."` attributes. - [ ] Probably fixes https://github.com/peterbe/minimalcss/issues/114 --- README.md | 5 +- bin/minimalcss.js | 2 + src/run.js | 167 ++++++++++++++++++++++++++++++--------------- tests/main.test.js | 18 +++++ 4 files changed, 135 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 4aee757e..c89fc376 100644 --- a/README.md +++ b/README.md @@ -176,10 +176,11 @@ key is `urls`. Other optional options are: of strings for headless Chrome](https://peter.sh/experiments/chromium-command-line-switches/). * `cssoOptions` - CSSO compress function [options](https://github.com/css/csso#compressast-options) * `timeout` - Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. -* `ignoreCSSErrors` - By default, any CSS parsing error throws an error in `minimalcss`. If you know it's safe to ignore (for example, third-party CSS resources), set this to true. +* `ignoreCSSErrors` - By default, any CSS parsing error throws an error in `minimalcss`. If you know it's safe to ignore (for example, third-party CSS resources), set this to `true`. * `ignoreJSErrors` - By default, any JavaScript error encountered by puppeteer will be thrown by `minimalcss`. If you know it's safe to ignore errors (for example, on -third-party webpages), set this to true. +third-party webpages), set this to `true`. +* `styletags` - If set to `true`, on-page `` tags are parsed along with external stylesheets. By default, only external stylesheets are parsed. ## Warnings diff --git a/bin/minimalcss.js b/bin/minimalcss.js index 021f48c7..fcceaaae 100755 --- a/bin/minimalcss.js +++ b/bin/minimalcss.js @@ -17,6 +17,7 @@ const argv = minimist(args, { 'verbose', 'debug', 'loadimages', + 'styletags', 'withoutjavascript', 'nosandbox' ], @@ -51,6 +52,7 @@ if (argv['help']) { ' --verbose Include a comment about the options and the date it was generated.\n' + ' --debug or -d Print all console logging during page rendering to stdout.\n' + ' --loadimages By default, all images are NOT downloaded. This reverses that.\n' + + ' --styletags By default, all tags are ignored. This will include them.\n' + ' --withoutjavascript The CSS is evaluated against the DOM twice, first with no JavaScript, ' + 'then with. This disables the load without JavaScript.\n' + ' --skip String to match in URL to ignore download. Repeatable. E.g. --skip google-analyics.com\n' + diff --git a/src/run.js b/src/run.js index bd4526ba..8870a29d 100644 --- a/src/run.js +++ b/src/run.js @@ -107,6 +107,49 @@ const postProcessOptimize = ast => { }); }; +const processStylesheet = ({ + text, + pageUrl, + responseUrl, + stylesheetAsts, + stylesheetContents +}) => { + // Semicolon sequences can crash CSSO, + // so we remove them from the CSS text. + // https://github.com/peterbe/minimalcss/issues/243 + // https://github.com/css/csso/issues/378 + text = utils.removeSequentialSemis(text); + const ast = csstree.parse(text); + csstree.walk(ast, node => { + if (node.type !== 'Url') return; + const value = node.value; + let path = value.value; + if (value.type !== 'Raw') { + path = path.substr(1, path.length - 2); + } + const sameHost = url.parse(responseUrl).host === url.parse(pageUrl).host; + if (/^https?:\/\/|^\/\/|^data:/i.test(path)) { + // do nothing + } else if (/^\//.test(path) && sameHost) { + // do nothing + } else { + const resolved = new url.URL(path, responseUrl); + if (sameHost) { + path = resolved.pathname + resolved.search; + } else { + path = resolved.href; + } + if (value.type !== 'Raw') { + value.value = `"${path}"`; + } else { + value.value = path; + } + } + }); + stylesheetAsts[responseUrl] = ast; + stylesheetContents[responseUrl] = text; +}; + const processPage = ({ page, options, @@ -145,6 +188,7 @@ const processPage = ({ const debug = options.debug || false; const loadimages = options.loadimages || false; + const styletags = options.styletags || false; const withoutjavascript = options.withoutjavascript === undefined ? true @@ -218,42 +262,13 @@ const processPage = ({ redirectResponses[responseUrl] = redirectsTo; } else if (resourceType === 'stylesheet') { response.text().then(text => { - // Semicolon sequences can crash CSSO, - // so we remove the from the CSS text. - // https://github.com/peterbe/minimalcss/issues/243 - // https://github.com/css/csso/issues/378 - text = utils.removeSequentialSemis(text); - const ast = csstree.parse(text); - csstree.walk(ast, node => { - if (node.type === 'Url') { - let value = node.value; - let path = value.value; - if (value.type !== 'Raw') { - path = path.substr(1, path.length - 2); - } - const sameHost = - url.parse(responseUrl).host === url.parse(pageUrl).host; - if (/^https?:\/\/|^\/\/|^data:/i.test(path)) { - // do nothing - } else if (/^\//.test(path) && sameHost) { - // do nothing - } else { - const resolved = new url.URL(path, responseUrl); - if (sameHost) { - path = resolved.pathname + resolved.search; - } else { - path = resolved.href; - } - if (value.type !== 'Raw') { - value.value = `"${path}"`; - } else { - value.value = path; - } - } - } + processStylesheet({ + text, + pageUrl, + responseUrl, + stylesheetAsts, + stylesheetContents }); - stylesheetAsts[responseUrl] = ast; - stylesheetContents[responseUrl] = text; }); } }); @@ -301,34 +316,76 @@ const processPage = ({ ); } const evalWithJavascript = await page.evaluate(() => { + const html = document.documentElement.outerHTML; // The reason for NOT using a Set here is that that might not be // supported in ES5. const hrefs = []; - // Loop over all the 'link' elements in the document and - // for each, collect the URL of all the ones we're going to assess. - Array.from(document.querySelectorAll('link')).forEach(link => { - if ( - link.href && - (link.rel === 'stylesheet' || - link.href.toLowerCase().endsWith('.css')) && - !link.href.toLowerCase().startsWith('blob:') && - link.media !== 'print' && - !link.href.toLowerCase().startsWith('data:') - ) { - // Fragments are omitted from puppeteer's response.url(), - // so we need to strip them here, otherwise the hrefs - // won't always match when we check for missing ASTs. - hrefs.push(link.href.split('#')[0]); + const styles = []; + const isCssStyleTag = elem => + elem.tagName === 'STYLE' && + (!elem.type || elem.type.toLowerCase() === 'text/css'); + const isStylesheetLink = elem => + elem.tagName === 'LINK' && + elem.href && + (elem.rel.toLowerCase() === 'stylesheet' || + elem.href.toLowerCase().endsWith('.css')) && + !( + elem.href.toLowerCase().startsWith('data:') || + elem.href.toLowerCase().startsWith('blob:') || + elem.media.toLowerCase() === 'print' + ); + // #fragments are omitted from puppeteer's response.url(), so + // we need to strip them from stylesheet links, otherwise the + // hrefs won't always match when we check for missing ASTs. + const defragment = href => href.split('#')[0]; + const pageUrl = defragment(window.location.href); + // Create a unique identifier for each style tag by appending + // an xpath-like fragment to the page URL. This allows us to + // preserve the relative ordering of external stylesheets and + // inline style tags. + const styleTagUri = () => `${pageUrl}#style[${styles.length}]`; + // Loop over all 'link' and 'style' elements in the document, + // in order of appearance. For each element, collect the URI + // of all the ones we're going to assess. For style elements, + // also extract each tag's content. + Array.from(document.querySelectorAll('link, style')).forEach(elem => { + if (isStylesheetLink(elem)) { + const href = defragment(elem.href); + hrefs.push(href); + } else if (isCssStyleTag(elem)) { + const href = styleTagUri(); + const text = elem.innerHTML; + styles.push({ href, text }); + hrefs.push(href); } }); - return { - html: document.documentElement.outerHTML, - hrefs - }; + return { html, hrefs, styles }; }); const htmlWithJavascript = evalWithJavascript.html; doms.push(cheerio.load(htmlWithJavascript)); + + if (styletags) { + // Parse each style tag as if it were an external stylesheet. + evalWithJavascript.styles.forEach(({ href, text }) => { + processStylesheet({ + text, + pageUrl, + stylesheetAsts, + stylesheetContents, + responseUrl: href + }); + }); + } else { + // Remove each style tag URI from the list of hrefs. + evalWithJavascript.styles.forEach(({ href }) => { + evalWithJavascript.hrefs.splice( + evalWithJavascript.hrefs.indexOf(href), + 1 + ); + }); + } + evalWithJavascript.hrefs.forEach(href => { // The order of allHrefs is important! That's what browsers do. // But we can't blindly using allHrefs.push() because the href @@ -351,7 +408,7 @@ const processPage = ({ /** * - * @param {{ urls: Array, debug: boolean, loadimages: boolean, skippable: function, browser: any, userAgent: string, withoutjavascript: boolean, viewport: any, puppeteerArgs: Array, cssoOptions: Object, ignoreCSSErrors?: boolean, ignoreJSErrors?: boolean }} options + * @param {{ urls: Array, debug: boolean, loadimages: boolean, skippable: function, browser: any, userAgent: string, withoutjavascript: boolean, viewport: any, puppeteerArgs: Array, cssoOptions: Object, ignoreCSSErrors?: boolean, ignoreJSErrors?: boolean, styletags?: boolean }} options * @return Promise<{ finalCss: string, stylesheetContents: { [key: string]: string } }> */ const minimalcss = async options => { diff --git a/tests/main.test.js b/tests/main.test.js index 0e602718..067ac86e 100644 --- a/tests/main.test.js +++ b/tests/main.test.js @@ -69,10 +69,28 @@ test('handles JS errors', async () => { }); test('cares only about external CSS files', async () => { + // The css-in-js fixture has external stylesheets, tags, + // and inline 'style' attributes, both present on the page and + // injected using JavaScript. + // This test asserts that selectors from tags and + // inline 'style' attributes are NOT included in the final CSS. const { finalCss } = await runMinimalcss('css-in-js'); expect(finalCss).toEqual('.external{color:red}'); }); +test('cares about style tags and external CSS files', async () => { + // The css-in-js fixture has external stylesheets, tags, + // and inline 'style' attributes, both present on the page and + // injected using JavaScript. + // This test asserts that selectors from stylesheets and + // tags are both included in the final CSS, while rules from + // inline 'style' attributes are NOT included. + const { finalCss } = await runMinimalcss('css-in-js', { + styletags: true + }); + expect(finalCss).toEqual('.cssinjs1,.external,.inline{color:red}'); +}); + test('handles 404 CSS file', async () => { expect.assertions(1); try { From a5e8f41f40a33a611e06931cd83e18a01356154c Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Fri, 7 Sep 2018 15:21:37 -0400 Subject: [PATCH 035/164] update notes regarding new styletags option --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d8df18c2..f47f4206 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 0.7.x + +* Ability to also extract the CSS of all `style` tags with the `styletags` + option. + [pull#260](https://github.com/peterbe/minimalcss/pull/260) + Thanks @jc275 + # 0.7.10 * Not crash if the CSS contains multiple semicolons which crashes From cc77e17e11005ea8d431053829439f0878c98b9c Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Mon, 10 Sep 2018 09:21:24 -0400 Subject: [PATCH 036/164] actually use 'styletags' flag in cli (#267) @jc275 r? --- bin/minimalcss.js | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/minimalcss.js b/bin/minimalcss.js index fcceaaae..2d7e4e78 100755 --- a/bin/minimalcss.js +++ b/bin/minimalcss.js @@ -91,6 +91,7 @@ const options = { urls: urls, debug: argv['debug'], loadimages: argv['loadimages'], + styletags: argv['styletags'], withoutjavascript: argv['withoutjavascript'], skippable: request => { let skips = argv['skip']; From fbeb0a03fd330080879f5c458fbb7a49a89bc024 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Mon, 10 Sep 2018 10:07:57 -0400 Subject: [PATCH 037/164] Update dependency jest to v23.6.0 (#268) --- package.json | 2 +- yarn.lock | 190 +++++++++++++++++++++++++-------------------------- 2 files changed, 96 insertions(+), 96 deletions(-) diff --git a/package.json b/package.json index edef67c1..ad66323f 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "devDependencies": { "fastify": "1.11.2", "fastify-static": "0.14.0", - "jest": "23.5.0", + "jest": "23.6.0", "prettier": "1.14.2" }, "scripts": { diff --git a/yarn.lock b/yarn.lock index 64e52671..12add231 100644 --- a/yarn.lock +++ b/yarn.lock @@ -303,9 +303,9 @@ babel-helpers@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-jest@^23.4.2: - version "23.4.2" - resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.4.2.tgz#f276de67798a5d68f2d6e87ff518c2f6e1609877" +babel-jest@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-23.6.0.tgz#a644232366557a2240a0c083da6b25786185a2f1" dependencies: babel-plugin-istanbul "^4.1.6" babel-preset-jest "^23.2.0" @@ -1039,14 +1039,14 @@ expand-range@^1.8.1: dependencies: fill-range "^2.1.0" -expect@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/expect/-/expect-23.5.0.tgz#18999a0eef8f8acf99023fde766d9c323c2562ed" +expect@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/expect/-/expect-23.6.0.tgz#1e0c8d3ba9a581c87bd71fb9bc8862d443425f98" dependencies: ansi-styles "^3.2.0" - jest-diff "^23.5.0" + jest-diff "^23.6.0" jest-get-type "^22.1.0" - jest-matcher-utils "^23.5.0" + jest-matcher-utils "^23.6.0" jest-message-util "^23.4.0" jest-regex-util "^23.3.0" @@ -1883,9 +1883,9 @@ jest-changed-files@^23.4.2: dependencies: throat "^4.0.0" -jest-cli@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-23.5.0.tgz#d316b8e34a38a610a1efc4f0403d8ef8a55e4492" +jest-cli@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-23.6.0.tgz#61ab917744338f443ef2baa282ddffdd658a5da4" dependencies: ansi-escapes "^3.0.0" chalk "^2.0.1" @@ -1899,18 +1899,18 @@ jest-cli@^23.5.0: istanbul-lib-instrument "^1.10.1" istanbul-lib-source-maps "^1.2.4" jest-changed-files "^23.4.2" - jest-config "^23.5.0" + jest-config "^23.6.0" jest-environment-jsdom "^23.4.0" jest-get-type "^22.1.0" - jest-haste-map "^23.5.0" + jest-haste-map "^23.6.0" jest-message-util "^23.4.0" jest-regex-util "^23.3.0" - jest-resolve-dependencies "^23.5.0" - jest-runner "^23.5.0" - jest-runtime "^23.5.0" - jest-snapshot "^23.5.0" + jest-resolve-dependencies "^23.6.0" + jest-runner "^23.6.0" + jest-runtime "^23.6.0" + jest-snapshot "^23.6.0" jest-util "^23.4.0" - jest-validate "^23.5.0" + jest-validate "^23.6.0" jest-watcher "^23.4.0" jest-worker "^23.2.0" micromatch "^2.3.11" @@ -1924,33 +1924,33 @@ jest-cli@^23.5.0: which "^1.2.12" yargs "^11.0.0" -jest-config@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.5.0.tgz#3770fba03f7507ee15f3b8867c742e48f31a9773" +jest-config@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-23.6.0.tgz#f82546a90ade2d8c7026fbf6ac5207fc22f8eb1d" dependencies: babel-core "^6.0.0" - babel-jest "^23.4.2" + babel-jest "^23.6.0" chalk "^2.0.1" glob "^7.1.1" jest-environment-jsdom "^23.4.0" jest-environment-node "^23.4.0" jest-get-type "^22.1.0" - jest-jasmine2 "^23.5.0" + jest-jasmine2 "^23.6.0" jest-regex-util "^23.3.0" - jest-resolve "^23.5.0" + jest-resolve "^23.6.0" jest-util "^23.4.0" - jest-validate "^23.5.0" + jest-validate "^23.6.0" micromatch "^2.3.11" - pretty-format "^23.5.0" + pretty-format "^23.6.0" -jest-diff@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-23.5.0.tgz#250651a433dd0050290a07642946cc9baaf06fba" +jest-diff@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-23.6.0.tgz#1500f3f16e850bb3d71233408089be099f610c7d" dependencies: chalk "^2.0.1" diff "^3.2.0" jest-get-type "^22.1.0" - pretty-format "^23.5.0" + pretty-format "^23.6.0" jest-docblock@^23.2.0: version "23.2.0" @@ -1958,12 +1958,12 @@ jest-docblock@^23.2.0: dependencies: detect-newline "^2.1.0" -jest-each@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.5.0.tgz#77f7e2afe6132a80954b920006e78239862b10ba" +jest-each@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-23.6.0.tgz#ba0c3a82a8054387016139c733a05242d3d71575" dependencies: chalk "^2.0.1" - pretty-format "^23.5.0" + pretty-format "^23.6.0" jest-environment-jsdom@^23.4.0: version "23.4.0" @@ -1984,9 +1984,9 @@ jest-get-type@^22.1.0: version "22.4.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-22.4.3.tgz#e3a8504d8479342dd4420236b322869f18900ce4" -jest-haste-map@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.5.0.tgz#d4ca618188bd38caa6cb20349ce6610e194a8065" +jest-haste-map@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-23.6.0.tgz#2e3eb997814ca696d62afdb3f2529f5bbc935e16" dependencies: fb-watchman "^2.0.0" graceful-fs "^4.1.11" @@ -1997,36 +1997,36 @@ jest-haste-map@^23.5.0: micromatch "^2.3.11" sane "^2.0.0" -jest-jasmine2@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.5.0.tgz#05fe7f1788e650eeb5a03929e6461ea2e9f3db53" +jest-jasmine2@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-23.6.0.tgz#840e937f848a6c8638df24360ab869cc718592e0" dependencies: babel-traverse "^6.0.0" chalk "^2.0.1" co "^4.6.0" - expect "^23.5.0" + expect "^23.6.0" is-generator-fn "^1.0.0" - jest-diff "^23.5.0" - jest-each "^23.5.0" - jest-matcher-utils "^23.5.0" + jest-diff "^23.6.0" + jest-each "^23.6.0" + jest-matcher-utils "^23.6.0" jest-message-util "^23.4.0" - jest-snapshot "^23.5.0" + jest-snapshot "^23.6.0" jest-util "^23.4.0" - pretty-format "^23.5.0" + pretty-format "^23.6.0" -jest-leak-detector@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-23.5.0.tgz#14ac2a785bd625160a2ea968fd5d98b7dcea3e64" +jest-leak-detector@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-23.6.0.tgz#e4230fd42cf381a1a1971237ad56897de7e171de" dependencies: - pretty-format "^23.5.0" + pretty-format "^23.6.0" -jest-matcher-utils@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-23.5.0.tgz#0e2ea67744cab78c9ab15011c4d888bdd3e49e2a" +jest-matcher-utils@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-23.6.0.tgz#726bcea0c5294261a7417afb6da3186b4b8cac80" dependencies: chalk "^2.0.1" jest-get-type "^22.1.0" - pretty-format "^23.5.0" + pretty-format "^23.6.0" jest-message-util@^23.4.0: version "23.4.0" @@ -2046,42 +2046,42 @@ jest-regex-util@^23.3.0: version "23.3.0" resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-23.3.0.tgz#5f86729547c2785c4002ceaa8f849fe8ca471bc5" -jest-resolve-dependencies@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.5.0.tgz#10c4d135beb9d2256de1fedc7094916c3ad74af7" +jest-resolve-dependencies@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-23.6.0.tgz#b4526af24c8540d9a3fab102c15081cf509b723d" dependencies: jest-regex-util "^23.3.0" - jest-snapshot "^23.5.0" + jest-snapshot "^23.6.0" -jest-resolve@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.5.0.tgz#3b8e7f67e84598f0caf63d1530bd8534a189d0e6" +jest-resolve@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-23.6.0.tgz#cf1d1a24ce7ee7b23d661c33ba2150f3aebfa0ae" dependencies: browser-resolve "^1.11.3" chalk "^2.0.1" realpath-native "^1.0.0" -jest-runner@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.5.0.tgz#570f7a044da91648b5bb9b6baacdd511076c71d7" +jest-runner@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-23.6.0.tgz#3894bd219ffc3f3cb94dc48a4170a2e6f23a5a38" dependencies: exit "^0.1.2" graceful-fs "^4.1.11" - jest-config "^23.5.0" + jest-config "^23.6.0" jest-docblock "^23.2.0" - jest-haste-map "^23.5.0" - jest-jasmine2 "^23.5.0" - jest-leak-detector "^23.5.0" + jest-haste-map "^23.6.0" + jest-jasmine2 "^23.6.0" + jest-leak-detector "^23.6.0" jest-message-util "^23.4.0" - jest-runtime "^23.5.0" + jest-runtime "^23.6.0" jest-util "^23.4.0" jest-worker "^23.2.0" source-map-support "^0.5.6" throat "^4.0.0" -jest-runtime@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-23.5.0.tgz#eb503525a196dc32f2f9974e3482d26bdf7b63ce" +jest-runtime@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-23.6.0.tgz#059e58c8ab445917cd0e0d84ac2ba68de8f23082" dependencies: babel-core "^6.0.0" babel-plugin-istanbul "^4.1.6" @@ -2090,14 +2090,14 @@ jest-runtime@^23.5.0: exit "^0.1.2" fast-json-stable-stringify "^2.0.0" graceful-fs "^4.1.11" - jest-config "^23.5.0" - jest-haste-map "^23.5.0" + jest-config "^23.6.0" + jest-haste-map "^23.6.0" jest-message-util "^23.4.0" jest-regex-util "^23.3.0" - jest-resolve "^23.5.0" - jest-snapshot "^23.5.0" + jest-resolve "^23.6.0" + jest-snapshot "^23.6.0" jest-util "^23.4.0" - jest-validate "^23.5.0" + jest-validate "^23.6.0" micromatch "^2.3.11" realpath-native "^1.0.0" slash "^1.0.0" @@ -2109,19 +2109,19 @@ jest-serializer@^23.0.1: version "23.0.1" resolved "https://registry.yarnpkg.com/jest-serializer/-/jest-serializer-23.0.1.tgz#a3776aeb311e90fe83fab9e533e85102bd164165" -jest-snapshot@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.5.0.tgz#cc368ebd8513e1175e2a7277f37a801b7358ae79" +jest-snapshot@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-23.6.0.tgz#f9c2625d1b18acda01ec2d2b826c0ce58a5aa17a" dependencies: babel-types "^6.0.0" chalk "^2.0.1" - jest-diff "^23.5.0" - jest-matcher-utils "^23.5.0" + jest-diff "^23.6.0" + jest-matcher-utils "^23.6.0" jest-message-util "^23.4.0" - jest-resolve "^23.5.0" + jest-resolve "^23.6.0" mkdirp "^0.5.1" natural-compare "^1.4.0" - pretty-format "^23.5.0" + pretty-format "^23.6.0" semver "^5.5.0" jest-util@^23.4.0: @@ -2137,14 +2137,14 @@ jest-util@^23.4.0: slash "^1.0.0" source-map "^0.6.0" -jest-validate@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.5.0.tgz#f5df8f761cf43155e1b2e21d6e9de8a2852d0231" +jest-validate@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-23.6.0.tgz#36761f99d1ed33fcd425b4e4c5595d62b6597474" dependencies: chalk "^2.0.1" jest-get-type "^22.1.0" leven "^2.1.0" - pretty-format "^23.5.0" + pretty-format "^23.6.0" jest-watcher@^23.4.0: version "23.4.0" @@ -2160,12 +2160,12 @@ jest-worker@^23.2.0: dependencies: merge-stream "^1.0.1" -jest@23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/jest/-/jest-23.5.0.tgz#80de353d156ea5ea4a7332f7962ac79135fbc62e" +jest@23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-23.6.0.tgz#ad5835e923ebf6e19e7a1d7529a432edfee7813d" dependencies: import-local "^1.0.0" - jest-cli "^23.5.0" + jest-cli "^23.6.0" js-tokens@^3.0.0, js-tokens@^3.0.2: version "3.0.2" @@ -2852,9 +2852,9 @@ prettier@1.14.2: version "1.14.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" -pretty-format@^23.5.0: - version "23.5.0" - resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.5.0.tgz#0f9601ad9da70fe690a269cd3efca732c210687c" +pretty-format@^23.6.0: + version "23.6.0" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-23.6.0.tgz#5eaac8eeb6b33b987b7fe6097ea6a8a146ab5760" dependencies: ansi-regex "^3.0.0" ansi-styles "^3.2.0" From dc074776b5143d7f4f010ebd23efad83e48fe42c Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 13 Sep 2018 09:50:33 -0400 Subject: [PATCH 038/164] Disable Service Workers (#265) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #223 @stereobooster Do you know of a good way to test this? Perhaps it's not possible. Perhaps it's not particularly important. Also, [here's how it used to fail](https://github.com/peterbe/minimalcss/issues/223#issuecomment-419529682) Now, when you run the same you get: ```bash ▶ node bin/minimalcss.js https://googlechrome.github.io/samples/service-worker/basic/ body{background-color:#fff;box-sizing:border-box;font-family:"Roboto","Helvetica","Arial",sans-serif}@media screen and (min-width:832px){body{width:800px;margin:0 auto}}h1{margin-bottom:-.3em}h3{margin-bottom:-.2em;margin-top:2em}.availability{margin-bottom:2em}.highlight{border-radius:.75em;border:1px solid #f0f0f0;display:block;margin:.5em;overflow-x:auto;padding:.5em}code{font-family:Inconsolata,Consolas,monospace}.k,.o{font-weight:700}.c1,.cm{color:#998;font-style:italic}.kd{font-weight:700}.nb{color:#0086b3}.mi{color:#099}.s1{color:#d14}#container{display:flex;flex-direction:row;flex-wrap:wrap;justify-content:space-around}li{margin-bottom:1em} ``` And if you're nuts and you like errors you can get them back: ```bash ▶ node bin/minimalcss.js --enableserviceworkers https://googlechrome.github.io/samples/service-worker/basic/ [Error: DOMException: Failed to register a ServiceWorker: No URL is associated with the caller's document.] ``` --- README.md | 3 ++- bin/minimalcss.js | 7 ++++-- package.json | 2 +- src/run.js | 9 ++++++- yarn.lock | 61 +++++++++++++++++++---------------------------- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index c89fc376..5ce06f97 100644 --- a/README.md +++ b/README.md @@ -177,10 +177,11 @@ key is `urls`. Other optional options are: * `cssoOptions` - CSSO compress function [options](https://github.com/css/csso#compressast-options) * `timeout` - Maximum navigation time in milliseconds, defaults to 30 seconds, pass 0 to disable timeout. * `ignoreCSSErrors` - By default, any CSS parsing error throws an error in `minimalcss`. If you know it's safe to ignore (for example, third-party CSS resources), set this to `true`. -* `ignoreJSErrors` - By default, any JavaScript error encountered by puppeteer +* `ignoreJSErrors` - By default, any JavaScript error encountered by puppeteer will be thrown by `minimalcss`. If you know it's safe to ignore errors (for example, on third-party webpages), set this to `true`. * `styletags` - If set to `true`, on-page `` tags are parsed along with external stylesheets. By default, only external stylesheets are parsed. +* `enableServiceWorkers` - By default all Service Workers are disabled. This option enables them as is. ## Warnings diff --git a/bin/minimalcss.js b/bin/minimalcss.js index 2d7e4e78..260389aa 100755 --- a/bin/minimalcss.js +++ b/bin/minimalcss.js @@ -19,7 +19,8 @@ const argv = minimist(args, { 'loadimages', 'styletags', 'withoutjavascript', - 'nosandbox' + 'nosandbox', + 'enableserviceworkers' ], string: ['output', 'skip', 'viewport'], default: { @@ -53,6 +54,7 @@ if (argv['help']) { ' --debug or -d Print all console logging during page rendering to stdout.\n' + ' --loadimages By default, all images are NOT downloaded. This reverses that.\n' + ' --styletags By default, all tags are ignored. This will include them.\n' + + ' --enableserviceworkers By default, use of Service Workers is disable. This flag enables them.\n' + ' --withoutjavascript The CSS is evaluated against the DOM twice, first with no JavaScript, ' + 'then with. This disables the load without JavaScript.\n' + ' --skip String to match in URL to ignore download. Repeatable. E.g. --skip google-analyics.com\n' + @@ -106,7 +108,8 @@ const options = { viewport: parseViewport(argv['viewport']), puppeteerArgs: argv['nosandbox'] ? ['--no-sandbox', '--disable-setuid-sandbox'] - : [] + : [], + enableServiceWorkers: argv['enableserviceworkers'] }; const start = Date.now(); diff --git a/package.json b/package.json index ad66323f..8a472618 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "csso": "~3.5.0", "filesize": "^3.5.11", "minimist": "^1.2.0", - "puppeteer": "^1.4.0" + "puppeteer": "^1.8.0" }, "devDependencies": { "fastify": "1.11.2", diff --git a/src/run.js b/src/run.js index 8870a29d..f2f9b367 100644 --- a/src/run.js +++ b/src/run.js @@ -408,14 +408,18 @@ const processPage = ({ /** * - * @param {{ urls: Array, debug: boolean, loadimages: boolean, skippable: function, browser: any, userAgent: string, withoutjavascript: boolean, viewport: any, puppeteerArgs: Array, cssoOptions: Object, ignoreCSSErrors?: boolean, ignoreJSErrors?: boolean, styletags?: boolean }} options + * @param {{ urls: Array, debug: boolean, loadimages: boolean, skippable: function, browser: any, userAgent: string, withoutjavascript: boolean, viewport: any, puppeteerArgs: Array, cssoOptions: Object, ignoreCSSErrors?: boolean, ignoreJSErrors?: boolean, styletags?: boolean, enableServiceWorkers?: boolean }} options * @return Promise<{ finalCss: string, stylesheetContents: { [key: string]: string } }> */ const minimalcss = async options => { const { urls } = options; const debug = options.debug || false; const cssoOptions = options.cssoOptions || {}; + const enableServiceWorkers = options.enableServiceWorkers || false; const puppeteerArgs = options.puppeteerArgs || []; + if (!enableServiceWorkers) { + puppeteerArgs.push('--enable-features=NetworkService'); + } const browser = options.browser || (await puppeteer.launch({ @@ -436,6 +440,9 @@ const minimalcss = async options => { for (let i = 0; i < urls.length; i++) { const pageUrl = urls[i]; const page = await browser.newPage(); + if (!enableServiceWorkers) { + await page._client.send('ServiceWorker.disable'); + } try { await processPage({ page, diff --git a/yarn.lock b/yarn.lock index 12add231..77913815 100644 --- a/yarn.lock +++ b/yarn.lock @@ -652,10 +652,11 @@ concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" -concat-stream@1.6.0: - version "1.6.0" - resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.0.tgz#0aac662fd52be78964d5532f694784e70110acf7" +concat-stream@1.6.2: + version "1.6.2" + resolved "https://registry.yarnpkg.com/concat-stream/-/concat-stream-1.6.2.tgz#904bdf194cd3122fc675c77fc4ac3d4ff0fd1a34" dependencies: + buffer-from "^1.0.0" inherits "^2.0.3" readable-stream "^2.2.2" typedarray "^0.0.6" @@ -1086,13 +1087,13 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extract-zip@^1.6.5: - version "1.6.6" - resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.6.tgz#1290ede8d20d0872b429fd3f351ca128ec5ef85c" +extract-zip@^1.6.6: + version "1.6.7" + resolved "https://registry.yarnpkg.com/extract-zip/-/extract-zip-1.6.7.tgz#a840b4b8af6403264c8db57f4f1a74333ef81fe9" dependencies: - concat-stream "1.6.0" + concat-stream "1.6.2" debug "2.6.9" - mkdirp "0.5.0" + mkdirp "0.5.1" yauzl "2.4.1" extsprintf@1.3.0: @@ -1560,9 +1561,9 @@ http-signature@~1.2.0: jsprim "^1.2.2" sshpk "^1.7.0" -https-proxy-agent@^2.1.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.0.tgz#7fbba856be8cd677986f42ebd3664f6317257887" +https-proxy-agent@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-2.2.1.tgz#51552970fa04d723e04c56d04178c3f92592bbc0" dependencies: agent-base "^4.1.0" debug "^3.1.0" @@ -2480,13 +2481,7 @@ mixin-deep@^1.2.0: for-in "^1.0.2" is-extendable "^1.0.1" -mkdirp@0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.0.tgz#1d73076a6df986cd9344e15e71fcc05a4c9abf12" - dependencies: - minimist "0.0.8" - -"mkdirp@>=0.5 0", mkdirp@^0.5.1: +mkdirp@0.5.1, "mkdirp@>=0.5 0", mkdirp@^0.5.1: version "0.5.1" resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-0.5.1.tgz#30057438eac6cf7f8c4767f38648d6697d75c903" dependencies: @@ -2908,18 +2903,18 @@ punycode@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.0.tgz#5f863edc89b96db09074bad7947bf09056ca4e7d" -puppeteer@^1.4.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.4.0.tgz#437f0f3450d76e437185c0bf06f446e80f184692" +puppeteer@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/puppeteer/-/puppeteer-1.8.0.tgz#9e8bbd2f5448cc19cac220efc0512837104877ad" dependencies: debug "^3.1.0" - extract-zip "^1.6.5" - https-proxy-agent "^2.1.0" + extract-zip "^1.6.6" + https-proxy-agent "^2.2.1" mime "^2.0.3" progress "^2.0.0" proxy-from-env "^1.0.0" rimraf "^2.6.1" - ws "^3.0.0" + ws "^5.1.1" qs@~6.4.0: version "6.4.0" @@ -3620,10 +3615,6 @@ uid-number@^0.0.6: version "0.0.6" resolved "https://registry.yarnpkg.com/uid-number/-/uid-number-0.0.6.tgz#0ea10e8035e8eb5b8e4449f06da1c730663baa81" -ultron@~1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/ultron/-/ultron-1.1.1.tgz#9fe1536a10a664a65266a1e3ccf85fd36302bc9c" - union-value@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/union-value/-/union-value-1.0.0.tgz#5c71c34cb5bad5dcebe3ea0cd08207ba5aa1aea4" @@ -3774,14 +3765,6 @@ write-file-atomic@^2.1.0: imurmurhash "^0.1.4" signal-exit "^3.0.2" -ws@^3.0.0: - version "3.3.3" - resolved "https://registry.yarnpkg.com/ws/-/ws-3.3.3.tgz#f1cf84fe2d5e901ebce94efaece785f187a228f2" - dependencies: - async-limiter "~1.0.0" - safe-buffer "~5.1.0" - ultron "~1.1.0" - ws@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/ws/-/ws-4.1.0.tgz#a979b5d7d4da68bf54efe0408967c324869a7289" @@ -3789,6 +3772,12 @@ ws@^4.0.0: async-limiter "~1.0.0" safe-buffer "~5.1.0" +ws@^5.1.1: + version "5.2.2" + resolved "https://registry.yarnpkg.com/ws/-/ws-5.2.2.tgz#dffef14866b8e8dc9133582514d1befaf96e980f" + dependencies: + async-limiter "~1.0.0" + xml-name-validator@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" From 9aff2e599d0cf05251eb84b3e3fe52fdd504f149 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 13 Sep 2018 09:53:18 -0400 Subject: [PATCH 039/164] update changelog for 0.8.0 --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f47f4206..598497a8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,8 @@ -# 0.7.x +# 0.8.0 + +* By default, Service Workers are disabled. This new feature requires an + upgrade of puppeteer to `^1.8.0`. + [pull#265](https://github.com/peterbe/minimalcss/pull/265) * Ability to also extract the CSS of all `style` tags with the `styletags` option. From 0c93372c8754ed7357514c0daf270161af12b650 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Thu, 13 Sep 2018 09:53:24 -0400 Subject: [PATCH 040/164] 0.8.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8a472618..f19e1c11 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minimalcss", - "version": "0.7.10", + "version": "0.8.0", "description": "Extract the minimal CSS used in a set of URLs with puppeteer", "main": "./index.js", "author": "Peter Bengtsson", From d10733169d17abc86955bde3cad79d2427b466f8 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Wed, 19 Sep 2018 13:10:58 +0000 Subject: [PATCH 041/164] Update dependency prettier to v1.14.3 --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f19e1c11..aa3ad12c 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "fastify": "1.11.2", "fastify-static": "0.14.0", "jest": "23.6.0", - "prettier": "1.14.2" + "prettier": "1.14.3" }, "scripts": { "tsc": "tsc -p .", diff --git a/yarn.lock b/yarn.lock index 77913815..71c51e42 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2843,9 +2843,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@1.14.2: - version "1.14.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.2.tgz#0ac1c6e1a90baa22a62925f41963c841983282f9" +prettier@1.14.3: + version "1.14.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" pretty-format@^23.6.0: version "23.6.0" From 58956a98384f4392cecdec5f30549664631fb0da Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Mon, 24 Sep 2018 14:40:54 -0400 Subject: [PATCH 042/164] Update dependency fastify to v1.12.0 (#271) This PR contains the following updates: | Package | Type | Update | New value | References | |---|---|---|---|---| | fastify | devDependencies | minor | 1.12.0 | [homepage](https://www.fastify.io/), [source](https://renovatebot.com/gh/fastify/fastify) | --- ### Release Notes
fastify/fastify ### [`v1.12.0`](https://renovatebot.com/gh/fastify/fastify/releases/v1.12.0) [Compare Source](https://renovatebot.com/gh/fastify/fastify/compare/v1.11.2...v1.12.0) **Enhancements** - Fix missing object wrapper for errors in pino log - [#​1180](https://renovatebot.com/gh/fastify/fastify/issues/1180) - Complete support for Joi. Added test - [#​1178](https://renovatebot.com/gh/fastify/fastify/issues/1178) [#​1179](https://renovatebot.com/gh/fastify/fastify/issues/1179) **Fixes** - fix the logic of convert chunk segement into string - [#​1172](https://renovatebot.com/gh/fastify/fastify/issues/1172) **Typescript** - Add overloads for { parseAs: "string" } or { parseAs: "buffer" } - [#​1162](https://renovatebot.com/gh/fastify/fastify/issues/1162) - added generic Query, Params, Headers, and Body types - [#​1160](https://renovatebot.com/gh/fastify/fastify/issues/1160) **Internals** - Update genReqId test name - [#​1167](https://renovatebot.com/gh/fastify/fastify/issues/1167) **Documentation** - Keep consistent es6 usage in readme example - [#​1181](https://renovatebot.com/gh/fastify/fastify/issues/1181) - added fastify-jwt-webapp - [#​1141](https://renovatebot.com/gh/fastify/fastify/issues/1141) - Update Ecosystem.md - [#​1170](https://renovatebot.com/gh/fastify/fastify/issues/1170) - Add [@​cemremengu](https://renovatebot.com/gh/cemremengu) to contributors - [#​1176](https://renovatebot.com/gh/fastify/fastify/issues/1176) - Correct typo in docs/Plugins-Guide.md - [#​1173](https://renovatebot.com/gh/fastify/fastify/issues/1173) - Add fastify-webpack-hmr community plugin to ECOSYSTEM.md - [#​1152](https://renovatebot.com/gh/fastify/fastify/issues/1152) - Updated README and tap runner - [#​1171](https://renovatebot.com/gh/fastify/fastify/issues/1171) - Error Handling Documentation - [#​1130](https://renovatebot.com/gh/fastify/fastify/issues/1130) - Update ContentTypeParser.md - [#​1157](https://renovatebot.com/gh/fastify/fastify/issues/1157) - Add fastify-vue-plugin to Ecosystem.md - [#​1151](https://renovatebot.com/gh/fastify/fastify/issues/1151) - Add fastify-loader to Ecosystem.md - [#​1154](https://renovatebot.com/gh/fastify/fastify/issues/1154) - Add badge of vulnerabilities from snyk.io - [#​1149](https://renovatebot.com/gh/fastify/fastify/issues/1149)
--- ### Renovate configuration :date: **Schedule**: No schedule defined. :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Renovate will regenerate this PR any time it develops a merge conflict. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- This PR has been generated by [Renovate Bot](https://renovatebot.com/gh/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#peterbe/minimalcss). --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index aa3ad12c..a1fad7fe 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "puppeteer": "^1.8.0" }, "devDependencies": { - "fastify": "1.11.2", + "fastify": "1.12.0", "fastify-static": "0.14.0", "jest": "23.6.0", "prettier": "1.14.3" diff --git a/yarn.lock b/yarn.lock index 71c51e42..28fac784 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1153,9 +1153,9 @@ fastify-static@0.14.0: readable-stream "^3.0.0" send "^0.16.0" -fastify@1.11.2: - version "1.11.2" - resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.11.2.tgz#7495c8134e21e13dccd6bc6b5d036f187faa276e" +fastify@1.12.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.12.0.tgz#6f1a270194eebf936bfe57730ba770b22cf9ea3f" dependencies: "@types/pino" "^4.16.0" abstract-logging "^1.0.0" From 8f3ac829c8325ef1ce48a02a787b8a6a3c12ad6d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Tue, 25 Sep 2018 16:23:00 -0400 Subject: [PATCH 043/164] Update dependency fastify to v1.12.1 (#272) This PR contains the following updates: | Package | Type | Update | Change | References | |---|---|---|---|---| | fastify | devDependencies | patch | `1.12.0` -> `1.12.1` | [homepage](https://www.fastify.io/), [source](https://renovatebot.com/gh/fastify/fastify) | --- ### Release Notes
fastify/fastify ### [`v1.12.1`](https://renovatebot.com/gh/fastify/fastify/releases/v1.12.1) [Compare Source](https://renovatebot.com/gh/fastify/fastify/compare/v1.12.0...v1.12.1) #### Bugfix - Fix content length for utf-8 characters [#​1187](https://renovatebot.com/gh/fastify/fastify/issues/1187)
--- ### Renovate configuration :date: **Schedule**: No schedule defined. :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Renovate will regenerate this PR any time it develops a merge conflict. :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- This PR has been generated by [Renovate Bot](https://renovatebot.com/gh/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#peterbe/minimalcss). --- package.json | 2 +- yarn.lock | 36 ++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/package.json b/package.json index a1fad7fe..f363b0d1 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "puppeteer": "^1.8.0" }, "devDependencies": { - "fastify": "1.12.0", + "fastify": "1.12.1", "fastify-static": "0.14.0", "jest": "23.6.0", "prettier": "1.14.3" diff --git a/yarn.lock b/yarn.lock index 28fac784..c0832b9b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -83,14 +83,14 @@ ajv@^6.0.0: fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.3.0" -ajv@^6.5.1, ajv@^6.5.2: - version "6.5.2" - resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.2.tgz#678495f9b82f7cca6be248dd92f59bff5e1f4360" +ajv@^6.5.3, ajv@^6.5.4: + version "6.5.4" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.5.4.tgz#247d5274110db653706b550fcc2b797ca28cfc59" dependencies: fast-deep-equal "^2.0.1" fast-json-stable-stringify "^2.0.0" json-schema-traverse "^0.4.1" - uri-js "^4.2.1" + uri-js "^4.2.2" align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" @@ -1124,11 +1124,11 @@ fast-json-stable-stringify@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" -fast-json-stringify@^1.5.4: - version "1.6.0" - resolved "https://registry.yarnpkg.com/fast-json-stringify/-/fast-json-stringify-1.6.0.tgz#be67504565c034c65b5bbec747ab85e16652ccad" +fast-json-stringify@^1.8.0: + version "1.8.0" + resolved "https://registry.yarnpkg.com/fast-json-stringify/-/fast-json-stringify-1.8.0.tgz#a144e43b352721cfe6e6fd783e634a8c454d9568" dependencies: - ajv "^6.5.1" + ajv "^6.5.3" deepmerge "^2.1.1" fast-levenshtein@~2.0.4: @@ -1153,17 +1153,17 @@ fastify-static@0.14.0: readable-stream "^3.0.0" send "^0.16.0" -fastify@1.12.0: - version "1.12.0" - resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.12.0.tgz#6f1a270194eebf936bfe57730ba770b22cf9ea3f" +fastify@1.12.1: + version "1.12.1" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.12.1.tgz#9c314bde2d7e9e26ad70f844414f33a97a7ddc01" dependencies: "@types/pino" "^4.16.0" abstract-logging "^1.0.0" - ajv "^6.5.2" + ajv "^6.5.4" avvio "^5.8.0" end-of-stream "^1.4.1" - fast-json-stringify "^1.5.4" - find-my-way "^1.15.0" + fast-json-stringify "^1.8.0" + find-my-way "^1.15.3" flatstr "^1.0.8" light-my-request "^3.0.0" middie "^3.1.0" @@ -1223,9 +1223,9 @@ fill-range@^4.0.0: repeat-string "^1.6.1" to-regex-range "^2.1.0" -find-my-way@^1.15.0: - version "1.15.1" - resolved "https://registry.yarnpkg.com/find-my-way/-/find-my-way-1.15.1.tgz#aa76b386be51ff528c548422544ffd91d8f3dec1" +find-my-way@^1.15.3: + version "1.15.3" + resolved "https://registry.yarnpkg.com/find-my-way/-/find-my-way-1.15.3.tgz#fca6271fea10387d7f19f0c9ff3ea517d34f6fde" dependencies: fast-decode-uri-component "^1.0.0" safe-regex "^1.1.0" @@ -3631,7 +3631,7 @@ unset-value@^1.0.0: has-value "^0.3.1" isobject "^3.0.0" -uri-js@^4.2.1: +uri-js@^4.2.2: version "4.2.2" resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.2.2.tgz#94c540e1ff772956e2299507c010aea6c8838eb0" dependencies: From cced94fcb9976c63f32e35902eb2568c523089d8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Wed, 31 Oct 2018 08:25:49 -0400 Subject: [PATCH 044/164] Update dependency fastify to v1.13.0 (#276) This PR contains the following updates: | Package | Type | Update | Change | References | |---|---|---|---|---| | fastify | devDependencies | minor | `1.12.1` -> `1.13.0` | [homepage](https://www.fastify.io/), [source](https://renovatebot.com/gh/fastify/fastify) | --- ### Release Notes
fastify/fastify ### [`v1.13.0`](https://renovatebot.com/gh/fastify/fastify/releases/v1.13.0) [Compare Source](https://renovatebot.com/gh/fastify/fastify/compare/v1.12.1...v1.13.0) **Features** - Enable nested plugins to override decorators - [#​1199](https://renovatebot.com/gh/fastify/fastify/issues/1199) - Attach validation result to request - [#​1238](https://renovatebot.com/gh/fastify/fastify/issues/1238) **Enhancements** - Prevent losing stacktrace onEnd - [#​1223](https://renovatebot.com/gh/fastify/fastify/issues/1223) **Fixes** - Add `fastify-babel` - [#​1219](https://renovatebot.com/gh/fastify/fastify/issues/1219) - Update contentTypeParser.js - [#​1229](https://renovatebot.com/gh/fastify/fastify/issues/1229) **Typescript** - typings: fix allowHTTP1 flag for http2 servers - [#​1222](https://renovatebot.com/gh/fastify/fastify/issues/1222) **Documentation** - Update Reply.md - [#​1227](https://renovatebot.com/gh/fastify/fastify/issues/1227) - Add `fastify-babel` - [#​1219](https://renovatebot.com/gh/fastify/fastify/issues/1219) - doc(logging): fix broken link - [#​1215](https://renovatebot.com/gh/fastify/fastify/issues/1215) - Update validation docs to include information about error handling - [#​1232](https://renovatebot.com/gh/fastify/fastify/issues/1232)
--- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with "`rebase!`". :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- This PR has been generated by [Renovate Bot](https://renovatebot.com/gh/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#peterbe/minimalcss). --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index f363b0d1..bd305fb7 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "puppeteer": "^1.8.0" }, "devDependencies": { - "fastify": "1.12.1", + "fastify": "1.13.0", "fastify-static": "0.14.0", "jest": "23.6.0", "prettier": "1.14.3" diff --git a/yarn.lock b/yarn.lock index c0832b9b..7d9332e6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1153,9 +1153,9 @@ fastify-static@0.14.0: readable-stream "^3.0.0" send "^0.16.0" -fastify@1.12.1: - version "1.12.1" - resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.12.1.tgz#9c314bde2d7e9e26ad70f844414f33a97a7ddc01" +fastify@1.13.0: + version "1.13.0" + resolved "https://registry.yarnpkg.com/fastify/-/fastify-1.13.0.tgz#1e68bd7bc69257afa989f6ae94c885255087a403" dependencies: "@types/pino" "^4.16.0" abstract-logging "^1.0.0" From 4c94eb3954832cd10aeca7606a23b1420b125bc6 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Wed, 7 Nov 2018 08:31:18 -0500 Subject: [PATCH 045/164] Update dependency prettier to v1.15.1 (#277) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR contains the following updates: | Package | Type | Update | Change | References | |---|---|---|---|---| | prettier | devDependencies | minor | `1.14.3` -> `1.15.1` | [homepage](https://prettier.io), [source](https://renovatebot.com/gh/prettier/prettier) | --- ### Release Notes
prettier/prettier ### [`v1.15.1`](https://renovatebot.com/gh/prettier/prettier/blob/master/CHANGELOG.md#​1151) [Compare Source](https://renovatebot.com/gh/prettier/prettier/compare/1.15.0...1.15.1) [diff](https://renovatebot.com/gh/prettier/prettier/compare/1.15.0...1.15.1) - Markdown: do not keep increasing backslashes for dollar sign ([#​5358](https://renovatebot.com/gh/prettier/prettier/pull/5358)) ### [`v1.15.0`](https://renovatebot.com/gh/prettier/prettier/blob/master/CHANGELOG.md#​1150) [Compare Source](https://renovatebot.com/gh/prettier/prettier/compare/1.14.3...1.15.0) [diff](https://renovatebot.com/gh/prettier/prettier/compare/1.14.3...1.15.0) 🔗 [Release Notes](https://prettier.io/blog/2018/11/07/1.15.0.html)
--- ### Renovate configuration :date: **Schedule**: At any time (no schedule defined). :vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied. :recycle: **Rebasing**: Whenever PR becomes conflicted, or if you modify the PR title to begin with "`rebase!`". :no_bell: **Ignore**: Close this PR and you won't be reminded about this update again. --- This PR has been generated by [Renovate Bot](https://renovatebot.com/gh/marketplace/renovate). View repository job log [here](https://renovatebot.com/dashboard#peterbe/minimalcss). --- package.json | 2 +- yarn.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index bd305fb7..66da9534 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "fastify": "1.13.0", "fastify-static": "0.14.0", "jest": "23.6.0", - "prettier": "1.14.3" + "prettier": "1.15.1" }, "scripts": { "tsc": "tsc -p .", diff --git a/yarn.lock b/yarn.lock index 7d9332e6..2f25bc8b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2843,9 +2843,9 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@1.14.3: - version "1.14.3" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" +prettier@1.15.1: + version "1.15.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.1.tgz#06c67106afb1b40e74b002353b2079cc7e0e67bf" pretty-format@^23.6.0: version "23.6.0" From 3407235ba0b005891a36c7ce9cfe34e4521b2ed7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" Date: Mon, 12 Nov 2018 10:22:05 -0500 Subject: [PATCH 046/164] Update dependency prettier to v1.15.2 (#278) This PR contains the following updates: | Package | Type | Update | Change | References | |---|---|---|---|---| | prettier | devDependencies | patch | `1.15.1` -> `1.15.2` | [homepage](https://prettier.io), [source](https://renovatebot.com/gh/prettier/prettier) | --- ### Release Notes
prettier/prettier ### [`v1.15.2`](https://renovatebot.com/gh/prettier/prettier/blob/master/CHANGELOG.md#​1152) [Compare Source](https://renovatebot.com/gh/prettier/prettier/compare/1.15.1...1.15.2) [diff](https://renovatebot.com/gh/prettier/prettier/compare/1.15.1...1.15.2) - CLI: allow flag overriding ([#​5390](https://renovatebot.com/gh/prettier/prettier/pull/5390)) - JavaScript: do not apply test call formatting to arrow function without body ([#​5366](https://renovatebot.com/gh/prettier/prettier/pull/5366)) - JavaScript: do not duplicate comments in styled-components ([#​5416](https://renovatebot.com/gh/prettier/prettier/pull/5416)) - JavaScript: do not indent comments behind variable declarations ([#​5434](https://renovatebot.com/gh/prettier/prettier/pull/5434)) - JavaScript: inline property decorator should stay inline ([#​5364](https://renovatebot.com/gh/prettier/prettier/pull/5364), [#​5423](https://renovatebot.com/gh/prettier/prettier/pull/5423)) - JavaScript: treat `createSelector` as function composition ([#​5430](https://renovatebot.com/gh/prettier/prettier/pull/5430)) - Flow: do not move flow comment for function argument to its body ([#​5435](https://renovatebot.com/gh/prettier/prettier/pull/5435)) - Flow: force-break interface body to be consistent with TypeScript interface ([#​5432](https://renovatebot.com/gh/prettier/prettier/pull/5432)) - Flow/TypeScript: remove extra indentation for `extends` ([#​5432](https://renovatebot.com/gh/prettier/prettier/pull/5432)) - TypeScript: distinguish `module` and `namespace` correctly ([#​5432](https://renovatebot.com/gh/prettier/prettier/pull/5432)) - HTML: handle CRLF correctly ([#​5393](https://renovatebot.com/gh/prettier/prettier/pull/5393)) - HTML: handle `
` with interpolation ([#​5400](https://renovatebot.com/gh/prettier/prettier/pull/5400))
-   HTML: preserve content for `