@data-client/img 0.14.19 → 0.14.21
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/dist/index.umd.min.js +1 -1
- package/lib/getImage.js +2 -3
- package/package.json +4 -5
package/dist/index.umd.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@data-client/react"),require("react")):"function"==typeof define&&define.amd?define(["exports","@data-client/react","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Img={},e.RDC,e.React)}(this,(function(e,t,n){"use strict";var r;const o="undefined"!=typeof document;let c=o&&!(null!=(r=document.querySelector("meta[http-equiv='Content-Security-Policy']"))&&r.getAttribute("content"));try{c||Function()}catch(e){c=!0,o&&console.error("Content Security Policy: The previous CSP log can be safely ignored - @data-client/endpoint will use setPrototypeOf instead")}var i;class s extends Function{constructor(e,t){let n,r;return c?(n=(...e)=>n.fetch(...e),Object.setPrototypeOf(n,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),n=this),e&&(n.fetch=e),t&&"name"in t||!e||!e.name||"anonymous"===e.name||(r=e.name),Object.defineProperty(n,"name",{get(){return r||this.__name},set(e){this.__name=e}}),Object.assign(n,t),n}key(...e){return`${this.name} ${JSON.stringify(e)}`}testKey(e){return e.startsWith(this.name)}bind(e,...t){const n=this.fetch,r=this.key;return this.extend({fetch(){return n.apply(null!=e?e:this,t)},key(){return r.apply(this,t)}})}extend(e){class t extends this.constructor{}return Object.assign(t.prototype,this),new t(e.fetch,e)}}i=s,(()=>{if("undefined"!=typeof document&&document.FUNC_MANGLE){const e=i.prototype.key;i.prototype.key=function(...t){return null==document.FUNC_MANGLE||document.FUNC_MANGLE(this),this.prototype.key=e,e.call(this,...t)}}})();const u=new s((async function({src:e}){return new Promise((t=>{"undefined"!=typeof window&&"function"==typeof Image||t(e);const n=new Image;n.onload=()=>{t(e)},n.onerror=n=>{t(e)},n.src=e}))}),{key:({src:e})=>`GET ${e}`}),a=["component"];e.Img=function(e){let{component:r="img"}=e,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@data-client/react"),require("react")):"function"==typeof define&&define.amd?define(["exports","@data-client/react","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Img={},e.RDC,e.React)}(this,(function(e,t,n){"use strict";var r;const o="undefined"!=typeof document;let c=o&&!(null!=(r=document.querySelector("meta[http-equiv='Content-Security-Policy']"))&&r.getAttribute("content"));try{c||Function()}catch(e){c=!0,o&&console.error("Content Security Policy: The previous CSP log can be safely ignored - @data-client/endpoint will use setPrototypeOf instead")}var i;class s extends Function{constructor(e,t){let n,r;return c?(n=(...e)=>n.fetch(...e),Object.setPrototypeOf(n,new.target.prototype)):(super("return arguments.callee.fetch.apply(arguments.callee, arguments)"),n=this),e&&(n.fetch=e),t&&"name"in t||!e||!e.name||"anonymous"===e.name||(r=e.name),Object.defineProperty(n,"name",{get(){return r||this.__name},set(e){this.__name=e}}),Object.assign(n,t),n}key(...e){return`${this.name} ${JSON.stringify(e)}`}testKey(e){return e.startsWith(this.name)}bind(e,...t){const n=this.fetch,r=this.key;return this.extend({fetch(){return n.apply(null!=e?e:this,t)},key(){return r.apply(this,t)}})}extend(e){class t extends this.constructor{}return Object.assign(t.prototype,this),new t(e.fetch,e)}}i=s,(()=>{if("undefined"!=typeof document&&document.FUNC_MANGLE){const e=i.prototype.key;i.prototype.key=function(...t){return null==document.FUNC_MANGLE||document.FUNC_MANGLE(this),this.prototype.key=e,e.call(this,...t)}}})();const u=new s((async function({src:e}){return new Promise((t=>{"undefined"!=typeof window&&"function"==typeof Image||t(e);const n=new Image;n.onload=()=>{t(e)},n.onerror=n=>{t(e)},n.src=e}))}),{key:({src:e})=>`GET ${e}`}),a=["component"];e.Img=function(e){let{component:r="img"}=e,o=function(e,t){if(null==e)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;n[r]=e[r]}return n}(e,a);return t.useSuspense(u,o.src?{src:o.src}:null),n.createElement(r,o)},e.getImage=u}));
|
package/lib/getImage.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import _Promise from "core-js-pure/stable/promise/index.js";
|
|
2
1
|
import { Endpoint } from '@data-client/endpoint';
|
|
3
2
|
const getImage = new Endpoint(async function ({
|
|
4
3
|
src
|
|
5
4
|
}) {
|
|
6
|
-
return new
|
|
5
|
+
return new Promise(resolve => {
|
|
7
6
|
// even if we polyfill, on server we don't want to actually wait to resolve the Image
|
|
8
7
|
if (typeof window === 'undefined' || typeof Image !== 'function') resolve(src);
|
|
9
8
|
const img = new Image();
|
|
@@ -25,4 +24,4 @@ const getImage = new Endpoint(async function ({
|
|
|
25
24
|
}
|
|
26
25
|
});
|
|
27
26
|
export default getImage;
|
|
28
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,
|
|
27
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJFbmRwb2ludCIsImdldEltYWdlIiwic3JjIiwiUHJvbWlzZSIsInJlc29sdmUiLCJ3aW5kb3ciLCJJbWFnZSIsImltZyIsIm9ubG9hZCIsIm9uZXJyb3IiLCJlcnJvciIsImtleSJdLCJzb3VyY2VzIjpbIi4uL3NyYy9nZXRJbWFnZS50cyJdLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBFbmRwb2ludCwgRW5kcG9pbnRJbnN0YW5jZSB9IGZyb20gJ0BkYXRhLWNsaWVudC9lbmRwb2ludCc7XG5cbmNvbnN0IGdldEltYWdlOiBFbmRwb2ludEluc3RhbmNlPFxuICAodGhpczogRW5kcG9pbnRJbnN0YW5jZSwgeyBzcmMgfTogeyBzcmM6IHN0cmluZyB9KSA9PiBQcm9taXNlPHN0cmluZz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V4cG9ydCBkZWZhdWx0IGdldEltYWdlO1xuIl0sIm1hcHBpbmdzIjoiQUFBQSxTQUFTQSxRQUFRLFFBQTBCLHVCQUF1QjtBQUVsRSxNQUFNQyxRQUlMLEdBQUcsSUFBSUQsUUFBUSxDQUNkLGdCQUVFO0VBQUVFO0FBQXFCLENBQUMsRUFDUDtFQUNqQixPQUFPLElBQUlDLE9BQU8sQ0FBQ0MsT0FBTyxJQUFJO0lBQzVCO0lBQ0EsSUFBSSxPQUFPQyxNQUFNLEtBQUssV0FBVyxJQUFJLE9BQU9DLEtBQUssS0FBSyxVQUFVLEVBQzlERixPQUFPLENBQUNGLEdBQUcsQ0FBQztJQUNkLE1BQU1LLEdBQUcsR0FBRyxJQUFJRCxLQUFLLENBQUMsQ0FBQztJQUN2QkMsR0FBRyxDQUFDQyxNQUFNLEdBQUcsTUFBTTtNQUNqQkosT0FBTyxDQUFDRixHQUFHLENBQUM7SUFDZCxDQUFDO0lBQ0RLLEdBQUcsQ0FBQ0UsT0FBTyxHQUFHQyxLQUFLLElBQUk7TUFDckI7TUFDQTtNQUNBTixPQUFPLENBQUNGLEdBQUcsQ0FBQztJQUNkLENBQUM7SUFDREssR0FBRyxDQUFDTCxHQUFHLEdBQUdBLEdBQUc7RUFDZixDQUFDLENBQUM7QUFDSixDQUFDLEVBQ0Q7RUFDRVMsR0FBR0EsQ0FBeUI7SUFBRVQ7RUFBcUIsQ0FBQyxFQUFFO0lBQ3BELE9BQU8sT0FBT0EsR0FBRyxFQUFFO0VBQ3JCO0FBQ0YsQ0FDRixDQUFDO0FBQ0QsZUFBZUQsUUFBUSIsImlnbm9yZUxpc3QiOltdfQ==
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@data-client/img",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.21",
|
|
4
4
|
"description": "Suspenseful images",
|
|
5
5
|
"homepage": "https://dataclient.io/docs/guides/img-media#just-images",
|
|
6
6
|
"repository": {
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"README.md"
|
|
60
60
|
],
|
|
61
61
|
"scripts": {
|
|
62
|
-
"build:lib": "NODE_ENV=production BROWSERSLIST_ENV=2019 yarn g:babel --out-dir lib",
|
|
62
|
+
"build:lib": "NODE_ENV=production BROWSERSLIST_ENV='2019' POLYFILL_TARGETS='chrome>88,safari>14' yarn g:babel --out-dir lib",
|
|
63
63
|
"build:js:node": "BROWSERSLIST_ENV=node16 yarn g:rollup",
|
|
64
64
|
"build:js:browser": "BROWSERSLIST_ENV=legacy yarn g:rollup",
|
|
65
65
|
"build:bundle": "yarn g:runs build:js:\\* && echo '{\"type\":\"commonjs\"}' > dist/package.json",
|
|
@@ -74,9 +74,8 @@
|
|
|
74
74
|
"funding": "https://github.com/sponsors/ntucker",
|
|
75
75
|
"license": "Apache-2.0",
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@babel/runtime
|
|
78
|
-
"@data-client/endpoint": "^0.14.
|
|
79
|
-
"core-js-pure": "^3.40.0"
|
|
77
|
+
"@babel/runtime": "^7.20.0",
|
|
78
|
+
"@data-client/endpoint": "^0.14.21"
|
|
80
79
|
},
|
|
81
80
|
"peerDependencies": {
|
|
82
81
|
"@data-client/react": "^0.1.0 || ^0.2.0 || ^0.3.0 || ^0.4.0 || ^0.5.0 || ^0.7.0 || ^0.8.0 || ^0.9.0 || ^0.10.0 || ^0.11.0 || ^0.12.0 || ^0.13.0 || ^0.14.0",
|