Skip to content

Commit 13e5f47

Browse files
authored
Merge pull request #149 from chrisguttandin/master
Update assetgraph to version 5
2 parents 695abb5 + 6d10c78 commit 13e5f47

3 files changed

Lines changed: 1 addition & 119 deletions

File tree

lib/index.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -732,17 +732,6 @@ async function hyperlink(
732732
);
733733
}
734734

735-
// Check Content-Type vs. incoming relation targetTypes:
736-
737-
for (const asset of ag.findAssets({ expectedTypes: { $exists: true } })) {
738-
const incompatibleTypes = [...asset.expectedTypes].filter(
739-
expectedType => !asset._isCompatibleWith(expectedType)
740-
);
741-
if (incompatibleTypes.length > 0) {
742-
asset._warnIncompatibleTypes([...incompatibleTypes, asset.type]);
743-
}
744-
}
745-
746735
// Check preconnects:
747736

748737
const preconnectAssetsToCheck = ag.findAssets({

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
],
3636
"homepage": "https://github.com/Munter/hyperlink",
3737
"dependencies": {
38-
"assetgraph": "4.8.0",
38+
"assetgraph": "^5.8.3",
3939
"async": "^2.6.0",
4040
"optimist": "^0.6.1",
4141
"pretty-bytes": "^4.0.2",

test/index.js

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -139,113 +139,6 @@ describe('hyperlink', function() {
139139
});
140140
});
141141

142-
it('should complain if an asset loaded has an unexpected Content-Type', async function() {
143-
httpception([
144-
{
145-
request: 'GET https://example.com/',
146-
response: {
147-
statusCode: 200,
148-
headers: {
149-
'Content-Type': 'text/html; charset=UTF-8'
150-
},
151-
body: `
152-
<!DOCTYPE html>
153-
<html>
154-
<head>
155-
<link rel="stylesheet" href="styles.css">
156-
</head>
157-
<body>
158-
</body>
159-
</html>
160-
`
161-
}
162-
},
163-
{
164-
request: 'GET https://example.com/styles.css',
165-
response: {
166-
headers: {
167-
'Content-Type': 'image/png'
168-
},
169-
body: 'div { color: maroon; }'
170-
}
171-
}
172-
]);
173-
174-
const t = new TapRender();
175-
sinon.spy(t, 'push');
176-
await hyperlink(
177-
{
178-
root: 'https://example.com/',
179-
inputUrls: ['https://example.com/']
180-
},
181-
t
182-
);
183-
184-
expect(t.close(), 'to satisfy', { fail: 1 });
185-
expect(t.push, 'to have a call satisfying', () => {
186-
t.push(null, {
187-
ok: false,
188-
operator: 'content-type-mismatch',
189-
name: 'content-type-mismatch https://example.com/styles.css',
190-
actual: 'Asset is used as both Css and Png',
191-
at:
192-
'https://example.com/ (5:44) <link rel="stylesheet" href="styles.css">'
193-
});
194-
});
195-
});
196-
197-
it('should complain if an asset being HEADed has an unexpected Content-Type', async function() {
198-
httpception([
199-
{
200-
request: 'GET https://example.com/',
201-
response: {
202-
statusCode: 200,
203-
headers: {
204-
'Content-Type': 'text/html; charset=UTF-8'
205-
},
206-
body: `
207-
<!DOCTYPE html>
208-
<html>
209-
<head></head>
210-
<body>
211-
<img src="hey.png">
212-
</body>
213-
</html>
214-
`
215-
}
216-
},
217-
{
218-
request: 'HEAD https://example.com/hey.png',
219-
response: {
220-
headers: {
221-
'Content-Type': 'text/plain'
222-
}
223-
}
224-
}
225-
]);
226-
227-
const t = new TapRender();
228-
sinon.spy(t, 'push');
229-
await hyperlink(
230-
{
231-
root: 'https://example.com/',
232-
inputUrls: ['https://example.com/']
233-
},
234-
t
235-
);
236-
237-
expect(t.close(), 'to satisfy', { fail: 1 });
238-
expect(t.push, 'to have a call satisfying', () => {
239-
t.push(null, {
240-
ok: false,
241-
operator: 'content-type-mismatch',
242-
name: 'content-type-mismatch https://example.com/hey.png',
243-
actual: 'Asset is used as both Image and Text',
244-
at: 'https://example.com/ (6:25) <img src="hey.png">'
245-
});
246-
});
247-
});
248-
249142
it('should complain if an asset being HEADed has no Content-Type', async function() {
250143
httpception([
251144
{

0 commit comments

Comments
 (0)