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

ol-mapbox-style

Package Overview
Dependencies
Maintainers
4
Versions
170
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ol-mapbox-style - npm Package Compare versions

Comparing version 9.2.0 to 9.2.1

dist/examples/data/geojson-wfs.json

8

CHANGELOG.md

@@ -5,2 +5,10 @@ # Changelog

## 9.2.1
* Allow setting OpenLayers layer opacity when no `raster-opacity` is set
* Use high resolution tiles for mapbox.satellite when browser supports it
* Support bounding box requests for `geojson` sources
* Fix 3-argument signature for `applyStyle()`
* Add support for raster-dem sources with hillshade layers
## 9.2.0

@@ -7,0 +15,0 @@

2

dist/examples/apply-layergroup.js

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[835],{5203:(e,s,a)=>{a(9789);var n=a(944),o=a(9487),t=a(8615),l=a(8031),w=new n.Z;(0,l.nn)(w,"data/geojson-wms.json"),new o.Z({target:"map",view:new t.ZP({center:[-10203186.115192635,4475744.563386],zoom:4}),layers:[w]})}},e=>{e(e.s=5203)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[835],{5385:(e,s,a)=>{a(9789);var n=a(4311),o=a(195),t=a(5495),l=a(707),w=new n.Z;(0,l.nn)(w,"data/geojson-wms.json"),new o.Z({target:"map",view:new t.ZP({center:[-10203186.115192635,4475744.563386],zoom:4}),layers:[w]})}},e=>{e(e.s=5385)}]);
//# sourceMappingURL=apply-layergroup.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[945],{5569:(e,s,r)=>{r(9789),(0,r(8031).ZP)("map","https://www.arcgis.com/sharing/rest/content/items/2afe5b807fa74006be6363fd243ffb30/resources/styles/root.json",{transformRequest:function(e,s){if("Source"===s)return new Request(e.replace("/VectorTileServer","/VectorTileServer/"))}})}},e=>{e(e.s=5569)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[945],{3479:(e,s,r)=>{r(9789),(0,r(707).ZP)("map","https://www.arcgis.com/sharing/rest/content/items/2afe5b807fa74006be6363fd243ffb30/resources/styles/root.json",{transformRequest:function(e,s){if("Source"===s)return new Request(e.replace("/VectorTileServer","/VectorTileServer/"))}})}},e=>{e(e.s=3479)}]);
//# sourceMappingURL=esri-transformrequest.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[874],{8516:(e,t,l)=>{l(9789);var s=l(8031),n="data/geojson.json";fetch(n).then((function(e){return e.json()})).then((function(e){return e.layers.push({id:"state-hover",type:"fill",source:"states",paint:{"fill-color":"red","fill-opacity":["case",["boolean",["feature-state","hover"],!1],.5,0]}}),(0,s.ZP)("map",e,{styleUrl:n})})).then((function(e){var t=null;e.on("pointermove",(function(l){var n=e.getFeaturesAtPixel(l.pixel);n.length>0?(null!==t&&(0,s.LN)(e,{source:"states",id:t},null),t=n[0].getId(),(0,s.LN)(e,{source:"states",id:t},{hover:!0})):null!==t&&((0,s.LN)(e,{source:"states",id:t},null),t=null)}))}))}},e=>{e(e.s=8516)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[874],{1438:(e,t,l)=>{l(9789);var s=l(707),n="data/geojson.json";fetch(n).then((function(e){return e.json()})).then((function(e){return e.layers.push({id:"state-hover",type:"fill",source:"states",paint:{"fill-color":"red","fill-opacity":["case",["boolean",["feature-state","hover"],!1],.5,0]}}),(0,s.ZP)("map",e,{styleUrl:n})})).then((function(e){var t=null;e.on("pointermove",(function(l){var n=e.getFeaturesAtPixel(l.pixel);n.length>0?(null!==t&&(0,s.LN)(e,{source:"states",id:t},null),t=n[0].getId(),(0,s.LN)(e,{source:"states",id:t},{hover:!0})):null!==t&&((0,s.LN)(e,{source:"states",id:t},null),t=null)}))}))}},e=>{e(e.s=1438)}]);
//# sourceMappingURL=geojson-featurestate.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[223],{6065:(s,e,n)=>{n(9789),(0,n(8031).nn)("map","data/geojson-inline.json")}},s=>{s(s.s=6065)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[223],{1465:(s,e,n)=>{n(9789),(0,n(707).nn)("map","data/geojson-inline.json")}},s=>{s(s.s=1465)}]);
//# sourceMappingURL=geojson-inline.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[145],{2236:(e,s,a)=>{a(9789);var o=a(5218),n=a(9487),t=a(8615),l=a(8031),p=a(9786),w=new o.Z;(0,l.bg)(w,"data/geojson.json"),new n.Z({target:"map",layers:[w],view:new t.ZP({center:(0,p.mi)([-122.19952899999998,51.920367528011525]),zoom:3})})}},e=>{e(e.s=2236)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[145],{8263:(e,s,a)=>{a(9789);var o=a(6703),n=a(195),t=a(5495),l=a(707),p=a(8838),w=new o.Z;(0,l.bg)(w,"data/geojson.json"),new n.Z({target:"map",layers:[w],view:new t.ZP({center:(0,p.mi)([-122.19952899999998,51.920367528011525]),zoom:3})})}},e=>{e(e.s=8263)}]);
//# sourceMappingURL=geojson-layer.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[346],{4783:(s,e,a)=>{a(9789),(0,a(8031).nn)("map","data/geojson.json")}},s=>{s(s.s=4783)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[346],{4029:(s,e,a)=>{a(9789),(0,a(707).nn)("map","data/geojson.json")}},s=>{s(s.s=4029)}]);
//# sourceMappingURL=geojson.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[862],{7018:(e,o,s)=>{s(9789);var c=s(8031),a=document.cookie.replace(/(?:(?:^|.*;\s*)mapbox_access_token\s*\=\s*([^;]*).*$)|^.*$/,"$1");a||(a=window.prompt("Enter your Mapbox API access token:"),document.cookie="mapbox_access_token="+a+"; expires=Fri, 31 Dec 9999 23:59:59 GMT"),(0,c.ZP)("map","mapbox://styles/mapbox/bright-v9",{accessToken:a})}},e=>{e(e.s=7018)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[862],{9742:(e,o,s)=>{s(9789);var c=s(707),a=document.cookie.replace(/(?:(?:^|.*;\s*)mapbox_access_token\s*\=\s*([^;]*).*$)|^.*$/,"$1");a||(a=window.prompt("Enter your Mapbox API access token:"),document.cookie="mapbox_access_token="+a+"; expires=Fri, 31 Dec 9999 23:59:59 GMT"),(0,c.ZP)("map","mapbox://styles/mapbox/bright-v9",{accessToken:a})}},e=>{e(e.s=9742)}]);
//# sourceMappingURL=mapbox.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[507],{8890:(e,s,t)=>{t(9789);var o=t(3830),c=t(9487),a=t(8615),n=t(8031),i=document.cookie.replace(/(?:(?:^|.*;\s*)tilehosting_access_token\s*\=\s*([^;]*).*$)|^.*$/,"$1");i||(i=window.prompt("Enter your tilehosting API access token:"),document.cookie="tilehosting_access_token="+i+"; expires=Fri, 31 Dec 9999 23:59:59 GMT");var l="https://api.maptiler.com/maps/basic/style.json?key="+i,p=new o.Z({declutter:!0});(0,n.bg)(p,l),(0,n.h0)(p,l),new c.Z({target:"map",layers:[p],view:new a.ZP({center:[0,0],zoom:2})})}},e=>{e(e.s=8890)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[507],{7279:(e,s,t)=>{t(9789);var o=t(7622),c=t(195),a=t(5495),n=t(707),i=document.cookie.replace(/(?:(?:^|.*;\s*)tilehosting_access_token\s*\=\s*([^;]*).*$)|^.*$/,"$1");i||(i=window.prompt("Enter your tilehosting API access token:"),document.cookie="tilehosting_access_token="+i+"; expires=Fri, 31 Dec 9999 23:59:59 GMT");var l="https://api.maptiler.com/maps/basic/style.json?key="+i,p=new o.Z({declutter:!0});(0,n.bg)(p,l),(0,n.h0)(p,l),new c.Z({target:"map",layers:[p],view:new a.ZP({center:[0,0],zoom:2})})}},e=>{e(e.s=7279)}]);
//# sourceMappingURL=openmaptiles-layer.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[347],{3563:(e,s,o)=>{o(9789);var t=o(8031),c=document.cookie.replace(/(?:(?:^|.*;\s*)tilehosting_access_token\s*\=\s*([^;]*).*$)|^.*$/,"$1");c||(c=window.prompt("Enter your tilehosting API access token:"),document.cookie="tilehosting_access_token="+c+"; expires=Fri, 31 Dec 9999 23:59:59 GMT"),(0,t.ZP)("map","https://api.maptiler.com/maps/basic/style.json?key="+c)}},e=>{e(e.s=3563)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[347],{4944:(e,s,o)=>{o(9789);var t=o(707),c=document.cookie.replace(/(?:(?:^|.*;\s*)tilehosting_access_token\s*\=\s*([^;]*).*$)|^.*$/,"$1");c||(c=window.prompt("Enter your tilehosting API access token:"),document.cookie="tilehosting_access_token="+c+"; expires=Fri, 31 Dec 9999 23:59:59 GMT"),(0,t.ZP)("map","https://api.maptiler.com/maps/basic/style.json?key="+c)}},e=>{e(e.s=4944)}]);
//# sourceMappingURL=openmaptiles.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[890],{4468:(e,t,a)=>{a(9789);var n=a(8833),s=a(9487),o=a(5218),r=a(8275),u=a(8615),c=a(8031),l=new o.Z({declutter:!0,source:new r.Z({format:new n.Z,url:"data/states.geojson"})}),w=new s.Z({target:"map",view:new u.ZP({center:[-13603186.115192635,6785744.563386],zoom:2})});fetch("data/states.json").then((function(e){return e.json()})).then((function(e){(0,c.uX)(l,e,"states"),-1===w.getLayers().getArray().indexOf(l)&&w.addLayer(l)}))}},e=>{e(e.s=4468)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[890],{6506:(e,t,a)=>{a(9789);var n=a(8897),s=a(195),o=a(6703),r=a(3296),u=a(5495),c=a(707),l=new o.Z({declutter:!0,source:new r.Z({format:new n.Z,url:"data/states.geojson"})}),w=new s.Z({target:"map",view:new u.ZP({center:[-13603186.115192635,6785744.563386],zoom:2})});fetch("data/states.json").then((function(e){return e.json()})).then((function(e){(0,c.uX)(l,e,"states"),-1===w.getLayers().getArray().indexOf(l)&&w.addLayer(l)}))}},e=>{e(e.s=6506)}]);
//# sourceMappingURL=stylefunction.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[366],{3327:(s,e,o)=>{o(9789),(0,o(8031).nn)("map"," https://demo.tegola.io/styles/hot-osm.json")}},s=>{s(s.s=3327)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[366],{140:(s,e,o)=>{o(9789),(0,o(707).nn)("map"," https://demo.tegola.io/styles/hot-osm.json")}},s=>{s(s.s=140)}]);
//# sourceMappingURL=tilejson-vectortile.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[177],{8492:(s,e,a)=>{a(9789),(0,a(8031).nn)("map","data/tilejson.json")}},s=>{s(s.s=8492)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[177],{2122:(s,e,a)=>{a(9789),(0,a(707).nn)("map","data/tilejson.json")}},s=>{s(s.s=2122)}]);
//# sourceMappingURL=tilejson.js.map

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

