Skip to content

Commit

Permalink
play nice with html-loader
Browse files Browse the repository at this point in the history
  • Loading branch information
dzuloaga committed Jun 8, 2022
1 parent a83d24f commit bc0ac24
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
1 change: 1 addition & 0 deletions src/parseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function parseQuery(query: string): LooseObject {
}

if (query.slice(0, 1) === '{' && query.slice(-1) === '}') {
query = decodeURIComponent(query)
return JSON5.parse(query)
}

Expand Down
22 changes: 0 additions & 22 deletions test/sharp/build/__snapshots__/test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -252,28 +252,6 @@ Object {
}
`;

exports[`parses json notation with singleQuotes 1`] = `
Object {
"height": 91,
"images": Array [
Object {
"height": 47,
"path": "foobar/064e7e9c9d1af8543b88b2331becb082-52.webp",
"width": 52,
},
Object {
"height": 91,
"path": "foobar/8f3bb7e057d40b23a28b1eeed1232feb-102.webp",
"width": 102,
},
],
"src": "foobar/8f3bb7e057d40b23a28b1eeed1232feb-102.webp",
"srcSet": "foobar/064e7e9c9d1af8543b88b2331becb082-52.webp 52w,foobar/8f3bb7e057d40b23a28b1eeed1232feb-102.webp 102w",
"toString": [Function],
"width": 102,
}
`;

exports[`png 1`] = `
Object {
"height": 595,
Expand Down
7 changes: 1 addition & 6 deletions test/sharp/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ test('multiple sizes', () => {
})

test('parses json notation', () => {
const multi = require("../cat-1000.jpg?{sizes:[50,100,200], format: 'webp'}")
expect(multi).toMatchSnapshot()
})

test('parses json notation with singleQuotes', () => {
const multi = require('../cat-1000.jpg?{sizes:[52,102], format: "webp"}')
const multi = require('../cat-1000.jpg?{sizes:[50,100,200], format: "webp"}')
expect(multi).toMatchSnapshot()
})

Expand Down

0 comments on commit bc0ac24

Please sign in to comment.