From 92f44d537409b8d5eca1a7594ea1009eb5fb372c Mon Sep 17 00:00:00 2001 From: Christoph Guttandin Date: Wed, 3 Apr 2019 16:20:31 +0200 Subject: [PATCH 1/3] Update assetgraph to ^5.8.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bc8bfbf..9db9194 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ ], "homepage": "https://github.com/Munter/hyperlink", "dependencies": { - "assetgraph": "4.8.0", + "assetgraph": "^5.8.3", "async": "^2.6.0", "optimist": "^0.6.1", "pretty-bytes": "^4.0.2", From 6ad46698d89619765aafebd16d4e878ff6c7ec89 Mon Sep 17 00:00:00 2001 From: Christoph Guttandin Date: Wed, 3 Apr 2019 16:21:59 +0200 Subject: [PATCH 2/3] Remove compatibility check --- lib/index.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/index.js b/lib/index.js index 0dc161e..95ab24a 100644 --- a/lib/index.js +++ b/lib/index.js @@ -732,17 +732,6 @@ async function hyperlink( ); } - // Check Content-Type vs. incoming relation targetTypes: - - for (const asset of ag.findAssets({ expectedTypes: { $exists: true } })) { - const incompatibleTypes = [...asset.expectedTypes].filter( - expectedType => !asset._isCompatibleWith(expectedType) - ); - if (incompatibleTypes.length > 0) { - asset._warnIncompatibleTypes([...incompatibleTypes, asset.type]); - } - } - // Check preconnects: const preconnectAssetsToCheck = ag.findAssets({ From 6d10c7814934f6fe3759efa287df34dd22631e27 Mon Sep 17 00:00:00 2001 From: Christoph Guttandin Date: Wed, 3 Apr 2019 16:47:47 +0200 Subject: [PATCH 3/3] Remove tests which cover the compatibility check --- test/index.js | 107 -------------------------------------------------- 1 file changed, 107 deletions(-) diff --git a/test/index.js b/test/index.js index f46ad53..24dab12 100644 --- a/test/index.js +++ b/test/index.js @@ -139,113 +139,6 @@ describe('hyperlink', function() { }); }); - it('should complain if an asset loaded has an unexpected Content-Type', async function() { - httpception([ - { - request: 'GET https://example.com/', - response: { - statusCode: 200, - headers: { - 'Content-Type': 'text/html; charset=UTF-8' - }, - body: ` - - - - - - - - - ` - } - }, - { - request: 'GET https://example.com/styles.css', - response: { - headers: { - 'Content-Type': 'image/png' - }, - body: 'div { color: maroon; }' - } - } - ]); - - const t = new TapRender(); - sinon.spy(t, 'push'); - await hyperlink( - { - root: 'https://example.com/', - inputUrls: ['https://example.com/'] - }, - t - ); - - expect(t.close(), 'to satisfy', { fail: 1 }); - expect(t.push, 'to have a call satisfying', () => { - t.push(null, { - ok: false, - operator: 'content-type-mismatch', - name: 'content-type-mismatch https://example.com/styles.css', - actual: 'Asset is used as both Css and Png', - at: - 'https://example.com/ (5:44) ' - }); - }); - }); - - it('should complain if an asset being HEADed has an unexpected Content-Type', async function() { - httpception([ - { - request: 'GET https://example.com/', - response: { - statusCode: 200, - headers: { - 'Content-Type': 'text/html; charset=UTF-8' - }, - body: ` - - - - - - - - ` - } - }, - { - request: 'HEAD https://example.com/hey.png', - response: { - headers: { - 'Content-Type': 'text/plain' - } - } - } - ]); - - const t = new TapRender(); - sinon.spy(t, 'push'); - await hyperlink( - { - root: 'https://example.com/', - inputUrls: ['https://example.com/'] - }, - t - ); - - expect(t.close(), 'to satisfy', { fail: 1 }); - expect(t.push, 'to have a call satisfying', () => { - t.push(null, { - ok: false, - operator: 'content-type-mismatch', - name: 'content-type-mismatch https://example.com/hey.png', - actual: 'Asset is used as both Image and Text', - at: 'https://example.com/ (6:25) ' - }); - }); - }); - it('should complain if an asset being HEADed has no Content-Type', async function() { httpception([ {