Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@loaders.gl/core

Package Overview
Dependencies
Maintainers
9
Versions
337
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@loaders.gl/core - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0-alpha.1

dist/es5/lib/fetch/read-file-browser.js

2

dist/dist.min.js

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

!function(n,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var r=e();for(var t in r)("object"==typeof exports?exports:n)[t]=r[t]}}(window,function(){return function(n){var e={};function r(t){if(e[t])return e[t].exports;var o=e[t]={i:t,l:!1,exports:{}};return n[t].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=n,r.c=e,r.d=function(n,e,t){r.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},r.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},r.t=function(n,e){if(1&e&&(n=r(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var t=Object.create(null);if(r.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)r.d(t,o,function(e){return n[e]}.bind(null,o));return t},r.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return r.d(e,"a",e),e},r.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},r.p="",r(r.s=5)}([function(n,e,r){"use strict";(function(n,t){r.d(e,"c",function(){return o}),r.d(e,"d",function(){return u}),r.d(e,"e",function(){return c}),r.d(e,"b",function(){return f}),r.d(e,"a",function(){return a});const o="object"!=typeof n||"[object process]"!==String(n)||n.browser,i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},u=i.self||i.window||i.global,c=i.window||i.self||i.global,f=i.global||i.self||i.window,a=i.document||{}}).call(this,r(6),r(4))},function(n,e){"undefined"==typeof TextDecoder?n.exports={}:n.exports={TextEncoder:TextEncoder,TextDecoder:TextDecoder}},function(n,e){},function(n,e){},function(n,e){var r;r=function(){return this}();try{r=r||new Function("return this")()}catch(n){"object"==typeof window&&(r=window)}n.exports=r},function(n,e,r){(function(e){const t=r(7),o="undefined"==typeof window?e:window;o.loaders=o.loaders||{},n.exports=Object.assign(o.loaders,t)}).call(this,r(4))},function(n,e){var r,t,o=n.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(n){if(r===setTimeout)return setTimeout(n,0);if((r===i||!r)&&setTimeout)return r=setTimeout,setTimeout(n,0);try{return r(n,0)}catch(e){try{return r.call(null,n,0)}catch(e){return r.call(this,n,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:i}catch(n){r=i}try{t="function"==typeof clearTimeout?clearTimeout:u}catch(n){t=u}}();var f,a=[],s=!1,d=-1;function l(){s&&f&&(s=!1,f.length?a=f.concat(a):d=-1,a.length&&y())}function y(){if(!s){var n=c(l);s=!0;for(var e=a.length;e;){for(f=a,a=[];++d<e;)f&&f[d].run();d=-1,e=a.length}f=null,s=!1,function(n){if(t===clearTimeout)return clearTimeout(n);if((t===u||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(n);try{t(n)}catch(e){try{return t.call(null,n)}catch(e){return t.call(this,n)}}}(n)}}function p(n,e){this.fun=n,this.array=e}function w(){}o.nextTick=function(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];a.push(new p(n,e)),1!==a.length||s||c(y)},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=w,o.addListener=w,o.once=w,o.off=w,o.removeListener=w,o.removeAllListeners=w,o.emit=w,o.prependListener=w,o.prependOnceListener=w,o.listeners=function(n){return[]},o.binding=function(n){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(n){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(n,e,r){"use strict";r.r(e);let t="";const o={};function i(n){t=n}function u(){return t}function c(n){for(const e in o)if(n.startsWith(e)){const r=o[e];return n.replace(e,r)}return n+=t}var f=r(0),a=r(2);function s(n,e){if(!n)throw new Error(e||"loader assertion failed.")}const d={dataType:"arrayBuffer",nothrow:!0},l=n=>n.startsWith("data:");async function y(n,e){return await fetch(n,e)}function p(n,e={}){return e=function(n={}){return(n=Object.assign({},d,n)).responseType=n.responseType||n.dataType,n}(e),l(n),e.nothrow||s(!1),null}async function w(n,e){return fetch(n,e).then(n=>n.body)}async function b(n,e){return n=c(n),(f.c?y:a.fetchFile)(n,e)}function h(n,e={}){return n=c(n),(f.c?p:a.readFileSync)(n,e)}async function A(n,e){return n=c(n),(f.c?w:a.createReadStream)(n,e)}var g=r(3);function m(n,e,r){return f.c?s(!1):g.writeFile(n,e,r)}function x(n,e,r){return f.c?s(!1):g.writeFileSync(n,e,r)}function T(n){if(!n)return!1;return Array.isArray(n)&&(n=n[0]),n.parseTextSync||n.parseSync||n.parse||n.loadAndParse||n.parseStream||n.parseInBatches||n.worker}function S(n){let e;return s(T(n)),Array.isArray(n)&&(e=(n=n[0])[1],n={...n,options:{...n.options,options:e}}),n.extension&&(n.extensions=n.extensions||[n.extension],delete n.extension),Array.isArray(n.extensions)||(n.extensions=[n.extensions]),s(n.extensions&&n.extensions.length>0&&n.extensions[0]),n.parseTextSync&&(n.text=!0),n.text||(n.binary=!0),n}const B={};function v(n){n=Array.isArray(n)?n:[n];for(const e of n){S(e);for(const n of e.extensions)B[n]=e}}function E(){return Object.values(B)}const j=/[^\.]+$/;function I(n="",e,r){const t=n.match(j);if(t&&t[0]){const n=function(n,e){e=e.toLowerCase();for(const r of n){S(r);for(const n of r.extensions)if(n.toLowerCase()===e)return r}return null}(r,t[0]);if(n)return n}const o=function(n,e){for(const r of n)if(r.testText&&r.testText(e))return r;return null}(r,e);return o||null}class L{log(){}info(){}warn(){}error(){}}var P=r(1);const F=n=>n&&n instanceof ArrayBuffer,O=n=>n&&"undefined"!=typeof Blob&&n instanceof Blob,D=n=>n&&n instanceof Buffer;function R(n){if(F(n))return n;if(D(n)){return new Uint8Array(n).buffer}if(ArrayBuffer.isView(n))return n.buffer;if("string"==typeof n){const e=n;return(new P.TextEncoder).encode(e).buffer}return s(!1)}function U(n){return new Promise((e,r)=>{let t;const o=new FileReader;o.onload=(n=>{t=n.target.result}),o.onloadend=(n=>e(t)),o.onerror=r,o.readAsArrayBuffer(n)})}function _(n){return new DataView(R(n))}const M=new Map;function V(n,e,r){const t=function(n){let e=M.get(n);if(!e){const r=new Blob([n],{type:"application/javascript"});e=URL.createObjectURL(r),M.set(n,e)}return new Worker(e)}(n);r=function(n){null!==(n=Object.assign({},n)).log&&delete n.log;return n}(r);const o=(n,e)=>new Promise((r,o)=>{t.onmessage=(n=>{switch(n.data.type){case"done":r(n.data.result),t.terminate();break;case"error":o(new Error(n.data.message))}});const i=R(n);t.postMessage({arraybuffer:i,opts:e},[i])});return e?o(e,r):o}const k=n=>"boolean"==typeof n,W=n=>"function"==typeof n,C=n=>null!==n&&"object"==typeof n,N=n=>C(n)&&W(n.then),$=n=>n&&"function"==typeof n[Symbol.iterator],z=n=>n&&"function"==typeof n[Symbol.asyncIterator],Y=n=>C(n)&&"done"in n&&"value"in n,q=n=>"undefined"!=typeof window&&n instanceof window.Response||n.arrayBuffer&&n.json&&n.body,G=n=>(n=>C(n)&&W(n.tee)&&W(n.cancel)&&W(n.pipeTo)&&W(n.getReader))(n)||(n=>C(n)&&W(n.read)&&W(n.pipe)&&k(n.readable))(n),H=n=>(n=>C(n)&&W(n.abort)&&W(n.getWriter))(n)||(n=>C(n)&&W(n.end)&&W(n.write)&&k(n.writable))(n);function J(n){return n+3&-4}function K(n,e,r,t=e.byteLength){const o=new Uint8Array(n,r,t),i=new Uint8Array(e);return o.set(i),n}function Q(n,e,r){let t;if(n instanceof ArrayBuffer)t=new Uint8Array(n);else{const e=n.byteOffset,r=n.byteLength;t=new Uint8Array(n.buffer,e,r)}return e.set(t,r),r+J(t.byteLength)}function X(n,e){const r=n instanceof ArrayBuffer?new Uint8Array(n):n,t=e instanceof ArrayBuffer?new Uint8Array(e):e,o=new Uint8Array(r.byteLength+t.byteLength);return o.set(r,0),o.set(t,r.byteLength),o}function Z(n){return"function"==typeof n[Symbol.asyncIterator]?n:"function"==typeof n.getIterator?n.getIterator():f.c?async function*(n){const e=n.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)return;yield r}}finally{e.releaseLock()}}(n):async function*(n){n=await n;for(;;){const e=n.read();if(null===e){if(n._readableState.ended)return;await nn(n)}else yield e}}(n)}async function nn(n){return new Promise(e=>{n.once("readable",e)})}const en="Cannot convert supplied data type";function rn(n,e){if(e.text&&"string"==typeof n)return n;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n)){const r=n.buffer||n;if(e.text&&!e.binary){return new P.TextDecoder("utf8").decode(r)}return r}throw new Error(en)}async function tn(n,e){if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return function*(){yield n.buffer||n}();if(Y(n))return n;if($(n))return n[Symbol.iterator]();throw new Error(en)}async function on(n,e,r={},t){return t=t||function(n){return q(n)?n.url:null}(n),n=await async function(n,e){const r=(n=await n)instanceof ArrayBuffer||ArrayBuffer.isView(n);if("string"==typeof n||r)return rn(n,e);if(q(n))return e.binary?await n.arrayBuffer():n.text();throw new Error(en)}(n,e),e.parseTextSync&&"string"==typeof n?(r.dataType="text",e.parseTextSync(n,r,t,e)):e.parseSync?e.parseSync(n,r,t,e):e.parse?await e.parse(n,r,t,e):e.worker?await V(e.worker,n,r):s(!1)}async function un(n,e,r={},t){if(e.parseInBatches){const o=await async function(n,e){return Y(n)?n:q(n)?Z(n.body):G(n)?Z(n):z(n)?n[Symbol.asyncIterator]():tn(n)}(n);return e.parseInBatches(o,r,t,e)}return null}async function cn(n,e,r,t){Array.isArray(e)||T(e)||(t=r,r=e,e=null),e=e||E();const o=Array.isArray(e)?I(t,n,e):e;return o?(S(o),r=dn(r,o),await on(n,o,r,t)):null}function fn(n,e,r,t){Array.isArray(e)||T(e)||(t=r,r=e,e=null),e=e||E();const o=Array.isArray(e)?I(t,n,e):e;return S(o),function(n,e,r={},t){return n=rn(n,e),e.parseTextSync&&"string"==typeof n?e.parseTextSync(n,r,t,e):e.parseSync?e.parseSync(n,r,t,e):s(!1)}(n,o,r=dn(r,o),t)}async function an(n,e,r,t){Array.isArray(e)||T(e)||(t=r,r=e,e=null),e=e||E();const o=Array.isArray(e)?I(t,null,e):e;return S(o),un(n,o,r=dn(r,o),t)}async function sn(n,e,r,t){Array.isArray(e)||T(e)||(t=r,r=e,e=null),e=e||E();const o=Array.isArray(e)?I(t,null,e):e;return S(o),un(n,o,r=dn(r,o),t)}function dn(n,e){return null===(n=Object.assign({},e.DEFAULT_OPTIONS,e.options,n,{dataType:"arraybuffer"})).log&&(n.log=new L),"log"in n||(n.log=console),n}async function ln(n,e,r){return an(await b(n,r),e,r,n)}async function yn(n,e,r){Array.isArray(e)||T(e)||(r=e,e=null),e=e||E();const t=Array.isArray(e)?I(n,null,e):e;return t&&t.loadAndParse?await t.loadAndParse(n,r):cn(await b(n,r),e,r,n)}function pn(n,e,r,t){if(e.encode)return e.encode(n,r);if(e.encodeSync)return Promise.resolve(e.encodeSync(n,r));throw new Error("Writer could not encode data")}function wn(n,e,r,t){if(e.encodeSync)return e.encodeSync(n,r);throw new Error("Writer could not synchronously encode data")}function bn(n,e,r,t){if(e.encodeInBatches)return e.encodeInBatches(n,r);throw new Error("Writer could not encode data in batches")}function hn(n,e,r){return m(e,pn(n,r,e))}function An(n,e,r){return x(e,wn(n,r,e))}function gn(n,e=Float32Array){if(0===n.length)return new Float32Array(0);if(!function n(e,r=Number.isFinite){let t=-1;for(;++t<e.length;){const o=e[t];if(Array.isArray(o)||ArrayBuffer.isView(o)){if(!n(o,r))return!1}else if(!r(o))return!1}return!0}(n))return null;const r=new e(function n(e,r=3){let t=0;let o=0;let i=-1;for(;++i<e.length;){const r=e[i];Array.isArray(r)||ArrayBuffer.isView(r)?t+=n(r):o++}return t+(0===t&&o<r?r:o)}(n));return function(n,e,r=3){(function n(e,r,t,o){let i=-1,u=0;for(;++i<e.length;){const c=e[i];Array.isArray(c)||ArrayBuffer.isView(c)?o=n(c,r,t,o):u<t&&(r[o++]=c,u++)}return u>0&&u<t&&(r[o++]=0),o})(n,e,r,0)}(n,r),r}async function mn(n,e){for(;;){const{done:r,value:t}=await n.next();if(r)return void n.return();if(e(t))return}}async function xn(n){let e=new ArrayBuffer,r="";for await(const t of n)"string"==typeof t?r+=t:e=X(e,t);return e||r}async function*Tn(n,e){const r=new P.TextDecoder(e);for await(const e of n)yield"string"==typeof e?e:r.decode(e,{stream:!0})}async function*Sn(n){let e="";for await(const r of n){let n;for(e+=r;(n=e.indexOf("\n"))>=0;){const r=e.slice(0,n+1);e=e.slice(n+1),yield r}}e.length>0&&(yield e)}async function*Bn(n){let e=1;for await(const r of n)yield{counter:e,line:r},e++}function vn(n){"undefined"!=typeof self&&(self.onmessage=(e=>{const{arraybuffer:r,opts:t}=e.data;try{let e,o;if(n.parseSync)e=r,o=n.parseSync;else{if(!n.parseTextSync)throw new Error(`Could not load data with ${n.name} loader`);e=(new TextDecoder).decode(r),o=n.parseTextSync}const i=o(e,t),u=function n(e,r=!0,t){const o=t||new Set;if(e)if(e instanceof ArrayBuffer)o.add(e);else if(e.buffer&&e.buffer instanceof ArrayBuffer)o.add(e.buffer);else if(r&&"object"==typeof e)for(const t in e)n(e[t],r,o);return void 0===t?Array.from(o):null}(i);self.postMessage({type:"done",result:i},u)}catch(n){self.postMessage({type:"error",message:n.message})}}))}function En(n){let e=0;for(const r in n){const t=n[r];ArrayBuffer.isView(t)&&(e+=t.length*t.BYTES_PER_ELEMENT)}return e}function jn(...n){return console.warn("parse() deprecated, use parse()"),cn(...n)}function In(...n){return console.warn("parseSync() deprecated, use parseSync()"),fn(...n)}function Ln(...n){return console.warn("loadFile() deprecated, use load()"),yn(...n)}r.d(e,"parseFile",function(){return jn}),r.d(e,"parseFileSync",function(){return In}),r.d(e,"loadFile",function(){return Ln}),r.d(e,"setPathPrefix",function(){return i}),r.d(e,"getPathPrefix",function(){return u}),r.d(e,"resolvePath",function(){return c}),r.d(e,"fetchFile",function(){return b}),r.d(e,"readFileSync",function(){return h}),r.d(e,"writeFile",function(){return m}),r.d(e,"writeFileSync",function(){return x}),r.d(e,"registerLoaders",function(){return v}),r.d(e,"parse",function(){return cn}),r.d(e,"parseSync",function(){return fn}),r.d(e,"parseInBatches",function(){return an}),r.d(e,"parseInBatchesSync",function(){return sn}),r.d(e,"load",function(){return yn}),r.d(e,"loadInBatches",function(){return ln}),r.d(e,"encode",function(){return pn}),r.d(e,"encodeSync",function(){return wn}),r.d(e,"encodeInBatches",function(){return bn}),r.d(e,"save",function(){return hn}),r.d(e,"saveSync",function(){return An}),r.d(e,"isPromise",function(){return N}),r.d(e,"isIterable",function(){return $}),r.d(e,"isAsyncIterable",function(){return z}),r.d(e,"isIterator",function(){return Y}),r.d(e,"isFetchResponse",function(){return q}),r.d(e,"isReadableStream",function(){return G}),r.d(e,"isWritableStream",function(){return H}),r.d(e,"isArrayBuffer",function(){return F}),r.d(e,"isBlob",function(){return O}),r.d(e,"toArrayBuffer",function(){return R}),r.d(e,"blobToArrayBuffer",function(){return U}),r.d(e,"toDataView",function(){return _}),r.d(e,"padTo4Bytes",function(){return J}),r.d(e,"copyToArray",function(){return Q}),r.d(e,"copyArrayBuffer",function(){return K}),r.d(e,"flattenToTypedArray",function(){return gn}),r.d(e,"TextDecoder",function(){return P.TextDecoder}),r.d(e,"TextEncoder",function(){return P.TextEncoder}),r.d(e,"getStreamIterator",function(){return Z}),r.d(e,"forEach",function(){return mn}),r.d(e,"concatenateAsyncIterator",function(){return xn}),r.d(e,"lineAsyncIterator",function(){return Sn}),r.d(e,"textDecoderAsyncIterator",function(){return Tn}),r.d(e,"numberedLineAsyncIterator",function(){return Bn}),r.d(e,"createWorker",function(){return vn}),r.d(e,"isBrowser",function(){return f.c}),r.d(e,"self",function(){return f.d}),r.d(e,"window",function(){return f.e}),r.d(e,"global",function(){return f.b}),r.d(e,"document",function(){return f.a}),r.d(e,"assert",function(){return s}),r.d(e,"_getMeshSize",function(){return En}),r.d(e,"createReadStream",function(){return A})}])});
!function(n,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t=e();for(var r in t)("object"==typeof exports?exports:n)[r]=t[r]}}(window,function(){return function(n){var e={};function t(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return n[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var o in n)t.d(r,o,function(e){return n[e]}.bind(null,o));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=4)}([function(n,e,t){"use strict";(function(n,r){t.d(e,"c",function(){return o}),t.d(e,"d",function(){return u}),t.d(e,"e",function(){return c}),t.d(e,"b",function(){return a}),t.d(e,"a",function(){return f});const o="object"!=typeof n||"[object process]"!==String(n)||n.browser,i={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==r&&r,document:"undefined"!=typeof document&&document},u=i.self||i.window||i.global,c=i.window||i.self||i.global,a=i.global||i.self||i.window,f=i.document||{}}).call(this,t(5),t(3))},function(n,e){},function(n,e){},function(n,e){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(n){"object"==typeof window&&(t=window)}n.exports=t},function(n,e,t){(function(e){const r=t(6),o="undefined"==typeof window?e:window;o.loaders=o.loaders||{},n.exports=Object.assign(o.loaders,r)}).call(this,t(3))},function(n,e){var t,r,o=n.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(n){if(t===setTimeout)return setTimeout(n,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(n,0);try{return t(n,0)}catch(e){try{return t.call(null,n,0)}catch(e){return t.call(this,n,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(n){t=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(n){r=u}}();var a,f=[],s=!1,d=-1;function l(){s&&a&&(s=!1,a.length?f=a.concat(f):d=-1,f.length&&y())}function y(){if(!s){var n=c(l);s=!0;for(var e=f.length;e;){for(a=f,f=[];++d<e;)a&&a[d].run();d=-1,e=f.length}a=null,s=!1,function(n){if(r===clearTimeout)return clearTimeout(n);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(n);try{r(n)}catch(e){try{return r.call(null,n)}catch(e){return r.call(this,n)}}}(n)}}function p(n,e){this.fun=n,this.array=e}function w(){}o.nextTick=function(n){var e=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)e[t-1]=arguments[t];f.push(new p(n,e)),1!==f.length||s||c(y)},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=w,o.addListener=w,o.once=w,o.off=w,o.removeListener=w,o.removeAllListeners=w,o.emit=w,o.prependListener=w,o.prependOnceListener=w,o.listeners=function(n){return[]},o.binding=function(n){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(n){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(n,e,t){"use strict";function r(n,e){if(!n)throw new Error(e||"loader assertion failed.")}function o(n){if(!n)return!1;return Array.isArray(n)&&(n=n[0]),n.parseTextSync||n.parseSync||n.parse||n.loadAndParse||n.parseStream||n.parseInBatches||n.worker}function i(n){let e;return r(o(n)),Array.isArray(n)&&(e=(n=n[0])[1],n={...n,options:{...n.options,options:e}}),n.extension&&(n.extensions=n.extensions||[n.extension],delete n.extension),Array.isArray(n.extensions)||(n.extensions=[n.extensions]),r(n.extensions&&n.extensions.length>0&&n.extensions[0]),n.parseTextSync&&(n.text=!0),n.text||(n.binary=!0),n}t.r(e);const u=/[^.]+$/;function c(n="",e,t){const r=n.match(u);if(r&&r[0]){const n=function(n,e){e=e.toLowerCase();for(const t of n){i(t);for(const n of t.extensions)if(n.toLowerCase()===e)return t}return null}(t,r[0]);if(n)return n}const o=function(n,e){for(const t of n)if(t.testText&&t.testText(e))return t;return null}(t,e);return o||null}class a{log(){}info(){}warn(){}error(){}}const f={};function s(n){n=Array.isArray(n)?n:[n];for(const e of n){i(e);for(const n of e.extensions)f[n]=e}}function d(){return Object.values(f)}const l=n=>n&&n instanceof ArrayBuffer,y=n=>n&&"undefined"!=typeof Blob&&n instanceof Blob,p=n=>n&&n instanceof Buffer;function w(n){if(l(n))return n;if(p(n)){return new Uint8Array(n).buffer}if(ArrayBuffer.isView(n))return n.buffer;if("string"==typeof n){const e=n;return(new TextEncoder).encode(e).buffer}return r(!1)}function b(n){return new Promise((e,t)=>{let r;const o=new FileReader;o.onload=(n=>{r=n.target.result}),o.onloadend=(n=>e(r)),o.onerror=t,o.readAsArrayBuffer(n)})}function h(n){return new DataView(w(n))}const A=new Map;function g(n,e,t){const r=function(n){let e=A.get(n);if(!e){const t=new Blob([n],{type:"application/javascript"});e=URL.createObjectURL(t),A.set(n,e)}return new Worker(e)}(n);t=function(n){null!==(n=Object.assign({},n)).log&&delete n.log;return n}(t);const o=(n,e)=>new Promise((t,o)=>{r.onmessage=(n=>{switch(n.data.type){case"done":t(n.data.result),r.terminate();break;case"error":o(new Error(n.data.message))}});const i=w(n);r.postMessage({arraybuffer:i,opts:e},[i])});return e?o(e,t):o}const m=n=>"boolean"==typeof n,x=n=>"function"==typeof n,S=n=>null!==n&&"object"==typeof n,T=n=>S(n)&&x(n.then),v=n=>n&&"function"==typeof n[Symbol.iterator],B=n=>n&&"function"==typeof n[Symbol.asyncIterator],I=n=>S(n)&&"done"in n&&"value"in n,j=n=>"undefined"!=typeof window&&n instanceof window.Response||n.arrayBuffer&&n.json&&n.body,L=n=>(n=>S(n)&&x(n.tee)&&x(n.cancel)&&x(n.pipeTo)&&x(n.getReader))(n)||(n=>S(n)&&x(n.read)&&x(n.pipe)&&m(n.readable))(n),O=n=>(n=>S(n)&&x(n.abort)&&x(n.getWriter))(n)||(n=>S(n)&&x(n.end)&&x(n.write)&&m(n.writable))(n);var P=t(0);function F(n){return"function"==typeof n[Symbol.asyncIterator]?n:"function"==typeof n.getIterator?n.getIterator():P.c?async function*(n){const e=n.getReader();try{for(;;){const{done:n,value:t}=await e.read();if(n)return;yield t}}finally{e.releaseLock()}}(n):async function*(n){n=await n;for(;;){const e=n.read();if(null===e){if(n._readableState.ended)return;await E(n)}else yield e}}(n)}async function E(n){return new Promise(e=>{n.once("readable",e)})}const U="Cannot convert supplied data type";function R(n,e){if(e.text&&"string"==typeof n)return n;if(n instanceof ArrayBuffer||ArrayBuffer.isView(n)){const t=n.buffer||n;if(e.text&&!e.binary){return new TextDecoder("utf8").decode(t)}return t}throw new Error(U)}async function k(n,e){if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return function*(){yield n.buffer||n}();if(I(n))return n;if(v(n))return n[Symbol.iterator]();throw new Error(U)}async function D(n,e,t,o){return o=o||function(n){return j(n)?n.url:null}(n),n=await async function(n,e){const t=(n=await n)instanceof ArrayBuffer||ArrayBuffer.isView(n);if("string"==typeof n||t)return R(n,e);if(j(n))return e.binary?await n.arrayBuffer():n.text();throw new Error(U)}(n,e),e.parseTextSync&&"string"==typeof n?(t.dataType="text",e.parseTextSync(n,t,o,e)):e.parseSync?e.parseSync(n,t,o,e):e.parse?await e.parse(n,t,o,e):e.worker?await g(e.worker,n,t):r(!1)}async function W(n,e,t,r){if(e.parseInBatches){const o=await async function(n,e){return I(n)?n:j(n)?F(n.body):L(n)?F(n):B(n)?n[Symbol.asyncIterator]():k(n)}(n);return e.parseInBatches(o,t,r,e)}return null}async function _(n,e,t,r){Array.isArray(e)||o(e)||(r=t,t=e,e=null),e=e||d();const u=Array.isArray(e)?c(r,n,e):e;return u?(i(u),t=N(t,u),await D(n,u,t,r)):null}function M(n,e,t,u){Array.isArray(e)||o(e)||(u=t,t=e,e=null),e=e||d();const a=Array.isArray(e)?c(u,n,e):e;return i(a),function(n,e,t,o){return n=R(n,e),e.parseTextSync&&"string"==typeof n?e.parseTextSync(n,t,o,e):e.parseSync?e.parseSync(n,t,o,e):r(!1)}(n,a,t=N(t,a),u)}async function V(n,e,t,r){Array.isArray(e)||o(e)||(r=t,t=e,e=null),e=e||d();const u=Array.isArray(e)?c(r,null,e):e;return i(u),W(n,u,t=N(t,u),r)}async function C(n,e,t,r){Array.isArray(e)||o(e)||(r=t,t=e,e=null),e=e||d();const u=Array.isArray(e)?c(r,null,e):e;return i(u),W(n,u,t=N(t,u),r)}function N(n,e){return null===(n=Object.assign({},e.DEFAULT_OPTIONS,e.defaultOptions,e.options,n,{dataType:"arraybuffer"})).log&&(n.log=new a),"log"in n||(n.log=console),n}let $="";const q={};function z(n){$=n}function G(){return $}function H(n){for(const e in q)if(n.startsWith(e)){const t=q[e];return n.replace(e,t)}return n+=$}async function J(n,e){return n=H(n),fetch(n,e)}async function K(n,e,t){return V(await J(n,t),e,t,n)}async function Q(n,e,t){Array.isArray(e)||o(e)||(t=e,e=null),e=e||d();const r=Array.isArray(e)?c(n,null,e):e;if(r&&r.loadAndParse)return await r.loadAndParse(n,t);let i=n;return"string"==typeof i&&(i=await J(n,t)),_(i,e,t,n)}var X=t(2);const Y={dataType:"arrayBuffer",nothrow:!0},Z=n=>n.startsWith("data:");function nn(n={}){return(n=Object.assign({},Y,n)).responseType=n.responseType||n.dataType,n}function en(n,e={}){return n=H(n),!P.c&&X.readFileSync?X.readFileSync(n,e):function(n,e){return e=nn(e),Z(n),e.nothrow||r(!1),null}(n,e)}var tn=t(1);function rn(n,e,t){return n=H(n),!P.c&&tn.writeFile?tn.writeFile(n,e,t):r(!1)}function on(n,e,t){return n=H(n),!P.c&&tn.writeFileSync?tn.writeFileSync(n,e,t):r(!1)}function un(n,e,t,r){if(e.encode)return e.encode(n,t);if(e.encodeSync)return Promise.resolve(e.encodeSync(n,t));throw new Error("Writer could not encode data")}function cn(n,e,t,r){if(e.encodeSync)return e.encodeSync(n,t);throw new Error("Writer could not synchronously encode data")}function an(n,e,t,r){if(e.encodeInBatches)return e.encodeInBatches(n,t);throw new Error("Writer could not encode data in batches")}function fn(n,e,t,r){return rn(e,un(n,t,r))}function sn(n,e,t,r){return on(e,cn(n,t,r))}function dn(n){return n+3&-4}function ln(n,e,t,r=e.byteLength){const o=new Uint8Array(n,t,r),i=new Uint8Array(e);return o.set(i),n}function yn(n,e,t){let r;if(n instanceof ArrayBuffer)r=new Uint8Array(n);else{const e=n.byteOffset,t=n.byteLength;r=new Uint8Array(n.buffer,e,t)}return e.set(r,t),t+dn(r.byteLength)}function pn(n,e){const t=n instanceof ArrayBuffer?new Uint8Array(n):n,r=e instanceof ArrayBuffer?new Uint8Array(e):e,o=new Uint8Array(t.byteLength+r.byteLength);return o.set(t,0),o.set(r,t.byteLength),o}async function wn(n,e){for(;;){const{done:t,value:r}=await n.next();if(t)return void n.return();if(e(r))return}}async function bn(n){let e=new ArrayBuffer,t="";for await(const r of n)"string"==typeof r?t+=r:e=pn(e,r);return e||t}async function*hn(n,e){const t=new TextDecoder(e);for await(const e of n)yield"string"==typeof e?e:t.decode(e,{stream:!0})}async function*An(n){let e="";for await(const t of n){let n;for(e+=t;(n=e.indexOf("\n"))>=0;){const t=e.slice(0,n+1);e=e.slice(n+1),yield t}}e.length>0&&(yield e)}async function*gn(n){let e=1;for await(const t of n)yield{counter:e,line:t},e++}t.d(e,"TextEncoder",function(){return mn}),t.d(e,"TextDecoder",function(){return xn}),t.d(e,"createReadStream",function(){return Sn}),t.d(e,"parseFile",function(){return Tn}),t.d(e,"parseFileSync",function(){return vn}),t.d(e,"loadFile",function(){return Bn}),t.d(e,"setPathPrefix",function(){return z}),t.d(e,"getPathPrefix",function(){return G}),t.d(e,"resolvePath",function(){return H}),t.d(e,"fetchFile",function(){return J}),t.d(e,"readFileSync",function(){return en}),t.d(e,"writeFile",function(){return rn}),t.d(e,"writeFileSync",function(){return on}),t.d(e,"registerLoaders",function(){return s}),t.d(e,"parse",function(){return _}),t.d(e,"parseSync",function(){return M}),t.d(e,"parseInBatches",function(){return V}),t.d(e,"parseInBatchesSync",function(){return C}),t.d(e,"load",function(){return Q}),t.d(e,"loadInBatches",function(){return K}),t.d(e,"encode",function(){return un}),t.d(e,"encodeSync",function(){return cn}),t.d(e,"encodeInBatches",function(){return an}),t.d(e,"save",function(){return fn}),t.d(e,"saveSync",function(){return sn}),t.d(e,"isPromise",function(){return T}),t.d(e,"isIterable",function(){return v}),t.d(e,"isAsyncIterable",function(){return B}),t.d(e,"isIterator",function(){return I}),t.d(e,"isFetchResponse",function(){return j}),t.d(e,"isReadableStream",function(){return L}),t.d(e,"isWritableStream",function(){return O}),t.d(e,"isArrayBuffer",function(){return l}),t.d(e,"isBlob",function(){return y}),t.d(e,"toArrayBuffer",function(){return w}),t.d(e,"blobToArrayBuffer",function(){return b}),t.d(e,"toDataView",function(){return h}),t.d(e,"padTo4Bytes",function(){return dn}),t.d(e,"copyToArray",function(){return yn}),t.d(e,"copyArrayBuffer",function(){return ln}),t.d(e,"getStreamIterator",function(){return F}),t.d(e,"forEach",function(){return wn}),t.d(e,"concatenateAsyncIterator",function(){return bn}),t.d(e,"lineAsyncIterator",function(){return An}),t.d(e,"textDecoderAsyncIterator",function(){return hn}),t.d(e,"numberedLineAsyncIterator",function(){return gn}),t.d(e,"isBrowser",function(){return P.c}),t.d(e,"self",function(){return P.d}),t.d(e,"window",function(){return P.e}),t.d(e,"global",function(){return P.b}),t.d(e,"document",function(){return P.a}),t.d(e,"assert",function(){return r});const mn=P.b.TextEncoder,xn=P.b.TextDecoder;async function Sn(n,e){return console.warn("createReadStream() deprecated, use fetch().then(resp => resp.body)"),n=H(n),(await J(n,e)).body}function Tn(...n){return console.warn("parse() deprecated, use parse()"),_(...n)}function vn(...n){return console.warn("parseSync() deprecated, use parseSync()"),M(...n)}function Bn(...n){return console.warn("loadFile() deprecated, use load()"),Q(...n)}}])});

@@ -8,23 +8,30 @@ "use strict";

});
exports.createReadStream = createReadStream;
exports.parseFile = parseFile;
exports.parseFileSync = parseFileSync;
exports.loadFile = loadFile;
Object.defineProperty(exports, "setPathPrefix", {
Object.defineProperty(exports, "parse", {
enumerable: true,
get: function get() {
return _fileAliases.setPathPrefix;
return _parse.parse;
}
});
Object.defineProperty(exports, "getPathPrefix", {
Object.defineProperty(exports, "parseSync", {
enumerable: true,
get: function get() {
return _fileAliases.getPathPrefix;
return _parse.parseSync;
}
});
Object.defineProperty(exports, "resolvePath", {
Object.defineProperty(exports, "parseInBatches", {
enumerable: true,
get: function get() {
return _fileAliases.resolvePath;
return _parse.parseInBatches;
}
});
Object.defineProperty(exports, "parseInBatchesSync", {
enumerable: true,
get: function get() {
return _parse.parseInBatchesSync;
}
});
Object.defineProperty(exports, "fetchFile", {

@@ -36,68 +43,86 @@ enumerable: true,

});
Object.defineProperty(exports, "readFileSync", {
Object.defineProperty(exports, "load", {
enumerable: true,
get: function get() {
return _fetchFile.readFileSync;
return _load.load;
}
});
Object.defineProperty(exports, "createReadStream", {
Object.defineProperty(exports, "loadInBatches", {
enumerable: true,
get: function get() {
return _fetchFile.createReadStream;
return _load.loadInBatches;
}
});
Object.defineProperty(exports, "writeFile", {
Object.defineProperty(exports, "isBrowser", {
enumerable: true,
get: function get() {
return _writeFile.writeFile;
return _globals.isBrowser;
}
});
Object.defineProperty(exports, "writeFileSync", {
Object.defineProperty(exports, "self", {
enumerable: true,
get: function get() {
return _writeFile.writeFileSync;
return _globals.self;
}
});
Object.defineProperty(exports, "registerLoaders", {
Object.defineProperty(exports, "window", {
enumerable: true,
get: function get() {
return _registerLoaders.registerLoaders;
return _globals.window;
}
});
Object.defineProperty(exports, "parse", {
Object.defineProperty(exports, "global", {
enumerable: true,
get: function get() {
return _parse.parse;
return _globals.global;
}
});
Object.defineProperty(exports, "parseSync", {
Object.defineProperty(exports, "document", {
enumerable: true,
get: function get() {
return _parse.parseSync;
return _globals.document;
}
});
Object.defineProperty(exports, "parseInBatches", {
Object.defineProperty(exports, "setPathPrefix", {
enumerable: true,
get: function get() {
return _parse.parseInBatches;
return _fileAliases2.setPathPrefix;
}
});
Object.defineProperty(exports, "parseInBatchesSync", {
Object.defineProperty(exports, "getPathPrefix", {
enumerable: true,
get: function get() {
return _parse.parseInBatchesSync;
return _fileAliases2.getPathPrefix;
}
});
Object.defineProperty(exports, "load", {
Object.defineProperty(exports, "resolvePath", {
enumerable: true,
get: function get() {
return _load.load;
return _fileAliases2.resolvePath;
}
});
Object.defineProperty(exports, "loadInBatches", {
Object.defineProperty(exports, "readFileSync", {
enumerable: true,
get: function get() {
return _load.loadInBatches;
return _readFile.readFileSync;
}
});
Object.defineProperty(exports, "writeFile", {
enumerable: true,
get: function get() {
return _writeFile.writeFile;
}
});
Object.defineProperty(exports, "writeFileSync", {
enumerable: true,
get: function get() {
return _writeFile.writeFileSync;
}
});
Object.defineProperty(exports, "registerLoaders", {
enumerable: true,
get: function get() {
return _registerLoaders.registerLoaders;
}
});
Object.defineProperty(exports, "encode", {

@@ -223,20 +248,2 @@ enumerable: true,

});
Object.defineProperty(exports, "flattenToTypedArray", {
enumerable: true,
get: function get() {
return _flattenToTypedArray.flattenToTypedArray;
}
});
Object.defineProperty(exports, "TextDecoder", {
enumerable: true,
get: function get() {
return _textEncoding.TextDecoder;
}
});
Object.defineProperty(exports, "TextEncoder", {
enumerable: true,
get: function get() {
return _textEncoding.TextEncoder;
}
});
Object.defineProperty(exports, "getStreamIterator", {

@@ -278,38 +285,2 @@ enumerable: true,

});
Object.defineProperty(exports, "createWorker", {
enumerable: true,
get: function get() {
return _createWorker["default"];
}
});
Object.defineProperty(exports, "isBrowser", {
enumerable: true,
get: function get() {
return _globals.isBrowser;
}
});
Object.defineProperty(exports, "self", {
enumerable: true,
get: function get() {
return _globals.self;
}
});
Object.defineProperty(exports, "window", {
enumerable: true,
get: function get() {
return _globals.window;
}
});
Object.defineProperty(exports, "global", {
enumerable: true,
get: function get() {
return _globals.global;
}
});
Object.defineProperty(exports, "document", {
enumerable: true,
get: function get() {
return _globals.document;
}
});
Object.defineProperty(exports, "assert", {

@@ -321,13 +292,22 @@ enumerable: true,

});
Object.defineProperty(exports, "_getMeshSize", {
enumerable: true,
get: function get() {
return _meshUtils.getMeshSize;
}
});
exports.TextDecoder = exports.TextEncoder = void 0;
var _fileAliases = require("./lib/fetch/file-aliases.js");
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _parse = require("./lib/parse");
var _fetchFile = require("./lib/fetch/fetch-file");
var _load = require("./lib/load");
var _fileAliases = require("./lib/fetch/file-aliases");
var _globals = require("./utils/globals");
var _fileAliases2 = require("./lib/fetch/file-aliases.js");
var _readFile = require("./lib/fetch/read-file");
var _writeFile = require("./lib/fetch/write-file");

@@ -337,6 +317,2 @@

var _parse = require("./lib/parse");
var _load = require("./lib/load");
var _encode = require("./lib/encode");

@@ -352,6 +328,2 @@

var _flattenToTypedArray = require("./javascript-utils/flatten-to-typed-array");
var _textEncoding = require("./javascript-utils/text-encoding");
var _streamUtils = require("./javascript-utils/stream-utils");

@@ -361,10 +333,39 @@

var _createWorker = _interopRequireDefault(require("./worker-utils/create-worker"));
var _assert = _interopRequireDefault(require("./utils/assert"));
var _globals = require("./utils/globals");
var TextEncoder = _globals.global.TextEncoder;
exports.TextEncoder = TextEncoder;
var TextDecoder = _globals.global.TextDecoder;
exports.TextDecoder = TextDecoder;
var _assert = _interopRequireDefault(require("./utils/assert"));
function createReadStream(_x, _x2) {
return _createReadStream.apply(this, arguments);
}
var _meshUtils = require("./categories/mesh/mesh-utils");
function _createReadStream() {
_createReadStream = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(url, options) {
var response;
return _regenerator["default"].wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
console.warn('createReadStream() deprecated, use fetch().then(resp => resp.body)');
url = (0, _fileAliases.resolvePath)(url);
_context.next = 4;
return (0, _fetchFile.fetchFile)(url, options);
case 4:
response = _context.sent;
return _context.abrupt("return", response.body);
case 6:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _createReadStream.apply(this, arguments);
}
function parseFile() {

@@ -371,0 +372,0 @@ console.warn('parse() deprecated, use parse()');

@@ -27,4 +27,2 @@ "use strict";

var _textEncoding = require("../javascript-utils/text-encoding");
function forEach(_x7, _x8) {

@@ -200,3 +198,3 @@ return _forEach.apply(this, arguments);

case 0:
textDecoder = new _textEncoding.TextDecoder(options);
textDecoder = new TextDecoder(options);
_iteratorNormalCompletion2 = true;

@@ -296,3 +294,3 @@ _didIteratorError2 = false;

case 0:
textEncoder = new _textEncoding.TextEncoder();
textEncoder = new TextEncoder();
_iteratorNormalCompletion3 = true;

@@ -299,0 +297,0 @@ _didIteratorError3 = false;

@@ -15,4 +15,2 @@ "use strict";

var _textEncoding = require("./text-encoding");
var isArrayBuffer = function isArrayBuffer(x) {

@@ -52,3 +50,3 @@ return x && x instanceof ArrayBuffer;

var text = data;
var uint8Array = new _textEncoding.TextEncoder().encode(text);
var uint8Array = new TextEncoder().encode(text);
return uint8Array.buffer;

@@ -55,0 +53,0 @@ }

@@ -9,3 +9,2 @@ "use strict";

exports.getStreamIterator = getStreamIterator;
exports.concatenateReadStream = concatenateReadStream;

@@ -22,4 +21,2 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));

var _memoryCopyUtils = require("./memory-copy-utils");
function getStreamIterator(stream) {

@@ -181,26 +178,2 @@ if (typeof stream[Symbol.asyncIterator] === 'function') {

}
function concatenateReadStream(readStream) {
var arrayBuffer = new ArrayBuffer();
var string = '';
return new Promise(function (resolve, reject) {
readStream.data(function (chunk) {
if (typeof chunk === 'string') {
string += chunk;
} else {
arrayBuffer = (0, _memoryCopyUtils.concatenateArrayBuffers)(arrayBuffer, chunk);
}
});
readStream.on('error', function (error) {
return reject(error);
});
readStream.on('end', function () {
if (readStream.complete) {
resolve(arrayBuffer || string);
} else {
reject('The connection was terminated while the message was still being sent');
}
});
});
}
//# sourceMappingURL=stream-utils.js.map
"use strict";
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard");
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

@@ -11,4 +9,2 @@

exports.fetchFile = fetchFile;
exports.readFileSync = readFileSync;
exports.createReadStream = createReadStream;

@@ -19,8 +15,2 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));

var _globals = require("../../utils/globals");
var node = _interopRequireWildcard(require("../../node/fetch/fetch-file-node"));
var _fetchFileBrowser = require("./fetch-file-browser");
var _fileAliases = require("./file-aliases");

@@ -34,3 +24,2 @@

_fetchFile = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(url, options) {
var func;
return _regenerator["default"].wrap(function _callee$(_context) {

@@ -41,6 +30,5 @@ while (1) {

url = (0, _fileAliases.resolvePath)(url);
func = _globals.isBrowser ? _fetchFileBrowser.fetchFile : node.fetchFile;
return _context.abrupt("return", func(url, options));
return _context.abrupt("return", fetch(url, options));
case 3:
case 2:
case "end":

@@ -54,34 +42,2 @@ return _context.stop();

}
function readFileSync(url) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
url = (0, _fileAliases.resolvePath)(url);
var func = _globals.isBrowser ? _fetchFileBrowser.readFileSync : node.readFileSync;
return func(url, options);
}
function createReadStream(_x3, _x4) {
return _createReadStream.apply(this, arguments);
}
function _createReadStream() {
_createReadStream = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(url, options) {
var func;
return _regenerator["default"].wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
url = (0, _fileAliases.resolvePath)(url);
func = _globals.isBrowser ? _fetchFileBrowser.createReadStream : node.createReadStream;
return _context2.abrupt("return", func(url, options));
case 3:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _createReadStream.apply(this, arguments);
}
//# sourceMappingURL=fetch-file.js.map

@@ -17,6 +17,10 @@ "use strict";

var node = _interopRequireWildcard(require("../../node/fetch/write-file-node"));
var node = _interopRequireWildcard(require("../../node/write-file.node"));
var _fileAliases = require("./file-aliases");
function writeFile(filePath, arrayBufferOrString, options) {
if (!_globals.isBrowser) {
filePath = (0, _fileAliases.resolvePath)(filePath);
if (!_globals.isBrowser && node.writeFile) {
return node.writeFile(filePath, arrayBufferOrString, options);

@@ -29,3 +33,5 @@ }

function writeFileSync(filePath, arrayBufferOrString, options) {
if (!_globals.isBrowser) {
filePath = (0, _fileAliases.resolvePath)(filePath);
if (!_globals.isBrowser && node.writeFileSync) {
return node.writeFileSync(filePath, arrayBufferOrString, options);

@@ -32,0 +38,0 @@ }

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

_load = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(url, loaders, options) {
var loader, response;
var loader, data;
return _regenerator["default"].wrap(function _callee2$(_context2) {

@@ -85,10 +85,19 @@ while (1) {

case 7:
_context2.next = 9;
data = url;
if (!(typeof data === 'string')) {
_context2.next = 12;
break;
}
_context2.next = 11;
return (0, _fetchFile.fetchFile)(url, options);
case 9:
response = _context2.sent;
return _context2.abrupt("return", (0, _parse.parse)(response, loaders, options, url));
case 11:
data = _context2.sent;
case 11:
case 12:
return _context2.abrupt("return", (0, _parse.parse)(data, loaders, options, url));
case 13:
case "end":

@@ -95,0 +104,0 @@ return _context2.stop();

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

var EXT_PATTERN = /[^\.]+$/;
var EXT_PATTERN = /[^.]+$/;

@@ -13,0 +13,0 @@ function autoDetectLoader() {

@@ -23,4 +23,2 @@ "use strict";

var _textEncoding = require("../../javascript-utils/text-encoding");
var ERR_DATA = 'Cannot convert supplied data type';

@@ -45,3 +43,3 @@

if (loader.text && !loader.binary) {
var textDecoder = new _textEncoding.TextDecoder('utf8');
var textDecoder = new TextDecoder('utf8');
return textDecoder.decode(arrayBuffer);

@@ -48,0 +46,0 @@ }

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

function parseWithLoader(_x, _x2) {
function parseWithLoader(_x, _x2, _x3, _x4) {
return _parseWithLoader.apply(this, arguments);

@@ -29,6 +29,3 @@ }

function _parseWithLoader() {
_parseWithLoader = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(data, loader) {
var options,
url,
_args = arguments;
_parseWithLoader = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(data, loader, options, url) {
return _regenerator["default"].wrap(function _callee$(_context) {

@@ -38,13 +35,11 @@ while (1) {

case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
url = _args.length > 3 ? _args[3] : undefined;
url = url || (0, _getData.getUrlFromData)(data);
_context.next = 5;
_context.next = 3;
return (0, _getData.getArrayBufferOrStringFromData)(data, loader);
case 5:
case 3:
data = _context.sent;
if (!(loader.parseTextSync && typeof data === 'string')) {
_context.next = 9;
_context.next = 7;
break;

@@ -56,5 +51,5 @@ }

case 9:
case 7:
if (!loader.parseSync) {
_context.next = 11;
_context.next = 9;
break;

@@ -65,30 +60,30 @@ }

case 11:
case 9:
if (!loader.parse) {
_context.next = 15;
_context.next = 13;
break;
}
_context.next = 14;
_context.next = 12;
return loader.parse(data, options, url, loader);
case 14:
case 12:
return _context.abrupt("return", _context.sent);
case 15:
case 13:
if (!loader.worker) {
_context.next = 19;
_context.next = 17;
break;
}
_context.next = 18;
_context.next = 16;
return (0, _parseWithWorker["default"])(loader.worker, data, options);
case 18:
case 16:
return _context.abrupt("return", _context.sent);
case 19:
case 17:
return _context.abrupt("return", (0, _assert["default"])(false));
case 20:
case 18:
case "end":

@@ -103,5 +98,3 @@ return _context.stop();

function parseWithLoaderSync(data, loader) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var url = arguments.length > 3 ? arguments[3] : undefined;
function parseWithLoaderSync(data, loader, options, url) {
data = (0, _getData.getArrayBufferOrStringFromDataSync)(data, loader);

@@ -120,3 +113,3 @@

function parseWithLoaderInBatches(_x3, _x4) {
function parseWithLoaderInBatches(_x5, _x6, _x7, _x8) {
return _parseWithLoaderInBatches.apply(this, arguments);

@@ -126,8 +119,4 @@ }

function _parseWithLoaderInBatches() {
_parseWithLoaderInBatches = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(data, loader) {
var options,
url,
inputIterator,
outputIterator,
_args2 = arguments;
_parseWithLoaderInBatches = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee2(data, loader, options, url) {
var inputIterator, outputIterator;
return _regenerator["default"].wrap(function _callee2$(_context2) {

@@ -137,14 +126,11 @@ while (1) {

case 0:
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
url = _args2.length > 3 ? _args2[3] : undefined;
if (!loader.parseInBatches) {
_context2.next = 8;
_context2.next = 6;
break;
}
_context2.next = 5;
_context2.next = 3;
return (0, _getData.getAsyncIteratorFromData)(data);
case 5:
case 3:
inputIterator = _context2.sent;

@@ -154,6 +140,6 @@ outputIterator = loader.parseInBatches(inputIterator, options, url, loader);

case 8:
case 6:
return _context2.abrupt("return", null);
case 9:
case 7:
case "end":

@@ -168,3 +154,3 @@ return _context2.stop();

function parseWithLoaderInBatchesSync(_x5, _x6) {
function parseWithLoaderInBatchesSync(_x9, _x10, _x11, _x12) {
return _parseWithLoaderInBatchesSync.apply(this, arguments);

@@ -174,8 +160,4 @@ }

function _parseWithLoaderInBatchesSync() {
_parseWithLoaderInBatchesSync = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(data, loader) {
var options,
url,
inputIterator,
outputIterator,
_args3 = arguments;
_parseWithLoaderInBatchesSync = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee3(data, loader, options, url) {
var inputIterator, outputIterator;
return _regenerator["default"].wrap(function _callee3$(_context3) {

@@ -185,7 +167,4 @@ while (1) {

case 0:
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
url = _args3.length > 3 ? _args3[3] : undefined;
if (!loader.parseInBatchesSync) {
_context3.next = 6;
_context3.next = 4;
break;

@@ -198,6 +177,6 @@ }

case 6:
case 4:
return _context3.abrupt("return", (0, _assert["default"])(false));
case 7:
case 5:
case "end":

@@ -204,0 +183,0 @@ return _context3.stop();

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

function mergeLoaderAndUserOptions(options, loader) {
options = Object.assign({}, loader.DEFAULT_OPTIONS, loader.options, options, {
options = Object.assign({}, loader.DEFAULT_OPTIONS, loader.defaultOptions, loader.options, options, {
dataType: 'arraybuffer'

@@ -157,0 +157,0 @@ });

@@ -13,11 +13,11 @@ "use strict";

function save(data, url, writer) {
var encodedData = (0, _encode.encode)(data, writer, url);
function save(data, url, writer, options) {
var encodedData = (0, _encode.encode)(data, writer, options, url);
return (0, _writeFile.writeFile)(url, encodedData);
}
function saveSync(data, url, writer) {
var encodedData = (0, _encode.encodeSync)(data, writer, url);
function saveSync(data, url, writer, options) {
var encodedData = (0, _encode.encodeSync)(data, writer, options, url);
return (0, _writeFile.writeFileSync)(url, encodedData);
}
//# sourceMappingURL=save.js.map

@@ -0,3 +1,10 @@

import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { parse, parseSync } from './lib/parse';
import { fetchFile } from './lib/fetch/fetch-file';
import { load } from './lib/load';
import { resolvePath } from './lib/fetch/file-aliases';
import { global } from './utils/globals';
export { setPathPrefix, getPathPrefix, resolvePath } from './lib/fetch/file-aliases.js';
export { fetchFile, readFileSync } from './lib/fetch/fetch-file';
export { fetchFile } from './lib/fetch/fetch-file';
export { readFileSync } from './lib/fetch/read-file';
export { writeFile, writeFileSync } from './lib/fetch/write-file';

@@ -12,13 +19,22 @@ export { registerLoaders } from './lib/register-loaders';

export { padTo4Bytes, copyToArray, copyArrayBuffer } from './javascript-utils/memory-copy-utils';
export { flattenToTypedArray } from './javascript-utils/flatten-to-typed-array';
export { TextDecoder, TextEncoder } from './javascript-utils/text-encoding';
export { getStreamIterator } from './javascript-utils/stream-utils';
export { forEach, concatenateAsyncIterator, lineAsyncIterator, textDecoderAsyncIterator, numberedLineAsyncIterator } from './javascript-utils/async-iterator-utils';
export { default as createWorker } from './worker-utils/create-worker';
export { isBrowser, self, window, global, document } from './utils/globals';
export { default as assert } from './utils/assert';
export { getMeshSize as _getMeshSize } from './categories/mesh/mesh-utils';
export { createReadStream } from './lib/fetch/fetch-file';
import { parse, parseSync } from './lib/parse';
import { load } from './lib/load';
export const TextEncoder = global.TextEncoder;
export const TextDecoder = global.TextDecoder;
export function createReadStream(_x, _x2) {
return _createReadStream.apply(this, arguments);
}
function _createReadStream() {
_createReadStream = _asyncToGenerator(function* (url, options) {
console.warn('createReadStream() deprecated, use fetch().then(resp => resp.body)');
url = resolvePath(url);
const response = yield fetchFile(url, options);
return response.body;
});
return _createReadStream.apply(this, arguments);
}
export function parseFile() {

@@ -25,0 +41,0 @@ console.warn('parse() deprecated, use parse()');

@@ -6,3 +6,2 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

import { concatenateArrayBuffers } from '../javascript-utils/memory-copy-utils';
import { TextDecoder, TextEncoder } from '../javascript-utils/text-encoding';
export function forEach(_x7, _x8) {

@@ -9,0 +8,0 @@ return _forEach.apply(this, arguments);

import assert from '../utils/assert';
import { TextEncoder } from './text-encoding';
export const isArrayBuffer = x => x && x instanceof ArrayBuffer;

@@ -4,0 +3,0 @@ export const isBlob = x => x && typeof Blob !== 'undefined' && x instanceof Blob;

@@ -5,3 +5,2 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

import { isBrowser } from '../utils/globals';
import { concatenateArrayBuffers } from './memory-copy-utils';
export function getStreamIterator(stream) {

@@ -84,24 +83,2 @@ if (typeof stream[Symbol.asyncIterator] === 'function') {

}
export function concatenateReadStream(readStream) {
let arrayBuffer = new ArrayBuffer();
let string = '';
return new Promise((resolve, reject) => {
readStream.data(chunk => {
if (typeof chunk === 'string') {
string += chunk;
} else {
arrayBuffer = concatenateArrayBuffers(arrayBuffer, chunk);
}
});
readStream.on('error', error => reject(error));
readStream.on('end', () => {
if (readStream.complete) {
resolve(arrayBuffer || string);
} else {
reject('The connection was terminated while the message was still being sent');
}
});
});
}
//# sourceMappingURL=stream-utils.js.map
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { isBrowser } from '../../utils/globals';
import * as node from '../../node/fetch/fetch-file-node';
import { fetchFile as browserFetchFile, readFileSync as browserReadFileSync, createReadStream as browserCreateReadStream } from './fetch-file-browser';
import { resolvePath } from './file-aliases';

@@ -13,26 +10,6 @@ export function fetchFile(_x, _x2) {

url = resolvePath(url);
const func = isBrowser ? browserFetchFile : node.fetchFile;
return func(url, options);
return fetch(url, options);
});
return _fetchFile.apply(this, arguments);
}
export function readFileSync(url) {
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
url = resolvePath(url);
const func = isBrowser ? browserReadFileSync : node.readFileSync;
return func(url, options);
}
export function createReadStream(_x3, _x4) {
return _createReadStream.apply(this, arguments);
}
function _createReadStream() {
_createReadStream = _asyncToGenerator(function* (url, options) {
url = resolvePath(url);
const func = isBrowser ? browserCreateReadStream : node.createReadStream;
return func(url, options);
});
return _createReadStream.apply(this, arguments);
}
//# sourceMappingURL=fetch-file.js.map
import { isBrowser } from '../../utils/globals';
import assert from '../../utils/assert';
import * as node from '../../node/fetch/write-file-node';
import * as node from '../../node/write-file.node';
import { resolvePath } from './file-aliases';
export function writeFile(filePath, arrayBufferOrString, options) {
if (!isBrowser) {
filePath = resolvePath(filePath);
if (!isBrowser && node.writeFile) {
return node.writeFile(filePath, arrayBufferOrString, options);

@@ -12,3 +15,5 @@ }

export function writeFileSync(filePath, arrayBufferOrString, options) {
if (!isBrowser) {
filePath = resolvePath(filePath);
if (!isBrowser && node.writeFileSync) {
return node.writeFileSync(filePath, arrayBufferOrString, options);

@@ -15,0 +20,0 @@ }

@@ -37,4 +37,9 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

const response = yield fetchFile(url, options);
return parse(response, loaders, options, url);
let data = url;
if (typeof data === 'string') {
data = yield fetchFile(url, options);
}
return parse(data, loaders, options, url);
});

@@ -41,0 +46,0 @@ return _load.apply(this, arguments);

import { normalizeLoader } from './normalize-loader';
const EXT_PATTERN = /[^\.]+$/;
const EXT_PATTERN = /[^.]+$/;
export function autoDetectLoader() {

@@ -4,0 +4,0 @@ let url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';

import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { isFetchResponse, isReadableStream, isAsyncIterable, isIterable, isIterator } from '../../javascript-utils/is-type';
import { getStreamIterator } from '../../javascript-utils/stream-utils';
import { TextDecoder } from '../../javascript-utils/text-encoding';
const ERR_DATA = 'Cannot convert supplied data type';

@@ -6,0 +5,0 @@ export function getUrlFromData(data) {

@@ -5,3 +5,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

import { getArrayBufferOrStringFromDataSync, getArrayBufferOrStringFromData, getAsyncIteratorFromData, getIteratorFromData, getUrlFromData } from './loader-utils/get-data';
export function parseWithLoader(_x, _x2) {
export function parseWithLoader(_x, _x2, _x3, _x4) {
return _parseWithLoader.apply(this, arguments);

@@ -11,5 +11,3 @@ }

function _parseWithLoader() {
_parseWithLoader = _asyncToGenerator(function* (data, loader) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let url = arguments.length > 3 ? arguments[3] : undefined;
_parseWithLoader = _asyncToGenerator(function* (data, loader, options, url) {
url = url || getUrlFromData(data);

@@ -40,5 +38,3 @@ data = yield getArrayBufferOrStringFromData(data, loader);

export function parseWithLoaderSync(data, loader) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let url = arguments.length > 3 ? arguments[3] : undefined;
export function parseWithLoaderSync(data, loader, options, url) {
data = getArrayBufferOrStringFromDataSync(data, loader);

@@ -56,3 +52,3 @@

}
export function parseWithLoaderInBatches(_x3, _x4) {
export function parseWithLoaderInBatches(_x5, _x6, _x7, _x8) {
return _parseWithLoaderInBatches.apply(this, arguments);

@@ -62,6 +58,3 @@ }

function _parseWithLoaderInBatches() {
_parseWithLoaderInBatches = _asyncToGenerator(function* (data, loader) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let url = arguments.length > 3 ? arguments[3] : undefined;
_parseWithLoaderInBatches = _asyncToGenerator(function* (data, loader, options, url) {
if (loader.parseInBatches) {

@@ -78,3 +71,3 @@ const inputIterator = yield getAsyncIteratorFromData(data);

export function parseWithLoaderInBatchesSync(_x5, _x6) {
export function parseWithLoaderInBatchesSync(_x9, _x10, _x11, _x12) {
return _parseWithLoaderInBatchesSync.apply(this, arguments);

@@ -84,6 +77,3 @@ }

function _parseWithLoaderInBatchesSync() {
_parseWithLoaderInBatchesSync = _asyncToGenerator(function* (data, loader) {
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
let url = arguments.length > 3 ? arguments[3] : undefined;
_parseWithLoaderInBatchesSync = _asyncToGenerator(function* (data, loader, options, url) {
if (loader.parseInBatchesSync) {

@@ -90,0 +80,0 @@ const inputIterator = getIteratorFromData(data);

@@ -89,3 +89,3 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

function mergeLoaderAndUserOptions(options, loader) {
options = Object.assign({}, loader.DEFAULT_OPTIONS, loader.options, options, {
options = Object.assign({}, loader.DEFAULT_OPTIONS, loader.defaultOptions, loader.options, options, {
dataType: 'arraybuffer'

@@ -92,0 +92,0 @@ });

import { encode, encodeSync } from './encode';
import { writeFile, writeFileSync } from './fetch/write-file';
export function save(data, url, writer) {
const encodedData = encode(data, writer, url);
export function save(data, url, writer, options) {
const encodedData = encode(data, writer, options, url);
return writeFile(url, encodedData);
}
export function saveSync(data, url, writer) {
const encodedData = encodeSync(data, writer, url);
export function saveSync(data, url, writer, options) {
const encodedData = encodeSync(data, writer, options, url);
return writeFileSync(url, encodedData);
}
//# sourceMappingURL=save.js.map

@@ -0,3 +1,11 @@

import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { parse, parseSync } from './lib/parse';
import { fetchFile } from './lib/fetch/fetch-file';
import { load } from './lib/load';
import { resolvePath } from './lib/fetch/file-aliases';
import { global } from './utils/globals';
export { setPathPrefix, getPathPrefix, resolvePath } from './lib/fetch/file-aliases.js';
export { fetchFile, readFileSync } from './lib/fetch/fetch-file';
export { fetchFile } from './lib/fetch/fetch-file';
export { readFileSync } from './lib/fetch/read-file';
export { writeFile, writeFileSync } from './lib/fetch/write-file';

@@ -12,13 +20,38 @@ export { registerLoaders } from './lib/register-loaders';

export { padTo4Bytes, copyToArray, copyArrayBuffer } from './javascript-utils/memory-copy-utils';
export { flattenToTypedArray } from './javascript-utils/flatten-to-typed-array';
export { TextDecoder, TextEncoder } from './javascript-utils/text-encoding';
export { getStreamIterator } from './javascript-utils/stream-utils';
export { forEach, concatenateAsyncIterator, lineAsyncIterator, textDecoderAsyncIterator, numberedLineAsyncIterator } from './javascript-utils/async-iterator-utils';
export { default as createWorker } from './worker-utils/create-worker';
export { isBrowser, self, window, global, document } from './utils/globals';
export { default as assert } from './utils/assert';
export { getMeshSize as _getMeshSize } from './categories/mesh/mesh-utils';
export { createReadStream } from './lib/fetch/fetch-file';
import { parse, parseSync } from './lib/parse';
import { load } from './lib/load';
export var TextEncoder = global.TextEncoder;
export var TextDecoder = global.TextDecoder;
export function createReadStream(_x, _x2) {
return _createReadStream.apply(this, arguments);
}
function _createReadStream() {
_createReadStream = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(url, options) {
var response;
return _regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
console.warn('createReadStream() deprecated, use fetch().then(resp => resp.body)');
url = resolvePath(url);
_context.next = 4;
return fetchFile(url, options);
case 4:
response = _context.sent;
return _context.abrupt("return", response.body);
case 6:
case "end":
return _context.stop();
}
}
}, _callee);
}));
return _createReadStream.apply(this, arguments);
}
export function parseFile() {

@@ -25,0 +58,0 @@ console.warn('parse() deprecated, use parse()');

@@ -7,3 +7,2 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

import { concatenateArrayBuffers } from '../javascript-utils/memory-copy-utils';
import { TextDecoder, TextEncoder } from '../javascript-utils/text-encoding';
export function forEach(_x7, _x8) {

@@ -10,0 +9,0 @@ return _forEach.apply(this, arguments);

import assert from '../utils/assert';
import { TextEncoder } from './text-encoding';
export var isArrayBuffer = function isArrayBuffer(x) {

@@ -4,0 +3,0 @@ return x && x instanceof ArrayBuffer;

@@ -6,3 +6,2 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";

import { isBrowser } from '../utils/globals';
import { concatenateArrayBuffers } from './memory-copy-utils';
export function getStreamIterator(stream) {

@@ -164,26 +163,2 @@ if (typeof stream[Symbol.asyncIterator] === 'function') {

}
export function concatenateReadStream(readStream) {
var arrayBuffer = new ArrayBuffer();
var string = '';
return new Promise(function (resolve, reject) {
readStream.data(function (chunk) {
if (typeof chunk === 'string') {
string += chunk;
} else {
arrayBuffer = concatenateArrayBuffers(arrayBuffer, chunk);
}
});
readStream.on('error', function (error) {
return reject(error);
});
readStream.on('end', function () {
if (readStream.complete) {
resolve(arrayBuffer || string);
} else {
reject('The connection was terminated while the message was still being sent');
}
});
});
}
//# sourceMappingURL=stream-utils.js.map
import _regeneratorRuntime from "@babel/runtime/regenerator";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
import { isBrowser } from '../../utils/globals';
import * as node from '../../node/fetch/fetch-file-node';
import { fetchFile as browserFetchFile, readFileSync as browserReadFileSync, createReadStream as browserCreateReadStream } from './fetch-file-browser';
import { resolvePath } from './file-aliases';

@@ -13,3 +10,2 @@ export function fetchFile(_x, _x2) {

_fetchFile = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(url, options) {
var func;
return _regeneratorRuntime.wrap(function _callee$(_context) {

@@ -20,6 +16,5 @@ while (1) {

url = resolvePath(url);
func = isBrowser ? browserFetchFile : node.fetchFile;
return _context.abrupt("return", func(url, options));
return _context.abrupt("return", fetch(url, options));
case 3:
case 2:
case "end":

@@ -33,33 +28,2 @@ return _context.stop();

}
export function readFileSync(url) {
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
url = resolvePath(url);
var func = isBrowser ? browserReadFileSync : node.readFileSync;
return func(url, options);
}
export function createReadStream(_x3, _x4) {
return _createReadStream.apply(this, arguments);
}
function _createReadStream() {
_createReadStream = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(url, options) {
var func;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
while (1) {
switch (_context2.prev = _context2.next) {
case 0:
url = resolvePath(url);
func = isBrowser ? browserCreateReadStream : node.createReadStream;
return _context2.abrupt("return", func(url, options));
case 3:
case "end":
return _context2.stop();
}
}
}, _callee2);
}));
return _createReadStream.apply(this, arguments);
}
//# sourceMappingURL=fetch-file.js.map
import { isBrowser } from '../../utils/globals';
import assert from '../../utils/assert';
import * as node from '../../node/fetch/write-file-node';
import * as node from '../../node/write-file.node';
import { resolvePath } from './file-aliases';
export function writeFile(filePath, arrayBufferOrString, options) {
if (!isBrowser) {
filePath = resolvePath(filePath);
if (!isBrowser && node.writeFile) {
return node.writeFile(filePath, arrayBufferOrString, options);

@@ -12,3 +15,5 @@ }

export function writeFileSync(filePath, arrayBufferOrString, options) {
if (!isBrowser) {
filePath = resolvePath(filePath);
if (!isBrowser && node.writeFileSync) {
return node.writeFileSync(filePath, arrayBufferOrString, options);

@@ -15,0 +20,0 @@ }

@@ -42,3 +42,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

_load = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(url, loaders, options) {
var loader, response;
var loader, data;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {

@@ -68,10 +68,19 @@ while (1) {

case 7:
_context2.next = 9;
data = url;
if (!(typeof data === 'string')) {
_context2.next = 12;
break;
}
_context2.next = 11;
return fetchFile(url, options);
case 9:
response = _context2.sent;
return _context2.abrupt("return", parse(response, loaders, options, url));
case 11:
data = _context2.sent;
case 11:
case 12:
return _context2.abrupt("return", parse(data, loaders, options, url));
case 13:
case "end":

@@ -78,0 +87,0 @@ return _context2.stop();

import { normalizeLoader } from './normalize-loader';
var EXT_PATTERN = /[^\.]+$/;
var EXT_PATTERN = /[^.]+$/;
export function autoDetectLoader() {

@@ -4,0 +4,0 @@ var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';

@@ -5,3 +5,2 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

import { getStreamIterator } from '../../javascript-utils/stream-utils';
import { TextDecoder } from '../../javascript-utils/text-encoding';
var ERR_DATA = 'Cannot convert supplied data type';

@@ -8,0 +7,0 @@ export function getUrlFromData(data) {

@@ -6,3 +6,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

import { getArrayBufferOrStringFromDataSync, getArrayBufferOrStringFromData, getAsyncIteratorFromData, getIteratorFromData, getUrlFromData } from './loader-utils/get-data';
export function parseWithLoader(_x, _x2) {
export function parseWithLoader(_x, _x2, _x3, _x4) {
return _parseWithLoader.apply(this, arguments);

@@ -12,6 +12,3 @@ }

function _parseWithLoader() {
_parseWithLoader = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(data, loader) {
var options,
url,
_args = arguments;
_parseWithLoader = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(data, loader, options, url) {
return _regeneratorRuntime.wrap(function _callee$(_context) {

@@ -21,13 +18,11 @@ while (1) {

case 0:
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
url = _args.length > 3 ? _args[3] : undefined;
url = url || getUrlFromData(data);
_context.next = 5;
_context.next = 3;
return getArrayBufferOrStringFromData(data, loader);
case 5:
case 3:
data = _context.sent;
if (!(loader.parseTextSync && typeof data === 'string')) {
_context.next = 9;
_context.next = 7;
break;

@@ -39,5 +34,5 @@ }

case 9:
case 7:
if (!loader.parseSync) {
_context.next = 11;
_context.next = 9;
break;

@@ -48,30 +43,30 @@ }

case 11:
case 9:
if (!loader.parse) {
_context.next = 15;
_context.next = 13;
break;
}
_context.next = 14;
_context.next = 12;
return loader.parse(data, options, url, loader);
case 14:
case 12:
return _context.abrupt("return", _context.sent);
case 15:
case 13:
if (!loader.worker) {
_context.next = 19;
_context.next = 17;
break;
}
_context.next = 18;
_context.next = 16;
return parseWithWorker(loader.worker, data, options);
case 18:
case 16:
return _context.abrupt("return", _context.sent);
case 19:
case 17:
return _context.abrupt("return", assert(false));
case 20:
case 18:
case "end":

@@ -86,5 +81,3 @@ return _context.stop();

export function parseWithLoaderSync(data, loader) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
var url = arguments.length > 3 ? arguments[3] : undefined;
export function parseWithLoaderSync(data, loader, options, url) {
data = getArrayBufferOrStringFromDataSync(data, loader);

@@ -102,3 +95,3 @@

}
export function parseWithLoaderInBatches(_x3, _x4) {
export function parseWithLoaderInBatches(_x5, _x6, _x7, _x8) {
return _parseWithLoaderInBatches.apply(this, arguments);

@@ -108,8 +101,4 @@ }

function _parseWithLoaderInBatches() {
_parseWithLoaderInBatches = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(data, loader) {
var options,
url,
inputIterator,
outputIterator,
_args2 = arguments;
_parseWithLoaderInBatches = _asyncToGenerator(_regeneratorRuntime.mark(function _callee2(data, loader, options, url) {
var inputIterator, outputIterator;
return _regeneratorRuntime.wrap(function _callee2$(_context2) {

@@ -119,14 +108,11 @@ while (1) {

case 0:
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
url = _args2.length > 3 ? _args2[3] : undefined;
if (!loader.parseInBatches) {
_context2.next = 8;
_context2.next = 6;
break;
}
_context2.next = 5;
_context2.next = 3;
return getAsyncIteratorFromData(data);
case 5:
case 3:
inputIterator = _context2.sent;

@@ -136,6 +122,6 @@ outputIterator = loader.parseInBatches(inputIterator, options, url, loader);

case 8:
case 6:
return _context2.abrupt("return", null);
case 9:
case 7:
case "end":

@@ -150,3 +136,3 @@ return _context2.stop();

export function parseWithLoaderInBatchesSync(_x5, _x6) {
export function parseWithLoaderInBatchesSync(_x9, _x10, _x11, _x12) {
return _parseWithLoaderInBatchesSync.apply(this, arguments);

@@ -156,8 +142,4 @@ }

function _parseWithLoaderInBatchesSync() {
_parseWithLoaderInBatchesSync = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(data, loader) {
var options,
url,
inputIterator,
outputIterator,
_args3 = arguments;
_parseWithLoaderInBatchesSync = _asyncToGenerator(_regeneratorRuntime.mark(function _callee3(data, loader, options, url) {
var inputIterator, outputIterator;
return _regeneratorRuntime.wrap(function _callee3$(_context3) {

@@ -167,7 +149,4 @@ while (1) {

case 0:
options = _args3.length > 2 && _args3[2] !== undefined ? _args3[2] : {};
url = _args3.length > 3 ? _args3[3] : undefined;
if (!loader.parseInBatchesSync) {
_context3.next = 6;
_context3.next = 4;
break;

@@ -180,6 +159,6 @@ }

case 6:
case 4:
return _context3.abrupt("return", assert(false));
case 7:
case 5:
case "end":

@@ -186,0 +165,0 @@ return _context3.stop();

@@ -134,3 +134,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

function mergeLoaderAndUserOptions(options, loader) {
options = Object.assign({}, loader.DEFAULT_OPTIONS, loader.options, options, {
options = Object.assign({}, loader.DEFAULT_OPTIONS, loader.defaultOptions, loader.options, options, {
dataType: 'arraybuffer'

@@ -137,0 +137,0 @@ });

import { encode, encodeSync } from './encode';
import { writeFile, writeFileSync } from './fetch/write-file';
export function save(data, url, writer) {
var encodedData = encode(data, writer, url);
export function save(data, url, writer, options) {
var encodedData = encode(data, writer, options, url);
return writeFile(url, encodedData);
}
export function saveSync(data, url, writer) {
var encodedData = encodeSync(data, writer, url);
export function saveSync(data, url, writer, options) {
var encodedData = encodeSync(data, writer, options, url);
return writeFileSync(url, encodedData);
}
//# sourceMappingURL=save.js.map
{
"name": "@loaders.gl/core",
"version": "1.0.3",
"version": "1.1.0-alpha.1",
"description": "Framework-independent loaders for 3D graphics formats",

@@ -25,10 +25,7 @@ "license": "MIT",

"browser": {
"./src/node/utils/buffer-to-array-buffer.js": false,
"./src/node/fetch/decode-data-uri.js": false,
"./src/node/fetch/fetch-file-node.js": false,
"./src/node/fetch/write-file-node.js": false,
"fs": false,
"http": false,
"https": false,
"util": false
"./src/node/utils/to-array-buffer.node.js": false,
"./src/node/utils/to-buffer.node.js": false,
"./src/node/write-file.node.js": false,
"./src/node/read-file-sync.node.js": false,
"fs": false
},

@@ -35,0 +32,0 @@ "files": [

# @loaders.gl/core
This module contains shared utilities for loaders.gl, a collection of framework independent 3D and geospatial loaders (parsers).
For documentation please visit the [website](https://loaders.gl).

@@ -0,4 +1,11 @@

import {parse, parseSync} from './lib/parse';
import {fetchFile} from './lib/fetch/fetch-file';
import {load} from './lib/load';
import {resolvePath} from './lib/fetch/file-aliases';
import {global} from './utils/globals';
// FILE READING AND WRITING
export {setPathPrefix, getPathPrefix, resolvePath} from './lib/fetch/file-aliases.js';
export {fetchFile, readFileSync} from './lib/fetch/fetch-file';
export {fetchFile} from './lib/fetch/fetch-file';
export {readFileSync} from './lib/fetch/read-file';
export {writeFile, writeFileSync} from './lib/fetch/write-file';

@@ -37,4 +44,2 @@

export {padTo4Bytes, copyToArray, copyArrayBuffer} from './javascript-utils/memory-copy-utils';
export {flattenToTypedArray} from './javascript-utils/flatten-to-typed-array';
export {TextDecoder, TextEncoder} from './javascript-utils/text-encoding';

@@ -52,5 +57,2 @@ // ITERATOR UTILS

// WORKER UTILS
export {default as createWorker} from './worker-utils/create-worker';
// CORE UTILS

@@ -60,11 +62,17 @@ export {isBrowser, self, window, global, document} from './utils/globals';

// MESH CATEGORY UTILS
export {getMeshSize as _getMeshSize} from './categories/mesh/mesh-utils';
// DEPRECATED
export {createReadStream} from './lib/fetch/fetch-file';
import {parse, parseSync} from './lib/parse';
import {load} from './lib/load';
// Use @loaders.gl/polyfills and global symbols instead
export const TextEncoder = global.TextEncoder;
export const TextDecoder = global.TextDecoder;
// Returns a promise that resolves to a readable stream
export async function createReadStream(url, options) {
// eslint-disable-next-line
console.warn('createReadStream() deprecated, use fetch().then(resp => resp.body)');
url = resolvePath(url);
const response = await fetchFile(url, options);
return response.body;
}
export function parseFile(...args) {

@@ -71,0 +79,0 @@ console.warn('parse() deprecated, use parse()'); // eslint-disable-line

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

/* global TextDecoder, TextEncoder */
import {concatenateArrayBuffers} from '../javascript-utils/memory-copy-utils';
import {TextDecoder, TextEncoder} from '../javascript-utils/text-encoding';

@@ -4,0 +4,0 @@ // GENERAL UTILITIES

@@ -1,4 +0,3 @@

/* global FileReader, Blob, ArrayBuffer, Buffer */
/* global FileReader, Blob, ArrayBuffer, Buffer, TextEncoder */
import assert from '../utils/assert';
import {TextEncoder} from './text-encoding';

@@ -5,0 +4,0 @@ export const isArrayBuffer = x => x && x instanceof ArrayBuffer;

import {isBrowser} from '../utils/globals';
import {concatenateArrayBuffers} from './memory-copy-utils';

@@ -69,26 +68,1 @@ export function getStreamIterator(stream) {

}
// TODO - remove? can this be handled via corresponding AsyncIterator function?
export function concatenateReadStream(readStream) {
let arrayBuffer = new ArrayBuffer();
let string = '';
return new Promise((resolve, reject) => {
readStream.data(chunk => {
if (typeof chunk === 'string') {
string += chunk;
} else {
arrayBuffer = concatenateArrayBuffers(arrayBuffer, chunk);
}
});
readStream.on('error', error => reject(error));
readStream.on('end', () => {
if (readStream.complete) {
resolve(arrayBuffer || string);
} else {
reject('The connection was terminated while the message was still being sent');
}
});
});
}

@@ -1,40 +0,16 @@

import {isBrowser} from '../../utils/globals';
// fetch-file-node is excluded from build under browser so don't do indivdual imports
import * as node from '../../node/fetch/fetch-file-node';
// Import individual symbols for browser version to ensure tree-shaking is enabled
import {
fetchFile as browserFetchFile,
readFileSync as browserReadFileSync,
createReadStream as browserCreateReadStream
} from './fetch-file-browser';
/* global fetch */
import {resolvePath} from './file-aliases';
// Reads raw file data from:
// As fetch but respects pathPrefix and file aliases
// Reads file data from:
// * data urls
// * http/http urls
// * data urls
// * File/Blob objects
// etc?
// * File/Blob objects (TBA)
export async function fetchFile(url, options) {
url = resolvePath(url);
const func = isBrowser ? browserFetchFile : node.fetchFile;
return func(url, options);
// TODO - SUPPORT reading from `File` objects
// if (typeof File !== 'undefined' && uri instanceof File) {
// readFileObject(uri, options);
// }
return fetch(url, options);
}
// In a few cases (data URIs, node.js) "files" can be read synchronously
export function readFileSync(url, options = {}) {
url = resolvePath(url);
const func = isBrowser ? browserReadFileSync : node.readFileSync;
return func(url, options);
}
// DEPRECATED
// Returns a promise that resolves to a readable stream
export async function createReadStream(url, options) {
url = resolvePath(url);
const func = isBrowser ? browserCreateReadStream : node.createReadStream;
return func(url, options);
}
import {isBrowser} from '../../utils/globals';
import assert from '../../utils/assert';
import * as node from '../../node/fetch/write-file-node';
import * as node from '../../node/write-file.node';
import {resolvePath} from './file-aliases';
export function writeFile(filePath, arrayBufferOrString, options) {
if (!isBrowser) {
filePath = resolvePath(filePath);
if (!isBrowser && node.writeFile) {
return node.writeFile(filePath, arrayBufferOrString, options);

@@ -13,3 +15,4 @@ }

export function writeFileSync(filePath, arrayBufferOrString, options) {
if (!isBrowser) {
filePath = resolvePath(filePath);
if (!isBrowser && node.writeFileSync) {
return node.writeFileSync(filePath, arrayBufferOrString, options);

@@ -16,0 +19,0 @@ }

@@ -30,4 +30,7 @@ import {fetchFile} from './fetch/fetch-file';

// at this point, data can be binary or text
const response = await fetchFile(url, options);
return parse(response, loaders, options, url);
let data = url;
if (typeof data === 'string') {
data = await fetchFile(url, options);
}
return parse(data, loaders, options, url);
}
import {normalizeLoader} from './normalize-loader';
const EXT_PATTERN = /[^\.]+$/;
const EXT_PATTERN = /[^.]+$/;

@@ -5,0 +5,0 @@ // Find a loader that works for extension/text

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

/* global TextDecoder */
import {

@@ -9,3 +10,2 @@ isFetchResponse,

import {getStreamIterator} from '../../javascript-utils/stream-utils';
import {TextDecoder} from '../../javascript-utils/text-encoding';

@@ -12,0 +12,0 @@ const ERR_DATA = 'Cannot convert supplied data type';

@@ -15,3 +15,3 @@ import assert from '../utils/assert';

// TODO - should accept loader.parseAsyncIterator and concatenate.
export async function parseWithLoader(data, loader, options = {}, url) {
export async function parseWithLoader(data, loader, options, url) {
url = url || getUrlFromData(data);

@@ -46,3 +46,3 @@ data = await getArrayBufferOrStringFromData(data, loader);

// TODO - should accept loader.parseSync/parse and generate 1 chunk asyncIterator
export function parseWithLoaderSync(data, loader, options = {}, url) {
export function parseWithLoaderSync(data, loader, options, url) {
data = getArrayBufferOrStringFromDataSync(data, loader);

@@ -63,3 +63,3 @@

export async function parseWithLoaderInBatches(data, loader, options = {}, url) {
export async function parseWithLoaderInBatches(data, loader, options, url) {
// Create async iterator adapter for data, and concatenate result

@@ -76,3 +76,3 @@ if (loader.parseInBatches) {

export async function parseWithLoaderInBatchesSync(data, loader, options = {}, url) {
export async function parseWithLoaderInBatchesSync(data, loader, options, url) {
// Create async iterator adapter for data, and concatenate result

@@ -79,0 +79,0 @@ if (loader.parseInBatchesSync) {

@@ -94,5 +94,12 @@ import {autoDetectLoader} from './loader-utils/auto-detect-loader';

// TODO - explain why this optionb is needed for parsing
options = Object.assign({}, loader.DEFAULT_OPTIONS, loader.options, options, {
dataType: 'arraybuffer'
});
options = Object.assign(
{},
loader.DEFAULT_OPTIONS,
loader.defaultOptions,
loader.options,
options,
{
dataType: 'arraybuffer'
}
);

@@ -99,0 +106,0 @@ // LOGGING

import {encode, encodeSync} from './encode';
import {writeFile, writeFileSync} from './fetch/write-file';
export function save(data, url, writer) {
const encodedData = encode(data, writer, url);
export function save(data, url, writer, options) {
const encodedData = encode(data, writer, options, url);
return writeFile(url, encodedData);
}
export function saveSync(data, url, writer) {
const encodedData = encodeSync(data, writer, url);
export function saveSync(data, url, writer, options) {
const encodedData = encodeSync(data, writer, options, url);
return writeFileSync(url, encodedData);
}

@@ -24,2 +24,3 @@ // Copyright (c) 2015 - 2017 Uber Technologies, Inc.

/* eslint-disable no-restricted-globals */
/* global process, window, global, document */

@@ -26,0 +27,0 @@ const isBrowser =

Sorry, the diff of this file is too big to display

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

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

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

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

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

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

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

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

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

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

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

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

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