vega-loader
Advanced tools
Comparing version 4.4.0 to 4.4.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-format"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega)}(this,(function(e,t,n){"use strict";const r=/^([A-Za-z]+:)?\/\//,o=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,i=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,a="file://";async function u(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function s(e,n){n=t.extend({},this.options,n);const u=this.fileAccess,s={href:null};let c,f,l;const p=o.test(e.replace(i,""));null!=e&&"string"==typeof e&&p||t.error("Sanitize failure, invalid URI: "+t.stringValue(e));const h=r.test(e);return(l=n.baseURL)&&!h&&(e.startsWith("/")||"/"===l[l.length-1]||(e="/"+e),e=l+e),f=(c=e.startsWith(a))||"file"===n.mode||"http"!==n.mode&&!h&&u,c?e=e.slice(a.length):e.startsWith("//")&&("file"===n.defaultProtocol?(e=e.slice(2),f=!0):e=(n.defaultProtocol||"http")+":"+e),Object.defineProperty(s,"localFile",{value:!!f}),s.href=e,n.target&&(s.target=n.target+""),n.rel&&(s.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(s.crossOrigin=n.crossOrigin+""),s}function c(e){return e?t=>new Promise(((n,r)=>{e.readFile(t,((e,t)=>{e?r(e):n(t)}))})):f}async function f(){t.error("No file system access.")}function l(e){return e?async function(n,r){const o=t.extend({},this.options.http,r),i=r&&r.response,a=await e(n,o);return a.ok?t.isFunction(a[i])?a[i]():a.text():t.error(a.status+""+a.statusText)}:p}async function p(){t.error("No HTTP fetch method available.")}const h=e=>!(Number.isNaN(+e)||e instanceof Date),d={boolean:t.toBoolean,integer:t.toNumber,number:t.toNumber,date:t.toDate,string:t.toString,unknown:t.identity},g=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>h(e)&&Number.isInteger(+e),h,e=>!Number.isNaN(Date.parse(e))],m=["boolean","integer","number","date"];function y(e,t){if(!e||!e.length)return"unknown";const n=e.length,r=g.length,o=g.map(((e,t)=>t+1));for(let a,u,s=0,c=0;s<n;++s)for(u=t?e[s][t]:e[s],a=0;a<r;++a)if(o[a]&&(null!=(i=u)&&i==i)&&!g[a](u)&&(o[a]=0,++c,c===g.length))return"string";var i;return m[o.reduce(((e,t)=>0===e?t:e),0)-1]}function v(e,t){return t.reduce(((t,n)=>(t[n]=y(e,n),t)),{})}var b={},T={};function j(e){return new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'})).join(",")+"}")}function C(e){var t=Object.create(null),n=[];return e.forEach((function(e){for(var r in e)r in t||n.push(t[r]=r)})),n}function w(e,t){var n=e+"",r=n.length;return r<t?new Array(t-r+1).join(0)+n:n}function N(e){var t,n=e.getUTCHours(),r=e.getUTCMinutes(),o=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+w(-t,6):t>9999?"+"+w(t,6):w(t,4))+"-"+w(e.getUTCMonth()+1,2)+"-"+w(e.getUTCDate(),2)+(i?"T"+w(n,2)+":"+w(r,2)+":"+w(o,2)+"."+w(i,3)+"Z":o?"T"+w(n,2)+":"+w(r,2)+":"+w(o,2)+"Z":r||n?"T"+w(n,2)+":"+w(r,2)+"Z":"")}function A(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function r(e,t){var r,o=[],i=e.length,a=0,u=0,s=i<=0,c=!1;function f(){if(s)return T;if(c)return c=!1,b;var t,r,o=a;if(34===e.charCodeAt(o)){for(;a++<i&&34!==e.charCodeAt(a)||34===e.charCodeAt(++a););return(t=a)>=i?s=!0:10===(r=e.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===e.charCodeAt(a)&&++a),e.slice(o+1,t-1).replace(/""/g,'"')}for(;a<i;){if(10===(r=e.charCodeAt(t=a++)))c=!0;else if(13===r)c=!0,10===e.charCodeAt(a)&&++a;else if(r!==n)continue;return e.slice(o,t)}return s=!0,e.slice(o,i)}for(10===e.charCodeAt(i-1)&&--i,13===e.charCodeAt(i-1)&&--i;(r=f())!==T;){for(var l=[];r!==b&&r!==T;)l.push(r),r=f();t&&null==(l=t(l,u++))||o.push(l)}return o}function o(t,n){return t.map((function(t){return n.map((function(e){return a(t[e])})).join(e)}))}function i(t){return t.map(a).join(e)}function a(e){return null==e?"":e instanceof Date?N(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,o,i=r(e,(function(e,r){if(n)return n(e,r-1);o=e,n=t?function(e,t){var n=j(e);return function(r,o){return t(n(r),o,e)}}(e,t):j(e)}));return i.columns=o||[],i},parseRows:r,format:function(t,n){return null==n&&(n=C(t)),[n.map(a).join(e)].concat(o(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=C(e)),o(e,t).join("\n")},formatRows:function(e){return e.map(i).join("\n")},formatRow:i,formatValue:a}}function x(e){const n=function(n,r){const o={delimiter:e};return O(n,r?t.extend(r,o):o)};return n.responseType="text",n}function O(e,n){return n.header&&(e=n.header.map(t.stringValue).join(n.delimiter)+"\n"+e),A(n.delimiter).parse(e+"")}function P(e,n){const r=n&&n.property?t.field(n.property):t.identity;return!t.isObject(e)||(o=e,"function"==typeof Buffer&&t.isFunction(Buffer.isBuffer)&&Buffer.isBuffer(o))?r(JSON.parse(e)):function(e,n){!t.isArray(e)&&t.isIterable(e)&&(e=[...e]);return n&&n.copy?JSON.parse(JSON.stringify(e)):e}(r(e),n);var o}function k(e){return e}function E(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return S(e,t)}))}:S(e,t)}function S(e,t){var n=t.id,r=t.bbox,o=null==t.properties?{}:t.properties,i=F(e,t);return null==n&&null==r?{type:"Feature",properties:o,geometry:i}:null==r?{type:"Feature",id:n,properties:o,geometry:i}:{type:"Feature",id:n,bbox:r,properties:o,geometry:i}}function F(e,t){var n=function(e){if(null==e)return k;var t,n,r=e.scale[0],o=e.scale[1],i=e.translate[0],a=e.translate[1];return function(e,u){u||(t=n=0);var s=2,c=e.length,f=new Array(c);for(f[0]=(t+=e[0])*r+i,f[1]=(n+=e[1])*o+a;s<c;)f[s]=e[s],++s;return f}}(e.transform),r=e.arcs;function o(e,t){t.length&&t.pop();for(var o=r[e<0?~e:e],i=0,a=o.length;i<a;++i)t.push(n(o[i],i));e<0&&function(e,t){for(var n,r=e.length,o=r-t;o<--r;)n=e[o],e[o++]=e[r],e[r]=n}(t,a)}function i(e){return n(e)}function a(e){for(var t=[],n=0,r=e.length;n<r;++n)o(e[n],t);return t.length<2&&t.push(t[0]),t}function u(e){for(var t=a(e);t.length<4;)t.push(t[0]);return t}function s(e){return e.map(u)}return function e(t){var n,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":n=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=s(t.arcs);break;case"MultiPolygon":n=t.arcs.map(s);break;default:return null}return{type:r,coordinates:n}}(t)}function M(e,t){var n={},r={},o={},i=[],a=-1;function u(e,t){for(var r in e){var o=e[r];delete t[o.start],delete o.start,delete o.end,o.forEach((function(e){n[e<0?~e:e]=1})),i.push(o)}}return t.forEach((function(n,r){var o,i=e.arcs[n<0?~n:n];i.length<3&&!i[1][0]&&!i[1][1]&&(o=t[++a],t[a]=n,t[r]=o)})),t.forEach((function(t){var n,i,a=function(t){var n,r=e.arcs[t<0?~t:t],o=r[0];e.transform?(n=[0,0],r.forEach((function(e){n[0]+=e[0],n[1]+=e[1]}))):n=r[r.length-1];return t<0?[n,o]:[o,n]}(t),u=a[0],s=a[1];if(n=o[u])if(delete o[n.end],n.push(t),n.end=s,i=r[s]){delete r[i.start];var c=i===n?n:n.concat(i);r[c.start=n.start]=o[c.end=i.end]=c}else r[n.start]=o[n.end]=n;else if(n=r[s])if(delete r[n.start],n.unshift(t),n.start=u,i=o[u]){delete o[i.end];var f=i===n?n:i.concat(n);r[f.start=i.start]=o[f.end=n.end]=f}else r[n.start]=o[n.end]=n;else r[(n=[t]).start=u]=o[n.end=s]=n})),u(o,r),u(r,o),t.forEach((function(e){n[e<0?~e:e]||i.push([e])})),i}function U(e){return F(e,z.apply(this,arguments))}function z(e,t,n){var r,o,i;if(arguments.length>1)r=B(e,t,n);else for(o=0,r=new Array(i=e.arcs.length);o<i;++o)r[o]=o;return{type:"MultiLineString",arcs:M(e,r)}}function B(e,t,n){var r,o=[],i=[];function a(e){var t=e<0?~e:e;(i[t]||(i[t]=[])).push({i:e,g:r})}function u(e){e.forEach(a)}function s(e){e.forEach(u)}return function e(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":u(t.arcs);break;case"MultiLineString":case"Polygon":s(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(s)}(t.arcs)}}(t),i.forEach(null==n?function(e){o.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&o.push(e[0].i)}),o}O.responseType="text",P.responseType="json";const D={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function L(e,n){let r,o,i,a;return e=P(e,n),n&&n.feature?(r=E,i=n.feature):n&&n.mesh?(r=U,i=n.mesh,a=D[n.filter]):t.error("Missing TopoJSON feature or mesh parameter."),o=(o=e.objects[i])?r(e,o,a):t.error("Invalid TopoJSON object: "+i),o&&o.features||[o]}L.responseType="json";const I={dsv:O,csv:x(","),tsv:x("\t"),json:P,topojson:L};function J(e,n){return arguments.length>1?(I[e]=n,this):t.hasOwnProperty(I,e)?I[e]:null}const R=function(e,t){return n=>({options:n||{},sanitize:s,load:u,fileAccess:!!t,file:c(t),http:l(e)})}("undefined"!=typeof fetch&&fetch,null);e.format=I,e.formats=J,e.inferType=y,e.inferTypes=v,e.loader=R,e.read=function(e,r,o,i){const a=J((r=r||{}).type||"json");return a||t.error("Unknown data format type: "+r.type),e=a(e,r),r.parse&&function(e,t,r,o){if(!e.length)return;const i=n.timeFormatDefaultLocale();r=r||i.timeParse,o=o||i.utcParse;let a,u,s,c,f,l,p=e.columns||Object.keys(e[0]);"auto"===t&&(t=v(e,p));p=Object.keys(t);const h=p.map((e=>{const n=t[e];let i,a;if(n&&(n.startsWith("date:")||n.startsWith("utc:"))){i=n.split(/:(.+)?/,2),a=i[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===i[0]?o:r)(a)}if(!d[n])throw Error("Illegal format pattern: "+e+":"+n);return d[n]}));for(s=0,f=e.length,l=p.length;s<f;++s)for(a=e[s],c=0;c<l;++c)u=p[c],a[u]=h[c](a[u])}(e,r.parse,o,i),t.hasOwnProperty(e,"columns")&&delete e.columns,e},e.responseType=function(e){const t=J(e);return t&&t.responseType||"text"},e.typeParsers=d,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("vega-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","vega-format"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.vega,e.vega)}(this,(function(e,t,n){"use strict";const r=/^(data:|([A-Za-z]+:)?\/\/)/,o=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,i=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g,a="file://";async function u(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function s(e,n){n=t.extend({},this.options,n);const u=this.fileAccess,s={href:null};let c,f,l;const p=o.test(e.replace(i,""));null!=e&&"string"==typeof e&&p||t.error("Sanitize failure, invalid URI: "+t.stringValue(e));const h=r.test(e);return(l=n.baseURL)&&!h&&(e.startsWith("/")||l.endsWith("/")||(e="/"+e),e=l+e),f=(c=e.startsWith(a))||"file"===n.mode||"http"!==n.mode&&!h&&u,c?e=e.slice(a.length):e.startsWith("//")&&("file"===n.defaultProtocol?(e=e.slice(2),f=!0):e=(n.defaultProtocol||"http")+":"+e),Object.defineProperty(s,"localFile",{value:!!f}),s.href=e,n.target&&(s.target=n.target+""),n.rel&&(s.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(s.crossOrigin=n.crossOrigin+""),s}function c(e){return e?t=>new Promise(((n,r)=>{e.readFile(t,((e,t)=>{e?r(e):n(t)}))})):f}async function f(){t.error("No file system access.")}function l(e){return e?async function(n,r){const o=t.extend({},this.options.http,r),i=r&&r.response,a=await e(n,o);return a.ok?t.isFunction(a[i])?a[i]():a.text():t.error(a.status+""+a.statusText)}:p}async function p(){t.error("No HTTP fetch method available.")}const h=e=>!(Number.isNaN(+e)||e instanceof Date),d={boolean:t.toBoolean,integer:t.toNumber,number:t.toNumber,date:t.toDate,string:t.toString,unknown:t.identity},g=[e=>"true"===e||"false"===e||!0===e||!1===e,e=>h(e)&&Number.isInteger(+e),h,e=>!Number.isNaN(Date.parse(e))],m=["boolean","integer","number","date"];function y(e,t){if(!e||!e.length)return"unknown";const n=e.length,r=g.length,o=g.map(((e,t)=>t+1));for(let a,u,s=0,c=0;s<n;++s)for(u=t?e[s][t]:e[s],a=0;a<r;++a)if(o[a]&&(null!=(i=u)&&i==i)&&!g[a](u)&&(o[a]=0,++c,c===g.length))return"string";var i;return m[o.reduce(((e,t)=>0===e?t:e),0)-1]}function v(e,t){return t.reduce(((t,n)=>(t[n]=y(e,n),t)),{})}var b={},T={};function j(e){return new Function("d","return {"+e.map((function(e,t){return JSON.stringify(e)+": d["+t+'] || ""'})).join(",")+"}")}function C(e){var t=Object.create(null),n=[];return e.forEach((function(e){for(var r in e)r in t||n.push(t[r]=r)})),n}function w(e,t){var n=e+"",r=n.length;return r<t?new Array(t-r+1).join(0)+n:n}function N(e){var t,n=e.getUTCHours(),r=e.getUTCMinutes(),o=e.getUTCSeconds(),i=e.getUTCMilliseconds();return isNaN(e)?"Invalid Date":((t=e.getUTCFullYear())<0?"-"+w(-t,6):t>9999?"+"+w(t,6):w(t,4))+"-"+w(e.getUTCMonth()+1,2)+"-"+w(e.getUTCDate(),2)+(i?"T"+w(n,2)+":"+w(r,2)+":"+w(o,2)+"."+w(i,3)+"Z":o?"T"+w(n,2)+":"+w(r,2)+":"+w(o,2)+"Z":r||n?"T"+w(n,2)+":"+w(r,2)+"Z":"")}function A(e){var t=new RegExp('["'+e+"\n\r]"),n=e.charCodeAt(0);function r(e,t){var r,o=[],i=e.length,a=0,u=0,s=i<=0,c=!1;function f(){if(s)return T;if(c)return c=!1,b;var t,r,o=a;if(34===e.charCodeAt(o)){for(;a++<i&&34!==e.charCodeAt(a)||34===e.charCodeAt(++a););return(t=a)>=i?s=!0:10===(r=e.charCodeAt(a++))?c=!0:13===r&&(c=!0,10===e.charCodeAt(a)&&++a),e.slice(o+1,t-1).replace(/""/g,'"')}for(;a<i;){if(10===(r=e.charCodeAt(t=a++)))c=!0;else if(13===r)c=!0,10===e.charCodeAt(a)&&++a;else if(r!==n)continue;return e.slice(o,t)}return s=!0,e.slice(o,i)}for(10===e.charCodeAt(i-1)&&--i,13===e.charCodeAt(i-1)&&--i;(r=f())!==T;){for(var l=[];r!==b&&r!==T;)l.push(r),r=f();t&&null==(l=t(l,u++))||o.push(l)}return o}function o(t,n){return t.map((function(t){return n.map((function(e){return a(t[e])})).join(e)}))}function i(t){return t.map(a).join(e)}function a(e){return null==e?"":e instanceof Date?N(e):t.test(e+="")?'"'+e.replace(/"/g,'""')+'"':e}return{parse:function(e,t){var n,o,i=r(e,(function(e,r){if(n)return n(e,r-1);o=e,n=t?function(e,t){var n=j(e);return function(r,o){return t(n(r),o,e)}}(e,t):j(e)}));return i.columns=o||[],i},parseRows:r,format:function(t,n){return null==n&&(n=C(t)),[n.map(a).join(e)].concat(o(t,n)).join("\n")},formatBody:function(e,t){return null==t&&(t=C(e)),o(e,t).join("\n")},formatRows:function(e){return e.map(i).join("\n")},formatRow:i,formatValue:a}}function x(e){const n=function(n,r){const o={delimiter:e};return O(n,r?t.extend(r,o):o)};return n.responseType="text",n}function O(e,n){return n.header&&(e=n.header.map(t.stringValue).join(n.delimiter)+"\n"+e),A(n.delimiter).parse(e+"")}function P(e,n){const r=n&&n.property?t.field(n.property):t.identity;return!t.isObject(e)||(o=e,"function"==typeof Buffer&&t.isFunction(Buffer.isBuffer)&&Buffer.isBuffer(o))?r(JSON.parse(e)):function(e,n){!t.isArray(e)&&t.isIterable(e)&&(e=[...e]);return n&&n.copy?JSON.parse(JSON.stringify(e)):e}(r(e),n);var o}function k(e){return e}function E(e,t){return"string"==typeof t&&(t=e.objects[t]),"GeometryCollection"===t.type?{type:"FeatureCollection",features:t.geometries.map((function(t){return S(e,t)}))}:S(e,t)}function S(e,t){var n=t.id,r=t.bbox,o=null==t.properties?{}:t.properties,i=F(e,t);return null==n&&null==r?{type:"Feature",properties:o,geometry:i}:null==r?{type:"Feature",id:n,properties:o,geometry:i}:{type:"Feature",id:n,bbox:r,properties:o,geometry:i}}function F(e,t){var n=function(e){if(null==e)return k;var t,n,r=e.scale[0],o=e.scale[1],i=e.translate[0],a=e.translate[1];return function(e,u){u||(t=n=0);var s=2,c=e.length,f=new Array(c);for(f[0]=(t+=e[0])*r+i,f[1]=(n+=e[1])*o+a;s<c;)f[s]=e[s],++s;return f}}(e.transform),r=e.arcs;function o(e,t){t.length&&t.pop();for(var o=r[e<0?~e:e],i=0,a=o.length;i<a;++i)t.push(n(o[i],i));e<0&&function(e,t){for(var n,r=e.length,o=r-t;o<--r;)n=e[o],e[o++]=e[r],e[r]=n}(t,a)}function i(e){return n(e)}function a(e){for(var t=[],n=0,r=e.length;n<r;++n)o(e[n],t);return t.length<2&&t.push(t[0]),t}function u(e){for(var t=a(e);t.length<4;)t.push(t[0]);return t}function s(e){return e.map(u)}return function e(t){var n,r=t.type;switch(r){case"GeometryCollection":return{type:r,geometries:t.geometries.map(e)};case"Point":n=i(t.coordinates);break;case"MultiPoint":n=t.coordinates.map(i);break;case"LineString":n=a(t.arcs);break;case"MultiLineString":n=t.arcs.map(a);break;case"Polygon":n=s(t.arcs);break;case"MultiPolygon":n=t.arcs.map(s);break;default:return null}return{type:r,coordinates:n}}(t)}function M(e,t){var n={},r={},o={},i=[],a=-1;function u(e,t){for(var r in e){var o=e[r];delete t[o.start],delete o.start,delete o.end,o.forEach((function(e){n[e<0?~e:e]=1})),i.push(o)}}return t.forEach((function(n,r){var o,i=e.arcs[n<0?~n:n];i.length<3&&!i[1][0]&&!i[1][1]&&(o=t[++a],t[a]=n,t[r]=o)})),t.forEach((function(t){var n,i,a=function(t){var n,r=e.arcs[t<0?~t:t],o=r[0];e.transform?(n=[0,0],r.forEach((function(e){n[0]+=e[0],n[1]+=e[1]}))):n=r[r.length-1];return t<0?[n,o]:[o,n]}(t),u=a[0],s=a[1];if(n=o[u])if(delete o[n.end],n.push(t),n.end=s,i=r[s]){delete r[i.start];var c=i===n?n:n.concat(i);r[c.start=n.start]=o[c.end=i.end]=c}else r[n.start]=o[n.end]=n;else if(n=r[s])if(delete r[n.start],n.unshift(t),n.start=u,i=o[u]){delete o[i.end];var f=i===n?n:i.concat(n);r[f.start=i.start]=o[f.end=n.end]=f}else r[n.start]=o[n.end]=n;else r[(n=[t]).start=u]=o[n.end=s]=n})),u(o,r),u(r,o),t.forEach((function(e){n[e<0?~e:e]||i.push([e])})),i}function U(e){return F(e,z.apply(this,arguments))}function z(e,t,n){var r,o,i;if(arguments.length>1)r=B(e,t,n);else for(o=0,r=new Array(i=e.arcs.length);o<i;++o)r[o]=o;return{type:"MultiLineString",arcs:M(e,r)}}function B(e,t,n){var r,o=[],i=[];function a(e){var t=e<0?~e:e;(i[t]||(i[t]=[])).push({i:e,g:r})}function u(e){e.forEach(a)}function s(e){e.forEach(u)}return function e(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":u(t.arcs);break;case"MultiLineString":case"Polygon":s(t.arcs);break;case"MultiPolygon":!function(e){e.forEach(s)}(t.arcs)}}(t),i.forEach(null==n?function(e){o.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&o.push(e[0].i)}),o}O.responseType="text",P.responseType="json";const D={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function L(e,n){let r,o,i,a;return e=P(e,n),n&&n.feature?(r=E,i=n.feature):n&&n.mesh?(r=U,i=n.mesh,a=D[n.filter]):t.error("Missing TopoJSON feature or mesh parameter."),o=(o=e.objects[i])?r(e,o,a):t.error("Invalid TopoJSON object: "+i),o&&o.features||[o]}L.responseType="json";const I={dsv:O,csv:x(","),tsv:x("\t"),json:P,topojson:L};function J(e,n){return arguments.length>1?(I[e]=n,this):t.hasOwnProperty(I,e)?I[e]:null}const R=function(e,t){return n=>({options:n||{},sanitize:s,load:u,fileAccess:!!t,file:c(t),http:l(e)})}("undefined"!=typeof fetch&&fetch,null);e.format=I,e.formats=J,e.inferType=y,e.inferTypes=v,e.loader=R,e.read=function(e,r,o,i){const a=J((r=r||{}).type||"json");return a||t.error("Unknown data format type: "+r.type),e=a(e,r),r.parse&&function(e,t,r,o){if(!e.length)return;const i=n.timeFormatDefaultLocale();r=r||i.timeParse,o=o||i.utcParse;let a,u,s,c,f,l,p=e.columns||Object.keys(e[0]);"auto"===t&&(t=v(e,p));p=Object.keys(t);const h=p.map((e=>{const n=t[e];let i,a;if(n&&(n.startsWith("date:")||n.startsWith("utc:"))){i=n.split(/:(.+)?/,2),a=i[1],("'"===a[0]&&"'"===a[a.length-1]||'"'===a[0]&&'"'===a[a.length-1])&&(a=a.slice(1,-1));return("utc"===i[0]?o:r)(a)}if(!d[n])throw Error("Illegal format pattern: "+e+":"+n);return d[n]}));for(s=0,f=e.length,l=p.length;s<f;++s)for(a=e[s],c=0;c<l;++c)u=p[c],a[u]=h[c](a[u])}(e,r.parse,o,i),t.hasOwnProperty(e,"columns")&&delete e.columns,e},e.responseType=function(e){const t=J(e);return t&&t.responseType||"text"},e.typeParsers=d,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=vega-loader.min.js.map |
@@ -9,3 +9,3 @@ (function (global, factory) { | ||
const protocol_re = /^([A-Za-z]+:)?\/\//; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// | ||
const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// | ||
@@ -58,3 +58,3 @@ const allowed_re = /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i; // eslint-disable-line no-useless-escape | ||
* URI sanitizer function. | ||
* @param {string} uri - The uri (url or filename) to sanity check. | ||
* @param {string} uri - The uri (url or filename) to check. | ||
* @param {object} options - An options hash. | ||
@@ -86,3 +86,3 @@ * @return {Promise} - A promise that resolves to an object containing | ||
// Ensure that there is a slash between the baseURL (e.g. hostname) and url | ||
if (!uri.startsWith('/') && base[base.length - 1] !== '/') { | ||
if (!uri.startsWith('/') && !base.endsWith('/')) { | ||
uri = '/' + uri; | ||
@@ -89,0 +89,0 @@ } |
{ | ||
"name": "vega-loader", | ||
"version": "4.4.0", | ||
"version": "4.4.1", | ||
"description": "Network request and file loading utilities.", | ||
@@ -22,9 +22,13 @@ "keywords": [ | ||
"main": "build/vega-loader.node.js", | ||
"module": "build/vega-loader.module.js", | ||
"module": "build/vega-loader.node.module.js", | ||
"unpkg": "build/vega-loader.min.js", | ||
"jsdelivr": "build/vega-loader.min.js", | ||
"repository": "vega/vega", | ||
"browser": { | ||
"./build/vega-loader.node.js": "./build/vega-loader.browser.js", | ||
"./build/vega-loader.node.module.js": "./build/vega-loader.browser.module.js" | ||
}, | ||
"scripts": { | ||
"prebuild": "rimraf build", | ||
"build": "rollup -c --config-browser", | ||
"build": "rollup -c", | ||
"pretest": "yarn build --config-test", | ||
@@ -41,7 +45,3 @@ "test": "tape 'test/**/*-test.js'", | ||
}, | ||
"browser": { | ||
"./build/vega-loader.node.js": "./build/vega-loader.min.js", | ||
"./build/vega-loader.module.js": "./index.browser.js" | ||
}, | ||
"gitHead": "c58de105bb4cd33ed74d2b6a02d551f5c11d72c7" | ||
"gitHead": "774165e29850b66ec8b79ba52a7955f1ab936ea6" | ||
} |
@@ -89,3 +89,3 @@ # vega-loader | ||
var data = null; | ||
loader.load('data/stocks.csv').then(function(data) { | ||
loader.load('data/stocks.csv').then(function(csv_data) { | ||
data = vega.read(csv_data, {type: 'csv', parse: 'auto'}); | ||
@@ -98,4 +98,4 @@ }); | ||
var data = null; | ||
loader.load('data/stocks.csv').then(function(data) { | ||
data = vega.read(data, { | ||
loader.load('data/stocks.csv').then(function(csv_data) { | ||
data = vega.read(csv_data, { | ||
type: 'csv', | ||
@@ -102,0 +102,0 @@ parse: {'date': 'date', 'price': 'number'} |
@@ -5,3 +5,3 @@ import {error, extend, isFunction, stringValue} from 'vega-util'; | ||
// https://... file://... //... | ||
const protocol_re = /^([A-Za-z]+:)?\/\//; | ||
const protocol_re = /^(data:|([A-Za-z]+:)?\/\/)/; | ||
@@ -59,3 +59,3 @@ // Matches allowed URIs. From https://github.com/cure53/DOMPurify/blob/master/src/regexp.js with added file:// | ||
* URI sanitizer function. | ||
* @param {string} uri - The uri (url or filename) to sanity check. | ||
* @param {string} uri - The uri (url or filename) to check. | ||
* @param {object} options - An options hash. | ||
@@ -87,3 +87,3 @@ * @return {Promise} - A promise that resolves to an object containing | ||
// Ensure that there is a slash between the baseURL (e.g. hostname) and url | ||
if (!uri.startsWith('/') && base[base.length-1] !== '/') { | ||
if (!uri.startsWith('/') && !base.endsWith('/')) { | ||
uri = '/' + uri; | ||
@@ -90,0 +90,0 @@ } |
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
128623
19
1682
4
24