Socket
Socket
Sign inDemoInstall

@loaders.gl/images

Package Overview
Dependencies
Maintainers
10
Versions
321
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/images - npm Package Compare versions

Comparing version 1.1.6 to 1.1.7

15

dist/dist.js

@@ -100,5 +100,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

/***/ "../../node_modules/process/browser.js":
/*!*************************************************************************!*\
!*** /Users/missx/Documents/loaders.gl/node_modules/process/browser.js ***!
\*************************************************************************/
/*!**********************************************************************************!*\
!*** /Users/twojtasz/projects/github/loaders.gl/node_modules/process/browser.js ***!
\**********************************************************************************/
/*! no static exports found */

@@ -681,4 +681,9 @@ /***/ (function(module, exports) {

function isJpeg(dataView) {
// Check file contains the JPEG "start of image" (SOI) marker.
return dataView.byteLength >= 2 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8;
// Check file contains the JPEG "start of image" (SOI) marker
// followed by another marker.
return (
dataView.byteLength >= 3 &&
dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 &&
dataView.getUint8(2, BIG_ENDIAN) === 0xff
);
}

@@ -685,0 +690,0 @@

@@ -1,1 +0,1 @@

!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";(function(e,r){n.d(t,"a",function(){return i});"object"!=typeof e||"[object process]"!==String(e)||e.browser;const o={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==r&&r},i=o.global||o.self||o.window}).call(this,n(3),n(1))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){const r=n(4),o="undefined"==typeof window?t:window;o.loaders=o.loaders||{},e.exports=Object.assign(o.loaders,r)}).call(this,n(1))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,s=[],f=!1,l=-1;function d(){f&&c&&(f=!1,c.length?s=c.concat(s):l=-1,s.length&&g())}function g(){if(!f){var e=u(d);f=!0;for(var t=s.length;t;){for(c=s,s=[];++l<t;)c&&c[l].run();l=-1,t=s.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new p(e,t)),1!==s.length||f||u(g)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t);var r=n(0);const o=!1,i=!0,a=new Map([["image/png",{test:function(e){return e.byteLength>=24&&2303741511===e.getUint32(0,o)},getSize:function(e){return{width:e.getUint32(16,o),height:e.getUint32(20,o)}}}],["image/jpeg",{test:function(e){return e.byteLength>=2&&65496===e.getUint16(0,o)},getSize:function(e){if(e.byteLength<2||65496!==e.getUint16(0,o))return null;const{tableMarkers:t,sofMarkers:n}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r<e.byteLength;){const i=e.getUint16(r,o);if(n.has(i))return{height:e.getUint16(r+5,o),width:e.getUint16(r+7,o)};if(!t.has(i))return null;r+=2,r+=e.getUint16(r,o)}return null}}],["image/gif",{test:function(e){return e.byteLength>=10&&1195984440===e.getUint32(0,o)},getSize:function(e){return{width:e.getUint16(6,i),height:e.getUint16(8,i)}}}],["image/bmp",{test:function(e){return e.byteLength>=2&&16973===e.getUint16(0,o)},getSize:function(e){return{width:e.getUint32(18,i),height:e.getUint32(22,i)}}}]]);const u=`Invalid MIME type. Supported MIME types are: ${Array.from(a.keys()).join(", ")}`;function c(e,t){if(t){const{test:n}=d(t);return n(g(e))}return Boolean(s(e))}function s(e){const t=g(e);for(const[e,{test:n}]of a.entries())if(n(t))return e;return null}function f(e,t=null){t=t||s(e);const{getSize:n}=d(t),r=n(g(e));if(!r)throw new Error(`invalid image data for type: ${t}`);return r}function l(e,t=null){const n=f(e,t=t||s(e));return n.mimeType=t,n}function d(e){const t=a.get(e);if(!t)throw new Error(u);return t}function g(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return new DataView(e.buffer||e);throw new Error("toDataView")}const p=r.a._parseImageNode||"undefined"!=typeof ImageBitmap;function m(e,t){if(r.a._parseImageNode){const{mimeType:n}=l(e);return r.a._parseImageNode(e,n,t)}return h(e)}async function w(e,t){if("undefined"==typeof Image){const n=await fetch(e,t);return m(await n.arrayBuffer())}return await y(e,t)}function h(e){if("undefined"==typeof createImageBitmap)throw new Error("parseImage");const t=new Blob([new Uint8Array(e)]);return createImageBitmap(t)}async function y(e,t){let n;if(/\.svg((\?|#).*)?$/.test(e)){const r=await fetch(e,t),o=await r.text();n=`data:image/svg+xml;base64,${btoa(o)}`}else n=await e;return await new Promise((r,o)=>{try{const i=new Image;i.onload=()=>r(i),i.onerror=t=>o(new Error(`Could not load image ${e}: ${t}`)),i.crossOrigin=t&&t.crossOrigin||"anonymous",i.src=n}catch(e){o(e)}})}const b=["png","jpg","jpeg","gif","webp","bmp","ico","svg"];var v={name:"Images",extensions:b,parse:p&&m,loadAndParse:!p&&w};const I={extensions:b,parse:h},T={extensions:b,loadAndParse:y};var j={name:"Images",extensions:["jpeg"],encode:function(e,t){if(r.a._encodeImageNode)return r.a._encodeImageNode(e,t);if(e instanceof HTMLCanvasElement)return e.toDataURL(t);!function(e,t){if(!e)throw new Error(t||"@loaders.gl/images assertion failed.")}(e instanceof Image,"getImageData accepts image or canvas");const n=document.createElement("canvas");n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0);const o=n.toDataURL(t||"png").replace(/^data:image\/(png|jpg);base64,/,"");return Promise.resolve(o)},DEFAULT_OPTIONS:{type:"png"}};function L(e,{mimeType:t="image/jpeg"}){const n=new Blob([e],{type:t}),r=(window.URL||window.webkitURL).createObjectURL(n);return new Promise((e,t)=>{const n=new Image;return n.onload=()=>e(n),n.onerror=t,n.src=r,n})}n.d(t,"ImageLoader",function(){return v}),n.d(t,"HTMLImageLoader",function(){return T}),n.d(t,"ImageBitmapLoader",function(){return I}),n.d(t,"ImageWriter",function(){return j}),n.d(t,"loadImage",function(){return w}),n.d(t,"isImage",function(){return c}),n.d(t,"getImageMetadata",function(){return l}),n.d(t,"getImageMIMEType",function(){return s}),n.d(t,"getImageSize",function(){return f}),n.d(t,"decodeImage",function(){return L})}])});
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t,n){"use strict";(function(e,r){n.d(t,"a",function(){return i});"object"!=typeof e||"[object process]"!==String(e)||e.browser;const o={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==r&&r},i=o.global||o.self||o.window}).call(this,n(3),n(1))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){(function(t){const r=n(4),o="undefined"==typeof window?t:window;o.loaders=o.loaders||{},e.exports=Object.assign(o.loaders,r)}).call(this,n(1))},function(e,t){var n,r,o=e.exports={};function i(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(e){n=i}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,s=[],f=!1,l=-1;function d(){f&&c&&(f=!1,c.length?s=c.concat(s):l=-1,s.length&&g())}function g(){if(!f){var e=u(d);f=!0;for(var t=s.length;t;){for(c=s,s=[];++l<t;)c&&c[l].run();l=-1,t=s.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function m(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];s.push(new p(e,t)),1!==s.length||f||u(g)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t);var r=n(0);const o=!1,i=!0,a=new Map([["image/png",{test:function(e){return e.byteLength>=24&&2303741511===e.getUint32(0,o)},getSize:function(e){return{width:e.getUint32(16,o),height:e.getUint32(20,o)}}}],["image/jpeg",{test:function(e){return e.byteLength>=3&&65496===e.getUint16(0,o)&&255===e.getUint8(2,o)},getSize:function(e){if(e.byteLength<2||65496!==e.getUint16(0,o))return null;const{tableMarkers:t,sofMarkers:n}=function(){const e=new Set([65499,65476,65484,65501,65534]);for(let t=65504;t<65520;++t)e.add(t);const t=new Set([65472,65473,65474,65475,65477,65478,65479,65481,65482,65483,65485,65486,65487,65502]);return{tableMarkers:e,sofMarkers:t}}();let r=2;for(;r<e.byteLength;){const i=e.getUint16(r,o);if(n.has(i))return{height:e.getUint16(r+5,o),width:e.getUint16(r+7,o)};if(!t.has(i))return null;r+=2,r+=e.getUint16(r,o)}return null}}],["image/gif",{test:function(e){return e.byteLength>=10&&1195984440===e.getUint32(0,o)},getSize:function(e){return{width:e.getUint16(6,i),height:e.getUint16(8,i)}}}],["image/bmp",{test:function(e){return e.byteLength>=2&&16973===e.getUint16(0,o)},getSize:function(e){return{width:e.getUint32(18,i),height:e.getUint32(22,i)}}}]]);const u=`Invalid MIME type. Supported MIME types are: ${Array.from(a.keys()).join(", ")}`;function c(e,t){if(t){const{test:n}=d(t);return n(g(e))}return Boolean(s(e))}function s(e){const t=g(e);for(const[e,{test:n}]of a.entries())if(n(t))return e;return null}function f(e,t=null){t=t||s(e);const{getSize:n}=d(t),r=n(g(e));if(!r)throw new Error(`invalid image data for type: ${t}`);return r}function l(e,t=null){const n=f(e,t=t||s(e));return n.mimeType=t,n}function d(e){const t=a.get(e);if(!t)throw new Error(u);return t}function g(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return new DataView(e.buffer||e);throw new Error("toDataView")}const p=r.a._parseImageNode||"undefined"!=typeof ImageBitmap;function m(e,t){if(r.a._parseImageNode){const{mimeType:n}=l(e);return r.a._parseImageNode(e,n,t)}return h(e)}async function w(e,t){if("undefined"==typeof Image){const n=await fetch(e,t);return m(await n.arrayBuffer())}return await y(e,t)}function h(e){if("undefined"==typeof createImageBitmap)throw new Error("parseImage");const t=new Blob([new Uint8Array(e)]);return createImageBitmap(t)}async function y(e,t){let n;if(/\.svg((\?|#).*)?$/.test(e)){const r=await fetch(e,t),o=await r.text();n=`data:image/svg+xml;base64,${btoa(o)}`}else n=await e;return await new Promise((r,o)=>{try{const i=new Image;i.onload=()=>r(i),i.onerror=t=>o(new Error(`Could not load image ${e}: ${t}`)),i.crossOrigin=t&&t.crossOrigin||"anonymous",i.src=n}catch(e){o(e)}})}const b=["png","jpg","jpeg","gif","webp","bmp","ico","svg"];var v={name:"Images",extensions:b,parse:p&&m,loadAndParse:!p&&w};const I={extensions:b,parse:h},T={extensions:b,loadAndParse:y};var U={name:"Images",extensions:["jpeg"],encode:function(e,t){if(r.a._encodeImageNode)return r.a._encodeImageNode(e,t);if(e instanceof HTMLCanvasElement)return e.toDataURL(t);!function(e,t){if(!e)throw new Error(t||"@loaders.gl/images assertion failed.")}(e instanceof Image,"getImageData accepts image or canvas");const n=document.createElement("canvas");n.width=e.width,n.height=e.height,n.getContext("2d").drawImage(e,0,0);const o=n.toDataURL(t||"png").replace(/^data:image\/(png|jpg);base64,/,"");return Promise.resolve(o)},DEFAULT_OPTIONS:{type:"png"}};function j(e,{mimeType:t="image/jpeg"}){const n=new Blob([e],{type:t}),r=(window.URL||window.webkitURL).createObjectURL(n);return new Promise((e,t)=>{const n=new Image;return n.onload=()=>e(n),n.onerror=t,n.src=r,n})}n.d(t,"ImageLoader",function(){return v}),n.d(t,"HTMLImageLoader",function(){return T}),n.d(t,"ImageBitmapLoader",function(){return I}),n.d(t,"ImageWriter",function(){return U}),n.d(t,"loadImage",function(){return w}),n.d(t,"isImage",function(){return c}),n.d(t,"getImageMetadata",function(){return l}),n.d(t,"getImageMIMEType",function(){return s}),n.d(t,"getImageSize",function(){return f}),n.d(t,"decodeImage",function(){return j})}])});

@@ -58,3 +58,3 @@ "use strict";

function isJpeg(dataView) {
return dataView.byteLength >= 2 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8;
return dataView.byteLength >= 3 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 && dataView.getUint8(2, BIG_ENDIAN) === 0xff;
}

@@ -61,0 +61,0 @@

@@ -51,3 +51,3 @@ const BIG_ENDIAN = false;

function isJpeg(dataView) {
return dataView.byteLength >= 2 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8;
return dataView.byteLength >= 3 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 && dataView.getUint8(2, BIG_ENDIAN) === 0xff;
}

@@ -54,0 +54,0 @@

@@ -51,3 +51,3 @@ var BIG_ENDIAN = false;

function isJpeg(dataView) {
return dataView.byteLength >= 2 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8;
return dataView.byteLength >= 3 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 && dataView.getUint8(2, BIG_ENDIAN) === 0xff;
}

@@ -54,0 +54,0 @@

{
"name": "@loaders.gl/images",
"version": "1.1.6",
"version": "1.1.7",
"description": "Framework-independent loaders and writers for images (PNG, JPG, ...)",

@@ -34,3 +34,3 @@ "license": "MIT",

},
"gitHead": "c57a33eed0a20d05ec73ac520e2df4681bddb676"
"gitHead": "06bf90313a901e8ff8adcee1bbef1d6fffa8a15d"
}

@@ -62,4 +62,9 @@ const BIG_ENDIAN = false;

function isJpeg(dataView) {
// Check file contains the JPEG "start of image" (SOI) marker.
return dataView.byteLength >= 2 && dataView.getUint16(0, BIG_ENDIAN) === 0xffd8;
// Check file contains the JPEG "start of image" (SOI) marker
// followed by another marker.
return (
dataView.byteLength >= 3 &&
dataView.getUint16(0, BIG_ENDIAN) === 0xffd8 &&
dataView.getUint8(2, BIG_ENDIAN) === 0xff
);
}

@@ -66,0 +71,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc