Skip to content

Commit bc0ac24

Browse files
committed
play nice with html-loader
1 parent a83d24f commit bc0ac24

File tree

3 files changed

+2
-28
lines changed

3 files changed

+2
-28
lines changed

src/parseQuery.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ function parseQuery(query: string): LooseObject {
2222
}
2323

2424
if (query.slice(0, 1) === '{' && query.slice(-1) === '}') {
25+
query = decodeURIComponent(query)
2526
return JSON5.parse(query)
2627
}
2728

test/sharp/build/__snapshots__/test.js.snap

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -252,28 +252,6 @@ Object {
252252
}
253253
`;
254254

255-
exports[`parses json notation with singleQuotes 1`] = `
256-
Object {
257-
"height": 91,
258-
"images": Array [
259-
Object {
260-
"height": 47,
261-
"path": "foobar/064e7e9c9d1af8543b88b2331becb082-52.webp",
262-
"width": 52,
263-
},
264-
Object {
265-
"height": 91,
266-
"path": "foobar/8f3bb7e057d40b23a28b1eeed1232feb-102.webp",
267-
"width": 102,
268-
},
269-
],
270-
"src": "foobar/8f3bb7e057d40b23a28b1eeed1232feb-102.webp",
271-
"srcSet": "foobar/064e7e9c9d1af8543b88b2331becb082-52.webp 52w,foobar/8f3bb7e057d40b23a28b1eeed1232feb-102.webp 102w",
272-
"toString": [Function],
273-
"width": 102,
274-
}
275-
`;
276-
277255
exports[`png 1`] = `
278256
Object {
279257
"height": 595,

test/sharp/index.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ test('multiple sizes', () => {
4040
})
4141

4242
test('parses json notation', () => {
43-
const multi = require("../cat-1000.jpg?{sizes:[50,100,200], format: 'webp'}")
44-
expect(multi).toMatchSnapshot()
45-
})
46-
47-
test('parses json notation with singleQuotes', () => {
48-
const multi = require('../cat-1000.jpg?{sizes:[52,102], format: "webp"}')
43+
const multi = require('../cat-1000.jpg?{sizes:[50,100,200], format: "webp"}')
4944
expect(multi).toMatchSnapshot()
5045
})
5146

0 commit comments

Comments
 (0)