"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[840],{2516:(s,a,e)=>{e(9789),(0,e(8031).ZP)("map","data/wms.json")}},s=>{s(s.s=2516)}]);
"use strict";(self.webpackChunkol_mapbox_style=self.webpackChunkol_mapbox_style||[]).push([[840],{367:(s,a,e)=>{e(9789),(0,e(707).ZP)("map","data/wms.json")}},s=>{s(s.s=367)}]);
//# sourceMappingURL=wms.js.map
{
"name": "ol-mapbox-style",
"version": "9.2.0",
"version": "9.2.1",
"description": "Create OpenLayers maps from Mapbox Style objects",

@@ -47,4 +47,4 @@ "type": "module",

"@rollup/plugin-buble": "^0.21.3",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-node-resolve": "^13.2.1",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-node-resolve": "^15.0.1",
"@types/arcgis-rest-api": "^10.4.4",

@@ -65,6 +65,5 @@ "@types/mocha": "^9.1.0",

"eslint": "^8.2.0",
"eslint-config-openlayers": "^16.2.3",
"eslint-config-openlayers": "^17.0.0",
"eslint-import-resolver-alias": "^1.1.2",
"html-webpack-plugin": "^5.5.0",
"json-strip-loader": "^1.0.5",
"karma": "^6.3.4",

@@ -80,4 +79,4 @@ "karma-chrome-launcher": "^3.1.0",

"nanoassert": "^2.0.0",
"ol": "^7.0.0-dev.1660829860979",
"puppeteer": "^17.0.0",
"ol": "^7.1.1-dev.1668111618807",
"puppeteer": "^19.2.2",
"remove-flow-types-loader": "^1.1.0",

@@ -84,0 +83,0 @@ "rollup": "^2.70.2",

@@ -8,4 +8,6 @@ /*

import GeoJSON from 'ol/format/GeoJSON.js';
import ImageLayer from 'ol/layer/Image.js';
import MVT from 'ol/format/MVT.js';
import Map from 'ol/Map.js';
import Raster from 'ol/source/Raster.js';
import TileGrid from 'ol/tilegrid/TileGrid.js';

@@ -24,2 +26,3 @@ import TileJSON from 'ol/source/TileJSON.js';

} from './stylefunction.js';
import {bbox as bboxStrategy} from 'ol/loadingstrategy.js';
import {createXYZ} from 'ol/tilegrid.js';

@@ -35,2 +38,3 @@ import {

import {getFonts} from './text.js';
import {hillshade} from './shaders.js';
import {

@@ -162,2 +166,3 @@ normalizeSourceUrl,

sourceOrLayers = options.source || options.layers;
optionsOrPath = options;
} else {

@@ -270,27 +275,24 @@ sourceOrLayers = sourceOrLayersOrOptions;

});
} else {
const glSource = glStyle.sources[sourceId];
let source = layer.getSource();
if (!source || source.get('mapbox-source') !== glSource) {
source = setupGeoJSONSource(glSource, styleUrl, options);
}
const glSource = glStyle.sources[sourceId];
let source = layer.getSource();
if (!source || source.get('mapbox-source') !== glSource) {
source = setupGeoJSONSource(glSource, styleUrl, options);
}
const targetSource = /** @type {VectorSource} */ (layer.getSource());
if (!targetSource) {
layer.setSource(source);
} else if (source !== targetSource) {
if (!targetSource.getAttributions()) {
targetSource.setAttributions(source.getAttributions());
}
const targetSource = /** @type {VectorSource} */ (
layer.getSource()
);
if (!targetSource) {
layer.setSource(source);
} else if (source !== targetSource) {
if (!targetSource.getAttributions()) {
targetSource.setAttributions(source.getAttributions());
}
//@ts-ignore
if (!targetSource.format_) {
//@ts-ignore
if (!targetSource.format_) {
//@ts-ignore
targetSource.format_ = source.getFormat();
}
//@ts-ignore
targetSource.url_ = source.getUrl();
targetSource.format_ = source.getFormat();
}
return Promise.resolve();
//@ts-ignore
targetSource.url_ = source.getUrl();
}
return Promise.resolve();
}

@@ -602,2 +604,4 @@

const source = new TileJSON({
interpolate:
options.interpolate === undefined ? true : options.interpolate,
transition: 0,

@@ -641,2 +645,22 @@ crossOrigin: 'anonymous',

/**
*
* @param {Object} glSource "source" entry from a Mapbox Style object.
* @param {string} styleUrl Style url
* @param {Options} options ol-mapbox-style options.
* @return {ImageLayer<Raster>} The raster layer
*/
function setupHillshadeLayer(glSource, styleUrl, options) {
const tileLayer = setupRasterLayer(glSource, styleUrl, options);
/** @type {ImageLayer<Raster>} */
const layer = new ImageLayer({
source: new Raster({
operationType: 'image',
operation: hillshade,
sources: [tileLayer],
}),
});
return layer;
}
const geoJsonFormat = new GeoJSON();

@@ -665,8 +689,28 @@ /**

}
sourceOptions.url = geoJsonUrl;
} else {
sourceOptions.features = geoJsonFormat.readFeatures(data, {
featureProjection: getUserProjection() || 'EPSG:3857',
if (geoJsonUrl.indexOf('{bbox-epsg-3857}') != -1) {
const extentUrl = (extent) => {
return geoJsonUrl.replace(
'{bbox-epsg-3857}',
`${extent.join(',')},EPSG:3857`
);
};
const source = new VectorSource({
attributions: glSource.attribution,
format: geoJsonFormat,
url: extentUrl,
strategy: bboxStrategy,
});
source.set('mapbox-source', glSource);
return source;
}
return new VectorSource({
attributions: glSource.attribution,
format: geoJsonFormat,
url: geoJsonUrl,
});
}
sourceOptions.features = geoJsonFormat.readFeatures(data, {
featureProjection: getUserProjection() || 'EPSG:3857',
});
const source = new VectorSource(

@@ -696,4 +740,9 @@ Object.assign(

return function (event) {
if (event.frameState.viewState.zoom !== zoom) {
if (
glLayer.paint &&
'raster-opacity' in glLayer.paint &&
event.frameState.viewState.zoom !== zoom
) {
zoom = event.frameState.viewState.zoom;
delete functionCache[glLayer.id];
updateRasterLayerProperties(glLayer, layer, zoom, functionCache);

@@ -748,7 +797,7 @@ }

let glLayer, glSource, glSourceId, id, layer;
let layer, glSource, glSourceId, id;
for (let i = 0, ii = glLayers.length; i < ii; ++i) {
glLayer = glLayers[i];
const glLayer = glLayers[i];
const type = glLayer.type;
if (type == 'heatmap' || type == 'hillshade') {
if (type == 'heatmap') {
//FIXME Unsupported layer type

@@ -776,2 +825,3 @@ throw new Error(`${type} layers are not supported`);

glSource = glStyle.sources[id];
const functionCache = {};
if (glSource.type == 'vector') {

@@ -784,3 +834,2 @@ layer = setupVectorLayer(glSource, styleUrl, options);

);
const functionCache = {};
layer.on(

@@ -792,2 +841,43 @@ 'prerender',

layer = setupGeoJSONLayer(glSource, styleUrl, options);
} else if (
glSource.type == 'raster-dem' &&
glLayer.type == 'hillshade'
) {
const hillshadeLayer = setupHillshadeLayer(
glSource,
styleUrl,
options
);
layer = hillshadeLayer;
hillshadeLayer.getSource().on('beforeoperations', function (event) {
const data = event.data;
data.resolution = event.resolution;
const zoom = getZoomForResolution(
event.resolution,
options.resolutions || defaultResolutions
);
data.vert =
5 *
getValue(
glLayer,
'paint',
'hillshade-exaggeration',
zoom,
emptyObj,
functionCache
);
data.sunAz = getValue(
glLayer,
'paint',
'hillshade-illumination-direction',
zoom,
emptyObj,
functionCache
);
data.sunEl = 35;
data.opacity = 0.15;
});
layer.setVisible(
glLayer.layout ? glLayer.layout.visibility !== 'none' : true
);
}

@@ -794,0 +884,0 @@ glSourceId = id;

@@ -79,3 +79,8 @@ const mapboxBaseUrl = 'https://api.mapbox.com';

}
if (mapboxPath === 'mapbox.satellite') {
const sizeFactor = window.devicePixelRatio >= 1.5 ? '@2x' : '';
return `https://api.mapbox.com/v4/${mapboxPath}/{z}/{x}/{y}${sizeFactor}.webp?access_token=${token}`;
}
return `https://{a-d}.tiles.mapbox.com/v4/${mapboxPath}/{z}/{x}/{y}.vector.pbf?access_token=${token}`;
}

@@ -23,8 +23,7 @@ import {normalizeSourceUrl, normalizeStyleUrl} from './mapbox.js';

return /** @type {?} */ (new OffscreenCanvas(width, height));
} else {
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
}
const canvas = document.createElement('canvas');
canvas.width = width;
canvas.height = height;
return canvas;
}

@@ -57,23 +56,22 @@

return pendingRequests[url];
} else {
const request = options.transformRequest
? options.transformRequest(url, resourceType) || new Request(url)
: new Request(url);
if (!request.headers.get('Accept')) {
request.headers.set('Accept', 'application/json');
}
const pendingRequest = fetch(request)
.then(function (response) {
delete pendingRequests[url];
return response.ok
? response.json()
: Promise.reject(new Error('Error fetching source ' + url));
})
.catch(function (error) {
delete pendingRequests[url];
return Promise.reject(new Error('Error fetching source ' + url));
});
pendingRequests[url] = pendingRequest;
return pendingRequest;
}
const request = options.transformRequest
? options.transformRequest(url, resourceType) || new Request(url)
: new Request(url);
if (!request.headers.get('Accept')) {
request.headers.set('Accept', 'application/json');
}
const pendingRequest = fetch(request)
.then(function (response) {
delete pendingRequests[url];
return response.ok
? response.json()
: Promise.reject(new Error('Error fetching source ' + url));
})
.catch(function (error) {
delete pendingRequests[url];
return Promise.reject(new Error('Error fetching source ' + url));
});
pendingRequests[url] = pendingRequest;
return pendingRequest;
}

@@ -122,3 +120,3 @@

url: undefined,
tiles: normalizedSourceUrl,
tiles: [normalizedSourceUrl],
})

@@ -125,0 +123,0 @@ );

Sorry, the diff of this file is not supported yet

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 too big to display

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc