@loaders.gl/core
Advanced tools
Comparing version 2.0.0-alpha.1 to 2.0.0-alpha.2
@@ -1,1 +0,1 @@ | ||
!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var n=r();for(var t in n)("object"==typeof exports?exports:e)[t]=n[t]}}(window,(function(){return function(e){var r={};function n(t){if(r[t])return r[t].exports;var o=r[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=r,n.d=function(e,r,t){n.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},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,r){if(1&r&&(e=n(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(n.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)n.d(t,o,function(r){return e[r]}.bind(null,o));return t},n.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(r,"a",r),r},n.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},n.p="",n(n.s=5)}([function(e,r,n){"use strict";(function(e,t){n.d(r,"c",(function(){return o})),n.d(r,"e",(function(){return i})),n.d(r,"f",(function(){return u})),n.d(r,"b",(function(){return c})),n.d(r,"a",(function(){return a})),n.d(r,"d",(function(){return l}));const o="object"!=typeof e||"[object process]"!==String(e)||e.browser,s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==t&&t,document:"undefined"!=typeof document&&document},i=s.self||s.window||s.global,u=s.window||s.self||s.global,c=s.global||s.self||s.window,a=s.document||{},f=void 0!==e&&e.version&&e.version.match(/v([0-9]*)/),l=f&&parseFloat(f[1])||0}).call(this,n(6),n(4))},function(e,r){},function(e,r){},function(e,r){},function(e,r){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,r,n){(function(r){const t=n(7),o="undefined"==typeof window?r:window;o.loaders=o.loaders||{},e.exports=Object.assign(o.loaders,t)}).call(this,n(4))},function(e,r){var n,t,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(r){try{return n.call(null,e,0)}catch(r){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{t="function"==typeof clearTimeout?clearTimeout:i}catch(e){t=i}}();var c,a=[],f=!1,l=-1;function d(){f&&c&&(f=!1,c.length?a=c.concat(a):l=-1,a.length&&y())}function y(){if(!f){var e=u(d);f=!0;for(var r=a.length;r;){for(c=a,a=[];++l<r;)c&&c[l].run();l=-1,r=a.length}c=null,f=!1,function(e){if(t===clearTimeout)return clearTimeout(e);if((t===i||!t)&&clearTimeout)return t=clearTimeout,clearTimeout(e);try{t(e)}catch(r){try{return t.call(null,e)}catch(r){return t.call(this,e)}}}(e)}}function h(e,r){this.fun=e,this.array=r}function p(){}o.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)r[n-1]=arguments[n];a.push(new h(e,r)),1!==a.length||f||u(y)},h.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=p,o.addListener=p,o.once=p,o.off=p,o.removeListener=p,o.removeAllListeners=p,o.emit=p,o.prependListener=p,o.prependOnceListener=p,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,r,n){"use strict";n.r(r);var t={};function o(e,r){if(!e)throw new Error(r||"loader assertion failed.")}function s(e){if(!e)return!1;return Array.isArray(e)&&(e=e[0]),e.parseTextSync||e.parseSync||e.parse||e.parseStream||e.parseInBatches||e.worker}function i(e){let r;return o(s(e),"invalid loader"),Array.isArray(e)&&(r=e[1],e=e[0],e={...e,options:{...e.options,...r}}),e.extension&&(e.extensions=e.extensions||e.extension,delete e.extension),Array.isArray(e.extensions)||(e.extensions=[e.extensions]),o(e.extensions&&e.extensions.length>0&&e.extensions[0]),e.parseTextSync&&(e.text=!0),e.text||(e.binary=!0),e}n.r(t),n.d(t,"dirname",(function(){return fe}));class u{log(){return e=>{}}info(){return e=>{}}warn(){return e=>{}}error(){return e=>{}}}const c={log:new class{constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}}},a=e=>e&&"object"==typeof e&&e.constructor==={}.constructor;function f(e,r){const n=e&&(e.DEFAULT_OPTIONS||e.defaultOptions||e.options||{}),t={...c,...n,dataType:"arraybuffer",...r};null===t.log&&(t.log=new u);for(const e in r){const o=r[e];a(o)&&e in n&&(a(n[e])?t[e]={...n[e],...r[e]}:t.log.warn(`Nested option ${e} not recognized`)())}return t}const l=e=>"boolean"==typeof e,d=e=>"function"==typeof e,y=e=>null!==e&&"object"==typeof e,h=e=>y(e)&&d(e.then),p=e=>e&&"function"==typeof e[Symbol.iterator],w=e=>e&&"function"==typeof e[Symbol.asyncIterator],b=e=>e&&d(e.next),g=e=>"undefined"!=typeof Response&&e instanceof Response||e.arrayBuffer&&e.text&&e.json,m=e=>(e=>"undefined"!=typeof File&&e instanceof File)(e)||(e=>"undefined"!=typeof Blob&&e instanceof Blob)(e),x=e=>(e=>y(e)&&d(e.tee)&&d(e.cancel)&&d(e.pipeTo)&&d(e.getReader))(e)||(e=>y(e)&&d(e.read)&&d(e.pipe)&&l(e.readable))(e),A=e=>(e=>y(e)&&d(e.abort)&&d(e.getWriter))(e)||(e=>y(e)&&d(e.end)&&d(e.write)&&l(e.writable))(e);var S=n(0);function v(e){if(S.c||S.d>=10){if("function"==typeof e[Symbol.asyncIterator])return e;if("function"==typeof e.getIterator)return e.getIterator()}return S.c?async function*(e){const r=e.getReader();try{for(;;){const{done:e,value:n}=await r.read();if(e)return;yield n}}catch(e){r.releaseLock()}}(e):async function*(e){e=await e;for(;;){const r=e.read();if(null===r){if(e._readableState.ended)return;await B(e)}else yield r}}(e)}async function B(e){return new Promise(r=>{e.once("readable",r)})}class T{constructor(e){this._fileOrBlob=e,this.bodyUsed=!1}get headers(){return new Headers({"Content-Length":this._fileOrBlob.size,"Content-Type":this._fileOrBlob.type})}get ok(){return!0}get status(){return 200}get url(){return this._fileOrBlob.name||""}async arrayBuffer(){const{reader:e,promise:r}=this._getFileReader();return e.readAsArrayBuffer(this._fileOrBlob),r}async text(){const{reader:e,promise:r}=this._getFileReader();return e.readAsText(this._fileOrBlob),r}async json(){const e=await this.text();return JSON.parse(e)}_getFileReader(){let e;o(!this.bodyUsed),this.bodyUsed=!0;const r=new Promise((r,n)=>{try{(e=new FileReader).onerror=e=>n(new Error(e)),e.onabort=()=>n(new Error("Read aborted.")),e.onload=()=>r(e.result)}catch(e){n(e)}});return{reader:e,promise:r}}}function k(e,r){return Promise.resolve(new T(e,r))}const j="Cannot convert supplied data type";function _(e,r){if(r.text&&"string"==typeof e)return e;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){const n=e.buffer||e;if(r.text&&!r.binary){return new TextDecoder("utf8").decode(n)}return n}throw new Error(j)}async function F(e,r){const n=(e=await e)instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||n)return _(e,r);if(m(e)&&(e=await k(e)),g(e))return await async function(e){if(!e.ok){let r=`fetch failed ${e.status} `;try{r+=await e.text()}catch(e){}throw new Error(r)}}(e),r.binary?await e.arrayBuffer():await e.text();throw new Error(j)}function I(e){return b(e)?e:g(e)&&e.body?(function(e){if(!e.ok)throw new Error(`fetch failed ${e.status}`)}(e),v(e.body)):x(e)?v(e):w(e)?e[Symbol.asyncIterator]():E(e)}function E(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return function*(){yield e.buffer||e}();if(b(e))return e;if(p(e))return e[Symbol.iterator]();throw new Error(j)}function O(e,r,n){return n||(e={fetch:e.fetch||"undefined"!=typeof window&&window.fetch,...e},Array.isArray(e.loaders)||(e.loaders=null),e)}function P(e,r){if(!r&&!Array.isArray(e))return e;let n;if(e&&(n=Array.isArray(e)?e:[e]),r&&r.loaders){const e=Array.isArray(r.loaders)?r.loaders:[r.loaders];n=n?[...n,...e]:e}return n&&n.length?n:null}var D=n(3);function L(e){if(D.toArrayBuffer&&(e=Object(D.toArrayBuffer)(e)),e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const r=e;return(new TextEncoder).encode(r).buffer}return o(!1)}function M(e,r=!0,n=[]){if(e){if(e instanceof ArrayBuffer)n.push(e);else if(e.buffer&&e.buffer instanceof ArrayBuffer)n.push(e.buffer);else if(r&&"object"==typeof e)for(const t in e)M(e[t],r,n)}else;return n}const C=new Map;let R=0;function W({data:e,resolve:r}){r(e)}class ${constructor({source:e,name:r=`web-worker-${R++}`,onMessage:n}){const t=function(e){if(o("string"==typeof e,"worker source"),e.startsWith("url(")&&e.endsWith(")"))return e.match(/^url\((.*)\)$/)[1];let r=C.get(e);if(!r){const n=new Blob([e],{type:"application/javascript"});r=URL.createObjectURL(n),C.set(e,r)}return r}(e);this.worker=new Worker(t,{name:r}),this.name=r,this.onMessage=n||W}async process(e){return new Promise((r,n)=>{this.worker.onmessage=e=>this.onMessage({worker:this.worker,data:e.data,resolve:r,reject:n}),this.worker.onerror=e=>n(e);const t=M(e);this.worker.postMessage(e,t)})}destroy(){this.worker.terminate(),this.worker=null}}class Q{constructor({source:e,name:r="unnamed",maxConcurrency:n=1,onMessage:t,onDebug:o=(()=>{})}){this.source=e,this.name=r,this.maxConcurrency=n,this.onMessage=t,this.onDebug=o,this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}async process(e,r){return new Promise((n,t)=>{this.jobQueue.push({data:e,jobName:r,resolve:n,reject:t}),this._startQueuedJob()})}_startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const r=this.jobQueue.shift();this.onDebug({message:"processing",worker:e.name,job:r.jobName,backlog:this.jobQueue.length}),e.process(r.data).then(e=>r.resolve(e)).catch(e=>r.reject(e)).then(()=>this._onWorkerDone(e))}_onWorkerDone(e){this.isDestroyed?e.destroy():(this.idleQueue.push(e),this._startQueuedJob())}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift();if(this.count<this.maxConcurrency){this.count++;const e=`${this.name.toLowerCase()}-worker-${this.count}-of-${this.maxConcurrency}`;return new $({source:this.source,onMessage:this.onMessage,name:e})}return null}}const U=5;class N{constructor({maxConcurrency:e=U,onMessage:r,onDebug:n=(()=>{})}){this.maxConcurrency=e,this.onMessage=r,this.onDebug=n,this.workerPools=new Map}setProps(e){"maxConcurrency"in e&&(this.maxConcurrency=e.maxConcurrency),"onDebug"in e&&(this.onDebug=e.onDebug)}destroy(){this.workerPools.forEach(e=>e.destroy())}async process(e,r,n){return this._getWorkerPool(e,r).process(n)}_getWorkerPool(e,r){let n=this.workerPools.get(r);return n||(n=new Q({source:e,name:r,onMessage:this.onMessage,maxConcurrency:this.maxConcurrency,onDebug:this.onDebug}),this.workerPools.set(r,n)),n}}let V=null;async function J({worker:e,data:r,resolve:n,reject:t}){switch(r.type){case"done":n(r.result);break;case"process":try{const n=await re(r.arraybuffer,r.options,r.url);e.postMessage({type:"process-done",id:r.id,result:n},M(n))}catch(n){e.postMessage({type:"process-error",id:r.id,message:n.message})}break;case"error":t(r.message)}}function z(e,r,n,t={},o={}){const s=function(e={}){const r={};return e.maxConcurrency&&(r.maxConcurrency=e.maxConcurrency),e.onDebug&&(r.onDebug=e.onDebug),V||(V=new N({onMessage:J})),V.setProps(r),V}(t);return t=JSON.parse(JSON.stringify(t)),s.process(e,`loaders.gl-${r}`,{arraybuffer:L(n),options:t,source:"loaders.gl",type:"process"})}let q=[];function H(e){e=Array.isArray(e)?e:[e];for(const r of e){const e=i(r);q.find(r=>e===r)||q.unshift(e)}}function G(){q=[]}const K=/[^.]+$/;function X(e,r="",n=null,{nothrow:t=!1}={}){if(r=r||"",e&&!Array.isArray(e)){const r=e;return i(r),r}(function(e){for(const r of e)i(r)})(e=[...e||[],...q]),r=r.replace(/\?.*/,"");let o=null;if(!(o=(o=o||function(e,r){const n=r.match(K),t=n&&n[0];return t&&function(e,r){r=r.toLowerCase();for(const n of e)for(const e of n.extensions)if(e.toLowerCase()===r)return n;return null}(e,t)}(e,r))||function(e,r){if(!r)return null;for(const n of e)if("string"==typeof r){if(Y(r,n))return n}else if(ArrayBuffer.isView(r)){if(Z(r.buffer,r.byteOffset,n))return n}else if(r instanceof ArrayBuffer){if(Z(r,0,n))return n}return null}(e,n))){if(t)return null;let e="No valid loader found";throw n&&(e+=` for data starting with "${function(e,r=5){if("string"==typeof e)return e.slice(0,r);if(ArrayBuffer.isView(e))return ee(e.buffer,e.byteOffset,r);if(e instanceof ArrayBuffer){return ee(e,0,r)}return""}(n)}"`),r&&(e+=` for ${r}`),new Error(e)}return o}function Y(e,r){return r.testText&&r.testText(e)}function Z(e,r,n){switch(Array.isArray(n.test)?"array":typeof n.test){case"function":return n.test(e,n);case"string":case"array":return(Array.isArray(n.test)?n.test:[n.test]).some(n=>{return n===ee(e,r,n.length)});default:return!1}}function ee(e,r,n){if(e.byteLength<=r+n)return"";const t=new DataView(e);let o="";for(let e=0;e<n;e++)o+=String.fromCharCode(t.getUint8(r+e));return o}async function re(e,r,n,t){Array.isArray(r)||s(r)||(t=n,n=r,r=null);let i="";"string"==typeof t&&(i=t,t=null),n=n||{};const u=function(e,r){return g(e)?r=r||e.url:m(r)&&(r=r.name),"string"==typeof r?r.replace(/\?.*/,""):r}(e,i),c=P(r,t),a=X(c,u,e);return a?(n=f(a,n),t=O({url:u,parse:re,loaders:c},0,t),await async function(e,r,n,t){if(r=await F(r,e),e.parseTextSync&&"string"==typeof r)return n.dataType="text",e.parseTextSync(r,n,t,e);if(e.parse)return await e.parse(r,n,t,e);if(e.parseSync)return e.parseSync(r,n,t,e);if(e.worker)return await z(e.worker,e.name,r,n,t);return o(!1)}(a,e,n,t)):null}function ne(e,r,n,t){Array.isArray(r)||s(r)||(t=n,n=r,r=null);let o="";"string"==typeof t&&(o=t,t=null),n=n||{};const i=X(P(r,t),o,e);return i?function(e,r,n,t){if(r=_(r,e),e.parseTextSync&&"string"==typeof r)return e.parseTextSync(r,n,t,e);if(e.parseSync)return e.parseSync(r,n,t,e);throw new Error(`${e.name}: Loader does not support 'parseSync' (${t.url||"data"})`)}(i,e,n=f(i,n),t=O({url:o,parseSync:ne,loaders:r})):null}let te="";const oe={};function se(e){te=e}function ie(){return te}function ue(e){for(const r in oe)if(e.startsWith(r)){const n=oe[r];return e.replace(r,n)}return e+=te}async function ce(e,r){return m(e)?k(e,r):(e=ue(e),fetch(e,r))}async function ae(e,r,n){Array.isArray(r)||s(r)||(n=r,r=null);let t=e;return"string"==typeof e&&(t=await ce(e,n)),m(e)&&(t=await ce(e,n),e=null),await re(t,r,n,e)}function fe(e){const r=e&&e.lastIndexOf("/");return r>=0?e.substr(0,r):""}var le=n(2);const de={dataType:"arraybuffer",nothrow:!0},ye=e=>e.startsWith("data:");function he(e,r){return r=function(e={}){return(e=Object.assign({},de,e)).responseType=e.responseType||e.dataType,e}(r),ye(e),r.nothrow||o(!1),null}function pe(e,r={}){return e=ue(e),!S.c&&le.readFileSync?le.readFileSync(e,r):he(e,r)}var we=n(1);function be(e,r,n){return e=ue(e),!S.c&&we.writeFile?we.writeFile(e,r,n):o(!1)}function ge(e,r,n){return e=ue(e),!S.c&&we.writeFileSync?we.writeFileSync(e,r,n):o(!1)}function me(e){return`Failed to fetch resource ${e.url}(${e.status}): ${e.statusText} `}async function xe(e){let r=`Failed to fetch resource ${e.url} (${e.status}): `;try{e.headers.get("Content-Type").includes("application/json")?r+=await e.text():r+=e.statusText}catch(e){return r}return r}async function Ae(e,r,n,t){Array.isArray(r)||s(r)||(t=n,n=r,r=null);const o=X(r,t,null);return function(e,r,n,t){if(e.parseInBatches){const o=I(r);return e.parseInBatches(o,n,t,e)}throw new Error("parseWithLoaderInBatchesSync not available")}(o,e,n=f(o,n),O({url:t,loaders:r}))}async function Se(e,r,n,t){Array.isArray(r)||s(r)||(t=n,n=r,r=null);const o=X(r,t,null);return function(e,r,n,t){if(e.parseInBatchesSync){const o=E(r);return e.parseInBatchesSync(o,n,t,e)}throw new Error("parseWithLoaderInBatchesSync not available")}(o,e,n=f(o,n),O({url:t,loaders:r}))}async function ve(e,r,n){return Ae(await ce(e,n),r,n,e)}function Be(e,r,n,t){if(r.encode)return r.encode(e,n);if(r.encodeSync)return Promise.resolve(r.encodeSync(e,n));throw new Error("Writer could not encode data")}function Te(e,r,n,t){if(r.encodeSync)return r.encodeSync(e,n);throw new Error("Writer could not synchronously encode data")}function ke(e,r,n,t){if(r.encodeInBatches)return r.encodeInBatches(e,n);throw new Error("Writer could not encode data in batches")}function je(e,r,n,t){return be(r,Be(e,n,t))}function _e(e,r,n,t){return ge(r,Te(e,n,t))}function Fe(e,r){const n=e instanceof ArrayBuffer?new Uint8Array(e):e,t=r instanceof ArrayBuffer?new Uint8Array(r):r,o=new Uint8Array(n.byteLength+t.byteLength);return o.set(n,0),o.set(t,n.byteLength),o}async function Ie(e,r){for(;;){const{done:n,value:t}=await e.next();if(n)return void e.return();if(r(t))return}}async function Ee(e){let r=new ArrayBuffer,n="";for await(const t of e)"string"==typeof t?n+=t:r=Fe(r,t);return n||r}async function*Oe(e,r){const n=new TextDecoder(r);for await(const r of e)yield"string"==typeof r?r:n.decode(r,{stream:!0})}async function*Pe(e){let r="";for await(const n of e){let e;for(r+=n;(e=r.indexOf("\n"))>=0;){const n=r.slice(0,e+1);r=r.slice(e+1),yield n}}r.length>0&&(yield r)}async function*De(e){let r=1;for await(const n of e)yield{counter:r,line:n},r++}async function Le(e,r,n=(()=>{}),t=(()=>{})){if(!(e=await e).ok)return e;if(!e.body)return e;const o=e.headers.get("content-length"),s=o&&parseInt(o,10);if(!(o>0))return e;if("undefined"==typeof ReadableStream)return e;const i=new ReadableStream({start(o){!async function e(r,n,t,o,s,i,u){try{const{done:c,value:a}=await n.read();if(c)return i(),void r.close();t+=a.byteLength;const f=Math.round(t/o*100);s(f,{loadedBytes:t,totalBytes:o}),r.enqueue(a),await e(r,n,t,o,s,i,u)}catch(e){r.error(e),u(e)}}(o,e.body.getReader(),0,s,r,n,t)}});return new Response(i)}n.d(r,"TextEncoder",(function(){return Me})),n.d(r,"TextDecoder",(function(){return Ce})),n.d(r,"createReadStream",(function(){return Re})),n.d(r,"parseFile",(function(){return We})),n.d(r,"parseFileSync",(function(){return $e})),n.d(r,"loadFile",(function(){return Qe})),n.d(r,"path",(function(){return t})),n.d(r,"setPathPrefix",(function(){return se})),n.d(r,"getPathPrefix",(function(){return ie})),n.d(r,"resolvePath",(function(){return ue})),n.d(r,"fetchFile",(function(){return ce})),n.d(r,"readFileSync",(function(){return pe})),n.d(r,"writeFile",(function(){return be})),n.d(r,"writeFileSync",(function(){return ge})),n.d(r,"_getErrorMessageFromResponseSync",(function(){return me})),n.d(r,"_getErrorMessageFromResponse",(function(){return xe})),n.d(r,"registerLoaders",(function(){return H})),n.d(r,"parse",(function(){return re})),n.d(r,"parseSync",(function(){return ne})),n.d(r,"parseInBatches",(function(){return Ae})),n.d(r,"parseInBatchesSync",(function(){return Se})),n.d(r,"load",(function(){return ae})),n.d(r,"loadInBatches",(function(){return ve})),n.d(r,"encode",(function(){return Be})),n.d(r,"encodeSync",(function(){return Te})),n.d(r,"encodeInBatches",(function(){return ke})),n.d(r,"save",(function(){return je})),n.d(r,"saveSync",(function(){return _e})),n.d(r,"isPromise",(function(){return h})),n.d(r,"isIterable",(function(){return p})),n.d(r,"isAsyncIterable",(function(){return w})),n.d(r,"isIterator",(function(){return b})),n.d(r,"isFetchResponse",(function(){return g})),n.d(r,"isReadableStream",(function(){return x})),n.d(r,"isWritableStream",(function(){return A})),n.d(r,"toArrayBuffer",(function(){return L})),n.d(r,"getStreamIterator",(function(){return v})),n.d(r,"forEach",(function(){return Ie})),n.d(r,"concatenateAsyncIterator",(function(){return Ee})),n.d(r,"lineAsyncIterator",(function(){return Pe})),n.d(r,"textDecoderAsyncIterator",(function(){return Oe})),n.d(r,"numberedLineAsyncIterator",(function(){return De})),n.d(r,"isBrowser",(function(){return S.c})),n.d(r,"self",(function(){return S.e})),n.d(r,"window",(function(){return S.f})),n.d(r,"global",(function(){return S.b})),n.d(r,"document",(function(){return S.a})),n.d(r,"assert",(function(){return o})),n.d(r,"_selectLoader",(function(){return X})),n.d(r,"_WorkerThread",(function(){return $})),n.d(r,"_WorkerFarm",(function(){return N})),n.d(r,"_WorkerPool",(function(){return Q})),n.d(r,"_fetchProgress",(function(){return Le})),n.d(r,"_unregisterLoaders",(function(){return G}));const Me=S.b.TextEncoder,Ce=S.b.TextDecoder;async function Re(e,r){return console.warn("createReadStream() deprecated, use fetch().then(resp => resp.body)"),e=ue(e),(await ce(e,r)).body}function We(...e){return console.warn("parse() deprecated, use parse()"),re(...e)}function $e(...e){return console.warn("parseSync() deprecated, use parseSync()"),ne(...e)}function Qe(...e){return console.warn("loadFile() deprecated, use load()"),ae(...e)}}])})); | ||
!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r();else if("function"==typeof define&&define.amd)define([],r);else{var t=r();for(var n in t)("object"==typeof exports?exports:e)[n]=t[n]}}(window,(function(){return function(e){var r={};function t(n){if(r[n])return r[n].exports;var o=r[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:n})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,r){if(1&r&&(e=t(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(t.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var o in e)t.d(n,o,function(r){return e[r]}.bind(null,o));return n},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},t.p="",t(t.s=5)}([function(e,r,t){"use strict";(function(e,n){t.d(r,"c",(function(){return o})),t.d(r,"e",(function(){return i})),t.d(r,"f",(function(){return u})),t.d(r,"b",(function(){return a})),t.d(r,"a",(function(){return c})),t.d(r,"d",(function(){return l}));const o="object"!=typeof e||"[object process]"!==String(e)||e.browser,s={self:"undefined"!=typeof self&&self,window:"undefined"!=typeof window&&window,global:void 0!==n&&n,document:"undefined"!=typeof document&&document},i=s.self||s.window||s.global,u=s.window||s.self||s.global,a=s.global||s.self||s.window,c=s.document||{},f=void 0!==e&&e.version&&e.version.match(/v([0-9]*)/),l=f&&parseFloat(f[1])||0}).call(this,t(6),t(4))},function(e,r){},function(e,r){},function(e,r){},function(e,r){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(e){"object"==typeof window&&(t=window)}e.exports=t},function(e,r,t){(function(r){const n=t(7),o="undefined"==typeof window?r:window;o.loaders=o.loaders||{},e.exports=Object.assign(o.loaders,n)}).call(this,t(4))},function(e,r){var t,n,o=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function i(){throw new Error("clearTimeout has not been defined")}function u(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(r){try{return t.call(null,e,0)}catch(r){return t.call(this,e,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:i}catch(e){n=i}}();var a,c=[],f=!1,l=-1;function d(){f&&a&&(f=!1,a.length?c=a.concat(c):l=-1,c.length&&y())}function y(){if(!f){var e=u(d);f=!0;for(var r=c.length;r;){for(a=c,c=[];++l<r;)a&&a[l].run();l=-1,r=c.length}a=null,f=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===i||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(r){try{return n.call(null,e)}catch(r){return n.call(this,e)}}}(e)}}function h(e,r){this.fun=e,this.array=r}function p(){}o.nextTick=function(e){var r=new Array(arguments.length-1);if(arguments.length>1)for(var t=1;t<arguments.length;t++)r[t-1]=arguments[t];c.push(new h(e,r)),1!==c.length||f||u(y)},h.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=p,o.addListener=p,o.once=p,o.off=p,o.removeListener=p,o.removeAllListeners=p,o.emit=p,o.prependListener=p,o.prependOnceListener=p,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,r,t){"use strict";t.r(r);var n={};function o(e){const r=e&&e.lastIndexOf("/");return r>=0?e.substr(0,r):""}t.r(n),t.d(n,"dirname",(function(){return o}));let s="";const i={};function u(e){s=e}function a(){return s}function c(e){for(const r in i)if(e.startsWith(r)){const t=i[r];return e.replace(r,t)}return e+=s}const f=e=>"boolean"==typeof e,l=e=>"function"==typeof e,d=e=>null!==e&&"object"==typeof e,y=e=>d(e)&&l(e.then),h=e=>e&&"function"==typeof e[Symbol.iterator],p=e=>e&&"function"==typeof e[Symbol.asyncIterator],w=e=>e&&l(e.next),b=e=>"undefined"!=typeof Response&&e instanceof Response||e.arrayBuffer&&e.text&&e.json,g=e=>(e=>"undefined"!=typeof File&&e instanceof File)(e)||(e=>"undefined"!=typeof Blob&&e instanceof Blob)(e),m=e=>(e=>d(e)&&l(e.tee)&&l(e.cancel)&&l(e.pipeTo)&&l(e.getReader))(e)||(e=>d(e)&&l(e.read)&&l(e.pipe)&&f(e.readable))(e),x=e=>(e=>d(e)&&l(e.abort)&&l(e.getWriter))(e)||(e=>d(e)&&l(e.end)&&l(e.write)&&f(e.writable))(e);function A(e,r){if(!e)throw new Error(r||"loader assertion failed.")}class S{constructor(e){this._fileOrBlob=e,this.bodyUsed=!1}get headers(){return new Headers({"Content-Length":this._fileOrBlob.size,"Content-Type":this._fileOrBlob.type})}get ok(){return!0}get status(){return 200}get url(){return this._fileOrBlob.name||""}async arrayBuffer(){const{reader:e,promise:r}=this._getFileReader();return e.readAsArrayBuffer(this._fileOrBlob),r}async text(){const{reader:e,promise:r}=this._getFileReader();return e.readAsText(this._fileOrBlob),r}async json(){const e=await this.text();return JSON.parse(e)}_getFileReader(){let e;A(!this.bodyUsed),this.bodyUsed=!0;const r=new Promise((r,t)=>{try{(e=new FileReader).onerror=e=>t(new Error(e)),e.onabort=()=>t(new Error("Read aborted.")),e.onload=()=>r(e.result)}catch(e){t(e)}});return{reader:e,promise:r}}}function v(e,r){return Promise.resolve(new S(e,r))}async function B(e,r){return g(e)?v(e,r):(e=c(e),fetch(e,r))}var T=t(0),k=t(2);const j={dataType:"arraybuffer",nothrow:!0},_=e=>e.startsWith("data:");function I(e,r){return r=function(e={}){return(e=Object.assign({},j,e)).responseType=e.responseType||e.dataType,e}(r),_(e),r.nothrow||A(!1),null}function O(e,r={}){return e=c(e),!T.c&&k.readFileSync?k.readFileSync(e,r):I(e,r)}var P=t(1);function E(e,r,t){return e=c(e),!T.c&&P.writeFile?P.writeFile(e,r,t):A(!1)}function F(e,r,t){return e=c(e),!T.c&&P.writeFileSync?P.writeFileSync(e,r,t):A(!1)}function L(e){return`Failed to fetch resource ${e.url}(${e.status}): ${e.statusText} `}async function M(e){let r=`Failed to fetch resource ${e.url} (${e.status}): `;try{e.headers.get("Content-Type").includes("application/json")?r+=await e.text():r+=e.statusText}catch(e){return r}return r}function C(e){if(!e)return!1;return Array.isArray(e)&&(e=e[0]),e.parseTextSync||e.parseSync||e.parse||e.parseStream||e.parseInBatches||e.worker}function D(e){let r;return A(e,"null loader"),A(C(e),"invalid loader"),Array.isArray(e)&&(r=e[1],e=e[0],e={...e,options:{...e.options,...r}}),e.extension&&(e.extensions=e.extensions||e.extension,delete e.extension),Array.isArray(e.extensions)||(e.extensions=[e.extensions]),A(e.extensions&&e.extensions.length>0&&e.extensions[0]),e.parseTextSync&&(e.text=!0),e.text||(e.binary=!0),e}let W=[];function $(e){e=Array.isArray(e)?e:[e];for(const r of e){const e=D(r);W.find(r=>e===r)||W.unshift(e)}}function R(){W=[]}class U{log(){return e=>{}}info(){return e=>{}}warn(){return e=>{}}error(){return e=>{}}}const Q={log:new class{constructor(){this.console=console}log(...e){return this.console.log.bind(this.console,...e)}info(...e){return this.console.info.bind(this.console,...e)}warn(...e){return this.console.warn.bind(this.console,...e)}error(...e){return this.console.error.bind(this.console,...e)}}},N=e=>e&&"object"==typeof e&&e.constructor==={}.constructor;function V(e,r,t){const n=e&&(e.DEFAULT_OPTIONS||e.defaultOptions||e.options||{}),o={...Q,...n,dataType:"arraybuffer",...r};return!t||"baseUri"in o||(o.baseUri=t),null===o.log&&(o.log=new U),function(e,r,t){for(const n in r){const o=r[n];N(o)&&n in t&&(N(t[n])?e[n]={...t[n],...r[n]}:e.log.warn(`Nested option ${n} not recognized`)())}}(o,r,n),o}function J(e){if(T.c||T.d>=10){if("function"==typeof e[Symbol.asyncIterator])return e;if("function"==typeof e.getIterator)return e.getIterator()}return T.c?async function*(e){const r=e.getReader();try{for(;;){const{done:e,value:t}=await r.read();if(e)return;yield t}}catch(e){r.releaseLock()}}(e):async function*(e){e=await e;for(;;){const r=e.read();if(null===r){if(e._readableState.ended)return;await z(e)}else yield r}}(e)}async function z(e){return new Promise(r=>{e.once("readable",r)})}const q="Cannot convert supplied data type";function H(e,r){if(r.text&&"string"==typeof e)return e;if(e instanceof ArrayBuffer||ArrayBuffer.isView(e)){const t=e.buffer||e;if(r.text&&!r.binary){return new TextDecoder("utf8").decode(t)}return t}throw new Error(q)}async function G(e,r){const t=(e=await e)instanceof ArrayBuffer||ArrayBuffer.isView(e);if("string"==typeof e||t)return H(e,r);if(g(e)&&(e=await v(e)),b(e))return await async function(e){if(!e.ok){let r=`fetch failed ${e.status} `;try{r+=await e.text()}catch(e){}throw new Error(r)}}(e),r.binary?await e.arrayBuffer():await e.text();throw new Error(q)}function K(e){return w(e)?e:b(e)&&e.body?(function(e){if(!e.ok)throw new Error(`fetch failed ${e.status}`)}(e),J(e.body)):m(e)?J(e):p(e)?e[Symbol.asyncIterator]():X(e)}function X(e){if(e instanceof ArrayBuffer||ArrayBuffer.isView(e))return function*(){yield e.buffer||e}();if(w(e))return e;if(h(e))return e[Symbol.iterator]();throw new Error(q)}function Y(e,r,t){return t||(e={fetch:e.fetch||B,...e},Array.isArray(e.loaders)||(e.loaders=null),e)}function Z(e,r){if(!r&&!Array.isArray(e))return e;let t;if(e&&(t=Array.isArray(e)?e:[e]),r&&r.loaders){const e=Array.isArray(r.loaders)?r.loaders:[r.loaders];t=t?[...t,...e]:e}return t&&t.length?t:null}var ee=t(3);function re(e){if(ee.toArrayBuffer&&(e=Object(ee.toArrayBuffer)(e)),e instanceof ArrayBuffer)return e;if(ArrayBuffer.isView(e))return e.buffer;if("string"==typeof e){const r=e;return(new TextEncoder).encode(r).buffer}return A(!1)}function te(e,r=!0,t=[]){if(e){if(e instanceof ArrayBuffer)t.push(e);else if(e.buffer&&e.buffer instanceof ArrayBuffer)t.push(e.buffer);else if(r&&"object"==typeof e)for(const n in e)te(e[n],r,t)}else;return t}const ne=new Map;let oe=0;function se({data:e,resolve:r}){r(e)}class ie{constructor({source:e,name:r=`web-worker-${oe++}`,onMessage:t}){const n=function(e){if(A("string"==typeof e,"worker source"),e.startsWith("url(")&&e.endsWith(")"))return e.match(/^url\((.*)\)$/)[1];let r=ne.get(e);if(!r){const t=new Blob([e],{type:"application/javascript"});r=URL.createObjectURL(t),ne.set(e,r)}return r}(e);this.worker=new Worker(n,{name:r}),this.name=r,this.onMessage=t||se}async process(e){return new Promise((r,t)=>{this.worker.onmessage=e=>this.onMessage({worker:this.worker,data:e.data,resolve:r,reject:t}),this.worker.onerror=e=>t(e);const n=te(e);this.worker.postMessage(e,n)})}destroy(){this.worker.terminate(),this.worker=null}}class ue{constructor({source:e,name:r="unnamed",maxConcurrency:t=1,onMessage:n,onDebug:o=(()=>{})}){this.source=e,this.name=r,this.maxConcurrency=t,this.onMessage=n,this.onDebug=o,this.jobQueue=[],this.idleQueue=[],this.count=0,this.isDestroyed=!1}destroy(){this.idleQueue.forEach(e=>e.destroy()),this.isDestroyed=!0}async process(e,r){return new Promise((t,n)=>{this.jobQueue.push({data:e,jobName:r,resolve:t,reject:n}),this._startQueuedJob()})}_startQueuedJob(){if(!this.jobQueue.length)return;const e=this._getAvailableWorker();if(!e)return;const r=this.jobQueue.shift();this.onDebug({message:"processing",worker:e.name,job:r.jobName,backlog:this.jobQueue.length}),e.process(r.data).then(e=>r.resolve(e)).catch(e=>r.reject(e)).then(()=>this._onWorkerDone(e))}_onWorkerDone(e){this.isDestroyed?e.destroy():(this.idleQueue.push(e),this._startQueuedJob())}_getAvailableWorker(){if(this.idleQueue.length>0)return this.idleQueue.shift();if(this.count<this.maxConcurrency){this.count++;const e=`${this.name.toLowerCase()}-worker-${this.count}-of-${this.maxConcurrency}`;return new ie({source:this.source,onMessage:this.onMessage,name:e})}return null}}const ae=5;class ce{constructor({maxConcurrency:e=ae,onMessage:r,onDebug:t=(()=>{})}){this.maxConcurrency=e,this.onMessage=r,this.onDebug=t,this.workerPools=new Map}setProps(e){"maxConcurrency"in e&&(this.maxConcurrency=e.maxConcurrency),"onDebug"in e&&(this.onDebug=e.onDebug)}destroy(){this.workerPools.forEach(e=>e.destroy())}async process(e,r,t){return this._getWorkerPool(e,r).process(t)}_getWorkerPool(e,r){let t=this.workerPools.get(r);return t||(t=new ue({source:e,name:r,onMessage:this.onMessage,maxConcurrency:this.maxConcurrency,onDebug:this.onDebug}),this.workerPools.set(r,t)),t}}let fe=null;async function le({worker:e,data:r,resolve:t,reject:n}){switch(r.type){case"done":t(r.result);break;case"process":try{const t=await ge(r.arraybuffer,r.options,r.url);e.postMessage({type:"process-done",id:r.id,result:t},te(t))}catch(t){e.postMessage({type:"process-error",id:r.id,message:t.message})}break;case"error":n(r.message)}}function de(e,r,t,n={},o={}){n.workerUrl&&(e=n.workerUrl.startsWith("http")?`\n try {\n importScripts('${n.workerUrl}')\n } catch (error) {\n console.error(error);\n }`:`url(${n.workerUrl})`);const s=function(e={}){const r={};return e.maxConcurrency&&(r.maxConcurrency=e.maxConcurrency),e.onDebug&&(r.onDebug=e.onDebug),fe||(fe=new ce({onMessage:le})),fe.setProps(r),fe}(n);return n=JSON.parse(JSON.stringify(n)),s.process(e,`loaders.gl-${r}`,{arraybuffer:re(t),options:n,source:"loaders.gl",type:"process"})}const ye=/[^.]+$/;function he(e,r="",t=null,{nothrow:n=!1}={}){if(r=r||"",e&&!Array.isArray(e)){const r=e;return D(r),r}(function(e){for(const r of e)D(r)})(e=[...e||[],...W]),r=r.replace(/\?.*/,"");let o=null;if(!(o=(o=o||function(e,r){const t=r.match(ye),n=t&&t[0];return n&&function(e,r){r=r.toLowerCase();for(const t of e)for(const e of t.extensions)if(e.toLowerCase()===r)return t;return null}(e,n)}(e,r))||function(e,r){if(!r)return null;for(const t of e)if("string"==typeof r){if(pe(r,t))return t}else if(ArrayBuffer.isView(r)){if(we(r.buffer,r.byteOffset,t))return t}else if(r instanceof ArrayBuffer){if(we(r,0,t))return t}return null}(e,t))){if(n)return null;let e="No valid loader found";throw t&&(e+=` for data starting with "${function(e,r=5){if("string"==typeof e)return e.slice(0,r);if(ArrayBuffer.isView(e))return be(e.buffer,e.byteOffset,r);if(e instanceof ArrayBuffer){return be(e,0,r)}return""}(t)}"`),r&&(e+=` for ${r}`),new Error(e)}return o}function pe(e,r){return r.testText&&r.testText(e)}function we(e,r,t){switch(Array.isArray(t.test)?"array":typeof t.test){case"function":return t.test(e,t);case"string":case"array":return(Array.isArray(t.test)?t.test:[t.test]).some(t=>{return t===be(e,r,t.length)});default:return!1}}function be(e,r,t){if(e.byteLength<=r+t)return"";const n=new DataView(e);let o="";for(let e=0;e<t;e++)o+=String.fromCharCode(n.getUint8(r+e));return o}async function ge(e,r,t,n){Array.isArray(r)||C(r)||(n=t,t=r,r=null);let o="";"string"==typeof n&&(o=n,n=null),t=t||{};const s=function(e,r){return b(e)?r=r||e.url:g(r)&&(r=r.name),"string"==typeof r?r.replace(/\?.*/,""):r}(e,o),i=Z(r,n),u=he(i,s,e);return u?(t=V(u,t,s),n=Y({url:s,parse:ge,loaders:i},0,n),await async function(e,r,t,n){if(r=await G(r,e),e.parseTextSync&&"string"==typeof r)return t.dataType="text",e.parseTextSync(r,t,n,e);if(e.parse)return await e.parse(r,t,n,e);if(e.parseSync)return e.parseSync(r,t,n,e);if(e.worker)return await de(e.worker,e.name,r,t,n);return A(!1)}(u,e,t,n)):null}function me(e,r,t,n){Array.isArray(r)||C(r)||(n=t,t=r,r=null);let o="";"string"==typeof n&&(o=n,n=null),t=t||{};const s=he(Z(r,n),o,e);return s?function(e,r,t,n){if(r=H(r,e),e.parseTextSync&&"string"==typeof r)return e.parseTextSync(r,t,n,e);if(e.parseSync)return e.parseSync(r,t,n,e);throw new Error(`${e.name}: Loader does not support 'parseSync' (${n.url||"data"})`)}(s,e,t=V(s,t,o),n=Y({url:o,parseSync:me,loaders:r})):null}async function xe(e,r,t,n){Array.isArray(r)||C(r)||(n=t,t=r,r=null);const o=he(r,n,null);return function(e,r,t,n){if(e.parseInBatches){const o=K(r);return e.parseInBatches(o,t,n,e)}throw new Error("parseWithLoaderInBatchesSync not available")}(o,e,t=V(o,t,n),Y({url:n,loaders:r}))}async function Ae(e,r,t,n){Array.isArray(r)||C(r)||(n=t,t=r,r=null);const o=he(r,n,null);return function(e,r,t,n){if(e.parseInBatchesSync){const o=X(r);return e.parseInBatchesSync(o,t,n,e)}throw new Error("parseWithLoaderInBatchesSync not available")}(o,e,t=V(o,t),Y({url:n,loaders:r}))}async function Se(e,r,t){Array.isArray(r)||C(r)||(t=r,r=null);let n=e;return"string"==typeof e&&(n=await B(e,t)),g(e)&&(n=await B(e,t),e=null),await ge(n,r,t,e)}async function ve(e,r,t){return xe(await B(e,t),r,t,e)}function Be(e,r,t,n){if(r.encode)return r.encode(e,t);if(r.encodeSync)return Promise.resolve(r.encodeSync(e,t));throw new Error("Writer could not encode data")}function Te(e,r,t,n){if(r.encodeSync)return r.encodeSync(e,t);throw new Error("Writer could not synchronously encode data")}function ke(e,r,t,n){if(r.encodeInBatches)return r.encodeInBatches(e,t);throw new Error("Writer could not encode data in batches")}function je(e,r,t,n){return E(r,Be(e,t,n))}function _e(e,r,t,n){return F(r,Te(e,t,n))}function Ie(e,r){const t=e instanceof ArrayBuffer?new Uint8Array(e):e,n=r instanceof ArrayBuffer?new Uint8Array(r):r,o=new Uint8Array(t.byteLength+n.byteLength);return o.set(t,0),o.set(n,t.byteLength),o}async function Oe(e,r){for(;;){const{done:t,value:n}=await e.next();if(t)return void e.return();if(r(n))return}}async function Pe(e){let r=new ArrayBuffer,t="";for await(const n of e)"string"==typeof n?t+=n:r=Ie(r,n);return t||r}async function*Ee(e,r){const t=new TextDecoder(r);for await(const r of e)yield"string"==typeof r?r:t.decode(r,{stream:!0})}async function*Fe(e){let r="";for await(const t of e){let e;for(r+=t;(e=r.indexOf("\n"))>=0;){const t=r.slice(0,e+1);r=r.slice(e+1),yield t}}r.length>0&&(yield r)}async function*Le(e){let r=1;for await(const t of e)yield{counter:r,line:t},r++}async function Me(e,r,t=(()=>{}),n=(()=>{})){if(!(e=await e).ok)return e;if(!e.body)return e;const o=e.headers.get("content-length"),s=o&&parseInt(o,10);if(!(o>0))return e;if("undefined"==typeof ReadableStream)return e;const i=new ReadableStream({start(o){!async function e(r,t,n,o,s,i,u){try{const{done:a,value:c}=await t.read();if(a)return i(),void r.close();n+=c.byteLength;const f=Math.round(n/o*100);s(f,{loadedBytes:n,totalBytes:o}),r.enqueue(c),await e(r,t,n,o,s,i,u)}catch(e){r.error(e),u(e)}}(o,e.body.getReader(),0,s,r,t,n)}});return new Response(i)}t.d(r,"path",(function(){return n})),t.d(r,"setPathPrefix",(function(){return u})),t.d(r,"getPathPrefix",(function(){return a})),t.d(r,"resolvePath",(function(){return c})),t.d(r,"fetchFile",(function(){return B})),t.d(r,"readFileSync",(function(){return O})),t.d(r,"writeFile",(function(){return E})),t.d(r,"writeFileSync",(function(){return F})),t.d(r,"_getErrorMessageFromResponseSync",(function(){return L})),t.d(r,"_getErrorMessageFromResponse",(function(){return M})),t.d(r,"registerLoaders",(function(){return $})),t.d(r,"parse",(function(){return ge})),t.d(r,"parseSync",(function(){return me})),t.d(r,"parseInBatches",(function(){return xe})),t.d(r,"parseInBatchesSync",(function(){return Ae})),t.d(r,"load",(function(){return Se})),t.d(r,"loadInBatches",(function(){return ve})),t.d(r,"encode",(function(){return Be})),t.d(r,"encodeSync",(function(){return Te})),t.d(r,"encodeInBatches",(function(){return ke})),t.d(r,"save",(function(){return je})),t.d(r,"saveSync",(function(){return _e})),t.d(r,"isPromise",(function(){return y})),t.d(r,"isIterable",(function(){return h})),t.d(r,"isAsyncIterable",(function(){return p})),t.d(r,"isIterator",(function(){return w})),t.d(r,"isFetchResponse",(function(){return b})),t.d(r,"isReadableStream",(function(){return m})),t.d(r,"isWritableStream",(function(){return x})),t.d(r,"toArrayBuffer",(function(){return re})),t.d(r,"getStreamIterator",(function(){return J})),t.d(r,"forEach",(function(){return Oe})),t.d(r,"concatenateAsyncIterator",(function(){return Pe})),t.d(r,"lineAsyncIterator",(function(){return Fe})),t.d(r,"textDecoderAsyncIterator",(function(){return Ee})),t.d(r,"numberedLineAsyncIterator",(function(){return Le})),t.d(r,"isBrowser",(function(){return T.c})),t.d(r,"self",(function(){return T.e})),t.d(r,"window",(function(){return T.f})),t.d(r,"global",(function(){return T.b})),t.d(r,"document",(function(){return T.a})),t.d(r,"assert",(function(){return A})),t.d(r,"_selectLoader",(function(){return he})),t.d(r,"_WorkerThread",(function(){return ie})),t.d(r,"_WorkerFarm",(function(){return ce})),t.d(r,"_WorkerPool",(function(){return ue})),t.d(r,"_fetchProgress",(function(){return Me})),t.d(r,"_unregisterLoaders",(function(){return R}))}])})); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.createReadStream = createReadStream; | ||
exports.parseFile = parseFile; | ||
exports.parseFileSync = parseFileSync; | ||
exports.loadFile = loadFile; | ||
Object.defineProperty(exports, "parse", { | ||
Object.defineProperty(exports, "setPathPrefix", { | ||
enumerable: true, | ||
get: function get() { | ||
return _parse.parse; | ||
return _fileAliases.setPathPrefix; | ||
} | ||
}); | ||
Object.defineProperty(exports, "parseSync", { | ||
Object.defineProperty(exports, "getPathPrefix", { | ||
enumerable: true, | ||
get: function get() { | ||
return _parseSync.parseSync; | ||
return _fileAliases.getPathPrefix; | ||
} | ||
}); | ||
Object.defineProperty(exports, "fetchFile", { | ||
Object.defineProperty(exports, "resolvePath", { | ||
enumerable: true, | ||
get: function get() { | ||
return _fetchFile.fetchFile; | ||
return _fileAliases.resolvePath; | ||
} | ||
}); | ||
Object.defineProperty(exports, "load", { | ||
Object.defineProperty(exports, "fetchFile", { | ||
enumerable: true, | ||
get: function get() { | ||
return _load.load; | ||
return _fetchFile.fetchFile; | ||
} | ||
}); | ||
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, "setPathPrefix", { | ||
enumerable: true, | ||
get: function get() { | ||
return _fileAliases2.setPathPrefix; | ||
} | ||
}); | ||
Object.defineProperty(exports, "getPathPrefix", { | ||
enumerable: true, | ||
get: function get() { | ||
return _fileAliases2.getPathPrefix; | ||
} | ||
}); | ||
Object.defineProperty(exports, "resolvePath", { | ||
enumerable: true, | ||
get: function get() { | ||
return _fileAliases2.resolvePath; | ||
} | ||
}); | ||
Object.defineProperty(exports, "readFileSync", { | ||
@@ -128,2 +76,14 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "parse", { | ||
enumerable: true, | ||
get: function get() { | ||
return _parse.parse; | ||
} | ||
}); | ||
Object.defineProperty(exports, "parseSync", { | ||
enumerable: true, | ||
get: function get() { | ||
return _parseSync.parseSync; | ||
} | ||
}); | ||
Object.defineProperty(exports, "parseInBatches", { | ||
@@ -141,2 +101,8 @@ enumerable: true, | ||
}); | ||
Object.defineProperty(exports, "load", { | ||
enumerable: true, | ||
get: function get() { | ||
return _load.load; | ||
} | ||
}); | ||
Object.defineProperty(exports, "loadInBatches", { | ||
@@ -262,2 +228,32 @@ enumerable: true, | ||
}); | ||
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", { | ||
@@ -299,26 +295,12 @@ enumerable: true, | ||
}); | ||
exports.path = exports.TextDecoder = exports.TextEncoder = void 0; | ||
exports.path = void 0; | ||
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator")); | ||
var path = _interopRequireWildcard(require("./lib/path/path")); | ||
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator")); | ||
exports.path = path; | ||
var _parse = require("./lib/parse"); | ||
var _fileAliases = require("./lib/fetch/file-aliases.js"); | ||
var _parseSync = require("./lib/parse-sync"); | ||
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 path = _interopRequireWildcard(require("./lib/path/path")); | ||
exports.path = path; | ||
var _fileAliases2 = require("./lib/fetch/file-aliases.js"); | ||
var _readFile = require("./lib/fetch/read-file"); | ||
@@ -332,2 +314,6 @@ | ||
var _parse = require("./lib/parse"); | ||
var _parseSync = require("./lib/parse-sync"); | ||
var _parseInBatches = require("./lib/parse-in-batches"); | ||
@@ -337,2 +323,4 @@ | ||
var _load = require("./lib/load"); | ||
var _loadInBatches = require("./lib/load-in-batches"); | ||
@@ -352,2 +340,4 @@ | ||
var _globals = require("./utils/globals"); | ||
var _assert = _interopRequireDefault(require("./utils/assert")); | ||
@@ -364,52 +354,2 @@ | ||
var _fetchProgress = _interopRequireDefault(require("./lib/progress/fetch-progress")); | ||
var TextEncoder = _globals.global.TextEncoder; | ||
exports.TextEncoder = TextEncoder; | ||
var TextDecoder = _globals.global.TextDecoder; | ||
exports.TextDecoder = TextDecoder; | ||
function createReadStream(_x, _x2) { | ||
return _createReadStream.apply(this, arguments); | ||
} | ||
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() { | ||
console.warn('parse() deprecated, use parse()'); | ||
return _parse.parse.apply(void 0, arguments); | ||
} | ||
function parseFileSync() { | ||
console.warn('parseSync() deprecated, use parseSync()'); | ||
return _parseSync.parseSync.apply(void 0, arguments); | ||
} | ||
function loadFile() { | ||
console.warn('loadFile() deprecated, use load()'); | ||
return _load.load.apply(void 0, arguments); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -15,2 +15,4 @@ "use strict"; | ||
var _fetchFile = require("../fetch/fetch-file"); | ||
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } | ||
@@ -26,3 +28,3 @@ | ||
context = _objectSpread({ | ||
fetch: context.fetch || typeof window !== 'undefined' && window.fetch | ||
fetch: context.fetch || _fetchFile.fetchFile | ||
}, context); | ||
@@ -29,0 +31,0 @@ |
@@ -28,3 +28,3 @@ "use strict"; | ||
function mergeOptions(loader, options) { | ||
function mergeOptions(loader, options, url) { | ||
var loaderDefaultOptions = loader && (loader.DEFAULT_OPTIONS || loader.defaultOptions || loader.options || {}); | ||
@@ -36,2 +36,6 @@ | ||
if (url && !('baseUri' in mergedOptions)) { | ||
mergedOptions.baseUri = url; | ||
} | ||
if (mergedOptions.log === null) { | ||
@@ -41,2 +45,7 @@ mergedOptions.log = new _loggers.NullLog(); | ||
mergeNesteFields(mergedOptions, options, loaderDefaultOptions); | ||
return mergedOptions; | ||
} | ||
function mergeNesteFields(mergedOptions, options, loaderDefaultOptions) { | ||
for (var key in options) { | ||
@@ -53,5 +62,3 @@ var value = options[key]; | ||
} | ||
return mergedOptions; | ||
} | ||
//# sourceMappingURL=merge-options.js.map |
@@ -33,2 +33,3 @@ "use strict"; | ||
function normalizeLoader(loader) { | ||
(0, _assert["default"])(loader, 'null loader'); | ||
(0, _assert["default"])(isLoaderObject(loader), 'invalid loader'); | ||
@@ -35,0 +36,0 @@ var options; |
@@ -111,2 +111,11 @@ "use strict"; | ||
var context = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; | ||
if (options.workerUrl) { | ||
if (options.workerUrl.startsWith('http')) { | ||
workerSource = "\n try {\n importScripts('".concat(options.workerUrl, "')\n } catch (error) {\n console.error(error);\n }"); | ||
} else { | ||
workerSource = "url(".concat(options.workerUrl, ")"); | ||
} | ||
} | ||
var workerFarm = getWorkerFarm(options); | ||
@@ -113,0 +122,0 @@ options = JSON.parse(JSON.stringify(options)); |
@@ -42,3 +42,3 @@ "use strict"; | ||
loader = (0, _selectLoader.selectLoader)(loaders, url, null); | ||
options = (0, _mergeOptions.mergeOptions)(loader, options); | ||
options = (0, _mergeOptions.mergeOptions)(loader, options, url); | ||
context = (0, _getLoaderContext.getLoaderContext)({ | ||
@@ -45,0 +45,0 @@ url: url, |
@@ -40,3 +40,3 @@ "use strict"; | ||
options = (0, _mergeOptions.mergeOptions)(loader, options); | ||
options = (0, _mergeOptions.mergeOptions)(loader, options, url); | ||
context = (0, _getLoaderContext.getLoaderContext)({ | ||
@@ -43,0 +43,0 @@ url: url, |
@@ -65,3 +65,3 @@ "use strict"; | ||
case 9: | ||
options = (0, _mergeOptions.mergeOptions)(loader, options); | ||
options = (0, _mergeOptions.mergeOptions)(loader, options, autoUrl); | ||
context = (0, _getLoaderContext.getLoaderContext)({ | ||
@@ -68,0 +68,0 @@ url: autoUrl, |
@@ -1,7 +0,1 @@ | ||
import { parse } from './lib/parse'; | ||
import { parseSync } from './lib/parse-sync'; | ||
import { fetchFile } from './lib/fetch/fetch-file'; | ||
import { load } from './lib/load'; | ||
import { resolvePath } from './lib/fetch/file-aliases'; | ||
import { global } from './utils/globals'; | ||
import * as path from './lib/path/path'; | ||
@@ -35,22 +29,2 @@ export { path }; | ||
export { _unregisterLoaders } from './lib/register-loaders'; | ||
export const TextEncoder = global.TextEncoder; | ||
export const TextDecoder = global.TextDecoder; | ||
export async function createReadStream(url, options) { | ||
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) { | ||
console.warn('parse() deprecated, use parse()'); | ||
return parse(...args); | ||
} | ||
export function parseFileSync(...args) { | ||
console.warn('parseSync() deprecated, use parseSync()'); | ||
return parseSync(...args); | ||
} | ||
export function loadFile(...args) { | ||
console.warn('loadFile() deprecated, use load()'); | ||
return load(...args); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -7,2 +7,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
import { fetchFile } from '../fetch/fetch-file'; | ||
export function getLoaderContext(context, options, previousContext) { | ||
@@ -14,3 +15,3 @@ if (previousContext) { | ||
context = _objectSpread({ | ||
fetch: context.fetch || typeof window !== 'undefined' && window.fetch | ||
fetch: context.fetch || fetchFile | ||
}, context); | ||
@@ -17,0 +18,0 @@ |
@@ -14,3 +14,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
export function mergeOptions(loader, options) { | ||
export function mergeOptions(loader, options, url) { | ||
const loaderDefaultOptions = loader && (loader.DEFAULT_OPTIONS || loader.defaultOptions || loader.options || {}); | ||
@@ -22,2 +22,6 @@ | ||
if (url && !('baseUri' in mergedOptions)) { | ||
mergedOptions.baseUri = url; | ||
} | ||
if (mergedOptions.log === null) { | ||
@@ -27,2 +31,7 @@ mergedOptions.log = new NullLog(); | ||
mergeNesteFields(mergedOptions, options, loaderDefaultOptions); | ||
return mergedOptions; | ||
} | ||
function mergeNesteFields(mergedOptions, options, loaderDefaultOptions) { | ||
for (const key in options) { | ||
@@ -39,5 +48,3 @@ const value = options[key]; | ||
} | ||
return mergedOptions; | ||
} | ||
//# sourceMappingURL=merge-options.js.map |
@@ -21,2 +21,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
export function normalizeLoader(loader) { | ||
assert(loader, 'null loader'); | ||
assert(isLoaderObject(loader), 'invalid loader'); | ||
@@ -23,0 +24,0 @@ let options; |
@@ -67,2 +67,10 @@ import { toArrayBuffer } from '../../javascript-utils/binary-utils'; | ||
export default function parseWithWorker(workerSource, workerName, data, options = {}, context = {}) { | ||
if (options.workerUrl) { | ||
if (options.workerUrl.startsWith('http')) { | ||
workerSource = "\n try {\n importScripts('".concat(options.workerUrl, "')\n } catch (error) {\n console.error(error);\n }"); | ||
} else { | ||
workerSource = "url(".concat(options.workerUrl, ")"); | ||
} | ||
} | ||
const workerFarm = getWorkerFarm(options); | ||
@@ -69,0 +77,0 @@ options = JSON.parse(JSON.stringify(options)); |
@@ -14,3 +14,3 @@ import { isLoaderObject } from './loader-utils/normalize-loader'; | ||
const loader = selectLoader(loaders, url, null); | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, url); | ||
const context = getLoaderContext({ | ||
@@ -17,0 +17,0 @@ url, |
@@ -28,3 +28,3 @@ import { selectLoader } from './select-loader'; | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, url); | ||
context = getLoaderContext({ | ||
@@ -31,0 +31,0 @@ url, |
@@ -32,3 +32,3 @@ import assert from '../utils/assert'; | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, autoUrl); | ||
context = getLoaderContext({ | ||
@@ -35,0 +35,0 @@ url: autoUrl, |
@@ -1,9 +0,1 @@ | ||
import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator"; | ||
import { parse } from './lib/parse'; | ||
import { parseSync } from './lib/parse-sync'; | ||
import { fetchFile } from './lib/fetch/fetch-file'; | ||
import { load } from './lib/load'; | ||
import { resolvePath } from './lib/fetch/file-aliases'; | ||
import { global } from './utils/globals'; | ||
import * as path from './lib/path/path'; | ||
@@ -37,46 +29,2 @@ export { path }; | ||
export { _unregisterLoaders } from './lib/register-loaders'; | ||
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() { | ||
console.warn('parse() deprecated, use parse()'); | ||
return parse.apply(void 0, arguments); | ||
} | ||
export function parseFileSync() { | ||
console.warn('parseSync() deprecated, use parseSync()'); | ||
return parseSync.apply(void 0, arguments); | ||
} | ||
export function loadFile() { | ||
console.warn('loadFile() deprecated, use load()'); | ||
return load.apply(void 0, arguments); | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -8,2 +8,3 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray"; | ||
import { fetchFile } from '../fetch/fetch-file'; | ||
export function getLoaderContext(context, options, previousContext) { | ||
@@ -15,3 +16,3 @@ if (previousContext) { | ||
context = _objectSpread({ | ||
fetch: context.fetch || typeof window !== 'undefined' && window.fetch | ||
fetch: context.fetch || fetchFile | ||
}, context); | ||
@@ -18,0 +19,0 @@ |
@@ -17,3 +17,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
export function mergeOptions(loader, options) { | ||
export function mergeOptions(loader, options, url) { | ||
var loaderDefaultOptions = loader && (loader.DEFAULT_OPTIONS || loader.defaultOptions || loader.options || {}); | ||
@@ -25,2 +25,6 @@ | ||
if (url && !('baseUri' in mergedOptions)) { | ||
mergedOptions.baseUri = url; | ||
} | ||
if (mergedOptions.log === null) { | ||
@@ -30,2 +34,7 @@ mergedOptions.log = new NullLog(); | ||
mergeNesteFields(mergedOptions, options, loaderDefaultOptions); | ||
return mergedOptions; | ||
} | ||
function mergeNesteFields(mergedOptions, options, loaderDefaultOptions) { | ||
for (var key in options) { | ||
@@ -42,5 +51,3 @@ var value = options[key]; | ||
} | ||
return mergedOptions; | ||
} | ||
//# sourceMappingURL=merge-options.js.map |
@@ -21,2 +21,3 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty"; | ||
export function normalizeLoader(loader) { | ||
assert(loader, 'null loader'); | ||
assert(isLoaderObject(loader), 'invalid loader'); | ||
@@ -23,0 +24,0 @@ var options; |
@@ -96,2 +96,11 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
var context = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {}; | ||
if (options.workerUrl) { | ||
if (options.workerUrl.startsWith('http')) { | ||
workerSource = "\n try {\n importScripts('".concat(options.workerUrl, "')\n } catch (error) {\n console.error(error);\n }"); | ||
} else { | ||
workerSource = "url(".concat(options.workerUrl, ")"); | ||
} | ||
} | ||
var workerFarm = getWorkerFarm(options); | ||
@@ -98,0 +107,0 @@ options = JSON.parse(JSON.stringify(options)); |
@@ -26,3 +26,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
loader = selectLoader(loaders, url, null); | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, url); | ||
context = getLoaderContext({ | ||
@@ -29,0 +29,0 @@ url: url, |
@@ -28,3 +28,3 @@ import { selectLoader } from './select-loader'; | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, url); | ||
context = getLoaderContext({ | ||
@@ -31,0 +31,0 @@ url: url, |
@@ -48,3 +48,3 @@ import _regeneratorRuntime from "@babel/runtime/regenerator"; | ||
case 9: | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, autoUrl); | ||
context = getLoaderContext({ | ||
@@ -51,0 +51,0 @@ url: autoUrl, |
{ | ||
"name": "@loaders.gl/core", | ||
"version": "2.0.0-alpha.1", | ||
"version": "2.0.0-alpha.2", | ||
"description": "Framework-independent loaders for 3D graphics formats", | ||
@@ -55,3 +55,3 @@ "license": "MIT", | ||
}, | ||
"gitHead": "cff57d05c0495fa661119005cffd886ed6ed1025" | ||
"gitHead": "1bc3e4e6522a2a337f972799f63682464500a313" | ||
} |
@@ -1,11 +0,4 @@ | ||
import {parse} from './lib/parse'; | ||
import {parseSync} from './lib/parse-sync'; | ||
import {fetchFile} from './lib/fetch/fetch-file'; | ||
import {load} from './lib/load'; | ||
import {resolvePath} from './lib/fetch/file-aliases'; | ||
import {global} from './utils/globals'; | ||
import * as path from './lib/path/path'; | ||
// PATH | ||
export {path}; | ||
@@ -78,31 +71,1 @@ | ||
export {_unregisterLoaders} from './lib/register-loaders'; | ||
// DEPRECATED | ||
// 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) { | ||
console.warn('parse() deprecated, use parse()'); // eslint-disable-line | ||
return parse(...args); | ||
} | ||
export function parseFileSync(...args) { | ||
console.warn('parseSync() deprecated, use parseSync()'); // eslint-disable-line | ||
return parseSync(...args); | ||
} | ||
export function loadFile(...args) { | ||
console.warn('loadFile() deprecated, use load()'); // eslint-disable-line | ||
return load(...args); | ||
} |
// "sub" loaders invoked by other loaders get a "context" injected on `this` | ||
// The context will inject core methods like `parse` and contain information | ||
// about loaders and options passed in to the top-level `parse` call. | ||
import {fetchFile} from '../fetch/fetch-file'; | ||
@@ -13,3 +14,3 @@ export function getLoaderContext(context, options, previousContext) { | ||
// TODO - determine how to inject fetch, fetch in options etc | ||
fetch: context.fetch || (typeof window !== 'undefined' && window.fetch), | ||
fetch: context.fetch || fetchFile, | ||
...context | ||
@@ -16,0 +17,0 @@ }; |
@@ -10,3 +10,3 @@ import {NullLog, ConsoleLog} from './loggers'; | ||
// Merges | ||
export function mergeOptions(loader, options) { | ||
export function mergeOptions(loader, options, url) { | ||
const loaderDefaultOptions = | ||
@@ -22,5 +22,8 @@ loader && (loader.DEFAULT_OPTIONS || loader.defaultOptions || loader.options || {}); | ||
// LOGGING | ||
// TODO - remove file component from baseUri | ||
if (url && !('baseUri' in mergedOptions)) { | ||
mergedOptions.baseUri = url; | ||
} | ||
// options.log can be set to `null` to defeat logging | ||
// LOGGING: options.log can be set to `null` to defeat logging | ||
if (mergedOptions.log === null) { | ||
@@ -30,3 +33,9 @@ mergedOptions.log = new NullLog(); | ||
// Merge nested fields | ||
mergeNesteFields(mergedOptions, options, loaderDefaultOptions); | ||
return mergedOptions; | ||
} | ||
// Merge nested options objects | ||
function mergeNesteFields(mergedOptions, options, loaderDefaultOptions) { | ||
for (const key in options) { | ||
@@ -48,4 +57,2 @@ const value = options[key]; | ||
} | ||
return mergedOptions; | ||
} |
@@ -28,2 +28,3 @@ import assert from '../../utils/assert'; | ||
// To help new users from getting stuck here | ||
assert(loader, 'null loader'); | ||
assert(isLoaderObject(loader), 'invalid loader'); | ||
@@ -30,0 +31,0 @@ |
@@ -61,2 +61,17 @@ import {toArrayBuffer} from '../../javascript-utils/binary-utils'; | ||
) { | ||
if (options.workerUrl) { | ||
if (options.workerUrl.startsWith('http')) { | ||
// Per spec worker cannot be constructed from a different origin | ||
// Only use trusted sources! | ||
workerSource = ` | ||
try { | ||
importScripts('${options.workerUrl}') | ||
} catch (error) { | ||
console.error(error); | ||
}`; | ||
} else { | ||
workerSource = `url(${options.workerUrl})`; | ||
} | ||
} | ||
const workerFarm = getWorkerFarm(options); | ||
@@ -63,0 +78,0 @@ |
@@ -21,3 +21,3 @@ import {isLoaderObject} from './loader-utils/normalize-loader'; | ||
// Normalize options | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, url); | ||
@@ -24,0 +24,0 @@ const context = getLoaderContext({url, loaders}, options); |
@@ -35,3 +35,3 @@ import {selectLoader} from './select-loader'; | ||
// Normalize options | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, url); | ||
@@ -38,0 +38,0 @@ context = getLoaderContext({url, parseSync, loaders}, options); |
@@ -41,3 +41,3 @@ import assert from '../utils/assert'; | ||
// Normalize options | ||
options = mergeOptions(loader, options); | ||
options = mergeOptions(loader, options, autoUrl); | ||
@@ -44,0 +44,0 @@ // Get a context (if already present, will be unchanged) |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
829311
11081