Comparing version 0.5.6 to 0.5.7
@@ -5,2 +5,9 @@ # Changelog | ||
### [0.5.7](https://github.com/nuxt-contrib/ipx/compare/v0.5.6...v0.5.7) (2021-02-08) | ||
### Bug Fixes | ||
* override meta.type and meta.mimeType if format modifier used ([820f1e2](https://github.com/nuxt-contrib/ipx/commit/820f1e253dcbd0fe1122a742bb75dcfc364b868b)) | ||
### [0.5.6](https://github.com/nuxt-contrib/ipx/compare/v0.5.5...v0.5.6) (2021-02-04) | ||
@@ -7,0 +14,0 @@ |
@@ -251,2 +251,3 @@ #!/usr/bin/env node | ||
} | ||
const format = inputOpts.modifiers.f || inputOpts.modifiers.format; | ||
const getSrc = cachedPromise(() => { | ||
@@ -263,2 +264,8 @@ const source2 = inputOpts.source || ufo.hasProtocol(id) ? "http" : "filesystem"; | ||
const meta = imageMeta__default['default'](data); | ||
meta._type = meta.type; | ||
meta._mimeType = meta.mimeType; | ||
if (format) { | ||
meta.type = format; | ||
meta.mimeType = "image/" + format; | ||
} | ||
return meta; | ||
@@ -273,3 +280,3 @@ }); | ||
const meta = await getMeta(); | ||
if (meta.type === "svg" && (!inputOpts.modifiers.f || !inputOpts.modifiers.format)) { | ||
if (meta._type === "svg" && !format) { | ||
return data; | ||
@@ -276,0 +283,0 @@ } |
@@ -16,2 +16,4 @@ import { IncomingMessage, ServerResponse } from 'http'; | ||
mimeType: string; | ||
_mimeType: string; | ||
_type: string; | ||
} | ||
@@ -18,0 +20,0 @@ interface IPXInputOptions { |
@@ -248,2 +248,3 @@ 'use strict'; | ||
} | ||
const format = inputOpts.modifiers.f || inputOpts.modifiers.format; | ||
const getSrc = cachedPromise(() => { | ||
@@ -260,2 +261,8 @@ const source2 = inputOpts.source || ufo.hasProtocol(id) ? "http" : "filesystem"; | ||
const meta = imageMeta__default['default'](data); | ||
meta._type = meta.type; | ||
meta._mimeType = meta.mimeType; | ||
if (format) { | ||
meta.type = format; | ||
meta.mimeType = "image/" + format; | ||
} | ||
return meta; | ||
@@ -270,3 +277,3 @@ }); | ||
const meta = await getMeta(); | ||
if (meta.type === "svg" && (!inputOpts.modifiers.f || !inputOpts.modifiers.format)) { | ||
if (meta._type === "svg" && !format) { | ||
return data; | ||
@@ -273,0 +280,0 @@ } |
{ | ||
"name": "ipx", | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"repository": "nuxt-contrib/ipx", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40750
1056