@sparted/shared-library 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/cdn.factory.js +1 -1
- package/cdn/cdn.factory.js.map +1 -1
- package/package.json +1 -1
package/cdn/cdn.factory.js
CHANGED
|
@@ -26,7 +26,7 @@ const twicpicsTransformationQueries = (params) => {
|
|
|
26
26
|
}
|
|
27
27
|
if (params.width !== undefined) {
|
|
28
28
|
const resizeHeight = params.height !== undefined ? `x${params.height}` : '';
|
|
29
|
-
return `?twic=v1/
|
|
29
|
+
return `?twic=v1/cover=${params.width}${resizeHeight}`;
|
|
30
30
|
}
|
|
31
31
|
return '';
|
|
32
32
|
};
|
package/cdn/cdn.factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cdn.factory.js","sources":["../../src/cdn/cdn.factory.ts"],"sourcesContent":["import type { CreateCdn, TransformationQueries } from './types';\nimport { getCdnFromS3UrlFactory } from './utils/get-cdn-from-s3-url.util';\nimport { getCdnUrlFactory } from './utils/get-cdn-url.util';\n\nexport const imgixTransformationQueries: TransformationQueries = ({\n fit,\n devicePixelRatio,\n height,\n width,\n quality,\n}) => [\n '?auto=compress,format',\n fit === 'crop' ? '&fit=crop' : '',\n Number.isFinite(devicePixelRatio) ? `&dpr=${devicePixelRatio}` : '',\n Number.isFinite(height) ? `&h=${height}` : '',\n Number.isFinite(width) ? `&w=${width}` : '',\n quality !== undefined && quality >= 0 && quality <= 100\n ? `&q=${quality}`\n : '',\n].join('');\n\nexport const twicpicsTransformationQueries: TransformationQueries = (\n params,\n) => {\n if (params.fit !== undefined) {\n if (params.width === undefined || params.height === undefined) {\n // eslint-disable-next-line no-console\n console.error('⚠️ The Twicpics api needs a width and a height.');\n return '';\n }\n return `?twic=v1/${params.fit}=${params.width}x${params.height}`;\n }\n if (params.width !== undefined) {\n const resizeHeight = params.height !== undefined ? `x${params.height}` : '';\n return `?twic=v1/
|
|
1
|
+
{"version":3,"file":"cdn.factory.js","sources":["../../src/cdn/cdn.factory.ts"],"sourcesContent":["import type { CreateCdn, TransformationQueries } from './types';\nimport { getCdnFromS3UrlFactory } from './utils/get-cdn-from-s3-url.util';\nimport { getCdnUrlFactory } from './utils/get-cdn-url.util';\n\nexport const imgixTransformationQueries: TransformationQueries = ({\n fit,\n devicePixelRatio,\n height,\n width,\n quality,\n}) => [\n '?auto=compress,format',\n fit === 'crop' ? '&fit=crop' : '',\n Number.isFinite(devicePixelRatio) ? `&dpr=${devicePixelRatio}` : '',\n Number.isFinite(height) ? `&h=${height}` : '',\n Number.isFinite(width) ? `&w=${width}` : '',\n quality !== undefined && quality >= 0 && quality <= 100\n ? `&q=${quality}`\n : '',\n].join('');\n\nexport const twicpicsTransformationQueries: TransformationQueries = (\n params,\n) => {\n if (params.fit !== undefined) {\n if (params.width === undefined || params.height === undefined) {\n // eslint-disable-next-line no-console\n console.error('⚠️ The Twicpics api needs a width and a height.');\n return '';\n }\n return `?twic=v1/${params.fit}=${params.width}x${params.height}`;\n }\n if (params.width !== undefined) {\n const resizeHeight = params.height !== undefined ? `x${params.height}` : '';\n return `?twic=v1/cover=${params.width}${resizeHeight}`;\n }\n return '';\n};\n\n/**\n *\n * @param type cdn provider: 'twicpics' | 'imgix'\n * @param domain provider domain\n * @param instanceMapper domain + the result of the instanceMapper will form the base path\n * @returns \\{ getCdnUrl, transformationQueries \\}\n */\nexport const createCdn: CreateCdn = ({ type, domain, instanceMapper }) => {\n const getCdnUrl = getCdnUrlFactory({\n domain,\n instanceMapper,\n transformationQueries:\n type === 'imgix'\n ? imgixTransformationQueries\n : twicpicsTransformationQueries,\n });\n\n return {\n getCdnUrl,\n getCdnFromS3Url: getCdnFromS3UrlFactory({\n getCdnUrl,\n }),\n };\n};\n"],"names":["getCdnUrlFactory","getCdnFromS3UrlFactory"],"mappings":";;;;;;;AAIa,MAAA,0BAA0B,GAA0B,CAAC,EAChE,GAAG,EACH,gBA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