From 6cffa3819f5e21932b6fb53eefc15399d8b82df7 Mon Sep 17 00:00:00 2001 From: Harel Mazor Date: Fri, 11 Dec 2020 15:25:20 +0200 Subject: [PATCH 01/15] Support custom source --- src/index.js | 22 ++++++++++++++++++++++ src/util/ajax.js | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/src/index.js b/src/index.js index 7928a81485..5143a5f73b 100644 --- a/src/index.js +++ b/src/index.js @@ -26,6 +26,8 @@ import WorkerPool from './util/worker_pool'; import {prewarm, clearPrewarmedResources} from './util/global_worker_pool'; import {clearTileCache} from './util/tile_request_cache'; import {PerformanceUtils} from './util/performance'; +import type {RequestParameters, ResponseCallback} from './util/ajax'; +import type {Cancelable} from './types/cancelable'; const exported = { version, @@ -98,6 +100,26 @@ const exported = { config.ACCESS_TOKEN = token; }, + /** + * Sets a custom load tile function that will be called when the using a source that starts with custom:// + * The function to be used will recieve the request parameters and should call the callback with the resulting request + * For example a pbf vector tile non compresse represented as ArrayBuffer: + * ``` + * loadTilesFunction = (params, callback) => { + * const myArrayBufferOfTheTile = getTheTileByUsingTheRequest(params); + * callback(null, myArrayBufferOfTheTile, null, null); + * return { cancel: () => { } }; + * }; + * loadTilesFunctionThatFails = (params, callback) => { + * callback(new Error(someErrorMessage)); + * return { cancel: () => { } }; + * }; + * ``` + */ + set loadTilesFunction(loadFn: (requestParameters: RequestParameters, callback: ResponseCallback) => Cancelable) { + config.LOAD_TILES_FUNCTION = loadFn; + }, + /** * Gets and sets the map's default API URL for requesting tiles, styles, sprites, and glyphs * diff --git a/src/util/ajax.js b/src/util/ajax.js index 86f58e6e37..9025dbb406 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -242,6 +242,12 @@ export const makeRequest = function(requestParameters: RequestParameters, callba // some versions (see https://bugs.webkit.org/show_bug.cgi?id=174980#c2) // - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In // this case we unconditionally use XHR on the current thread since referrers don't matter. + if(/^custom:/.test(requestParameters.url) && isWorker() && self.worker && self.worker.actor) { + return self.worker.actor.send('getResource', requestParameters, callback); + } + if (/^custom:/.test(requestParameters.url) && !isWorker() && config.LOAD_TILES_FUNCTION != null) { + return config.LOAD_TILES_FUNCTION(requestParameters, callback); + } if (!isFileURL(requestParameters.url)) { if (window.fetch && window.Request && window.AbortController && window.Request.prototype.hasOwnProperty('signal')) { return makeFetchRequest(requestParameters, callback); From 852586d82e1f6c75a6b3ef98a6973e3dbe249a12 Mon Sep 17 00:00:00 2001 From: Harel Mazor Date: Fri, 11 Dec 2020 15:31:51 +0200 Subject: [PATCH 02/15] Added missing definitions for config --- src/util/config.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/util/config.js b/src/util/config.js index 8c9872d1d2..9c35f19101 100644 --- a/src/util/config.js +++ b/src/util/config.js @@ -6,7 +6,8 @@ type Config = {| FEEDBACK_URL: string, REQUIRE_ACCESS_TOKEN: boolean, ACCESS_TOKEN: ?string, - MAX_PARALLEL_IMAGE_REQUESTS: number + MAX_PARALLEL_IMAGE_REQUESTS: number, + LOAD_TILES_FUNCTION: Function |}; const config: Config = { @@ -24,7 +25,8 @@ const config: Config = { FEEDBACK_URL: 'https://apps.mapbox.com/feedback', REQUIRE_ACCESS_TOKEN: true, ACCESS_TOKEN: null, - MAX_PARALLEL_IMAGE_REQUESTS: 16 + MAX_PARALLEL_IMAGE_REQUESTS: 16, + LOAD_TILES_FUNCTION: () => {} }; export default config; From 6bb0d4fcb7e06b46db8ba8c7e1fd32ec3a51c4de Mon Sep 17 00:00:00 2001 From: Harel Mazor Date: Mon, 14 Dec 2020 22:37:34 +0200 Subject: [PATCH 03/15] Fix according to code review --- src/index.js | 47 +++++++++++++++++++++++++--------------------- src/util/ajax.js | 13 ++++++++----- src/util/config.js | 4 ++-- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/src/index.js b/src/index.js index 5143a5f73b..e6353c601f 100644 --- a/src/index.js +++ b/src/index.js @@ -100,26 +100,6 @@ const exported = { config.ACCESS_TOKEN = token; }, - /** - * Sets a custom load tile function that will be called when the using a source that starts with custom:// - * The function to be used will recieve the request parameters and should call the callback with the resulting request - * For example a pbf vector tile non compresse represented as ArrayBuffer: - * ``` - * loadTilesFunction = (params, callback) => { - * const myArrayBufferOfTheTile = getTheTileByUsingTheRequest(params); - * callback(null, myArrayBufferOfTheTile, null, null); - * return { cancel: () => { } }; - * }; - * loadTilesFunctionThatFails = (params, callback) => { - * callback(new Error(someErrorMessage)); - * return { cancel: () => { } }; - * }; - * ``` - */ - set loadTilesFunction(loadFn: (requestParameters: RequestParameters, callback: ResponseCallback) => Cancelable) { - config.LOAD_TILES_FUNCTION = loadFn; - }, - /** * Gets and sets the map's default API URL for requesting tiles, styles, sprites, and glyphs * @@ -192,7 +172,32 @@ const exported = { clearTileCache(callback); }, - workerUrl: '' + workerUrl: '', + + /** + * Sets a custom load tile function that will be called when the using a source that starts with a custom url. + * The example below will be triggered for custom:// urls. + * The function to be used will recieve the request parameters and should call the callback with the resulting request, + * For example a pbf vector tile non compressed represented as ArrayBuffer: + * ``` + * addCustomTilesFunction('custom', (params, callback) => { + * const myArrayBufferOfTheTile = getTheTileByUsingTheRequest(params); + * callback(null, myArrayBufferOfTheTile, null, null); + * return { cancel: () => { } }; + * }); + * // the following is an example of a way to return an error when trying to load a tile + * addCustomTilesFunction('custom', (params, callback) => { + * callback(new Error(someErrorMessage)); + * return { cancel: () => { } }; + * }); + * ``` + */ + addCustomTilesFunction(customUrl: string, loadFn: (requestParameters: RequestParameters, callback: ResponseCallback) => Cancelable) { + config.LOAD_TILES_FUNCTION_MAP[customUrl] = loadFn; + }, + removeCustomTilesFunction(customUrl: string) { + delete config.LOAD_TILES_FUNCTION_MAP[customUrl]; + } }; //This gets automatically stripped out in production builds. diff --git a/src/util/ajax.js b/src/util/ajax.js index 9025dbb406..155c1598e9 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -242,11 +242,14 @@ export const makeRequest = function(requestParameters: RequestParameters, callba // some versions (see https://bugs.webkit.org/show_bug.cgi?id=174980#c2) // - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In // this case we unconditionally use XHR on the current thread since referrers don't matter. - if(/^custom:/.test(requestParameters.url) && isWorker() && self.worker && self.worker.actor) { - return self.worker.actor.send('getResource', requestParameters, callback); - } - if (/^custom:/.test(requestParameters.url) && !isWorker() && config.LOAD_TILES_FUNCTION != null) { - return config.LOAD_TILES_FUNCTION(requestParameters, callback); + let key = Object.keys(config.LOAD_TILES_FUNCTION_MAP || {}).find(k => requestParameters.url.startsWith(k)); + if (key) { + if (isWorker() && self.worker && self.worker.actor) { + return self.worker.actor.send('getResource', requestParameters, callback); + } + if (!isWorker()) { + return config.LOAD_TILES_FUNCTION_MAP[key](requestParameters, callback); + } } if (!isFileURL(requestParameters.url)) { if (window.fetch && window.Request && window.AbortController && window.Request.prototype.hasOwnProperty('signal')) { diff --git a/src/util/config.js b/src/util/config.js index 9c35f19101..ecc96fe617 100644 --- a/src/util/config.js +++ b/src/util/config.js @@ -7,7 +7,7 @@ type Config = {| REQUIRE_ACCESS_TOKEN: boolean, ACCESS_TOKEN: ?string, MAX_PARALLEL_IMAGE_REQUESTS: number, - LOAD_TILES_FUNCTION: Function + LOAD_TILES_FUNCTION_MAP: object, |}; const config: Config = { @@ -26,7 +26,7 @@ const config: Config = { REQUIRE_ACCESS_TOKEN: true, ACCESS_TOKEN: null, MAX_PARALLEL_IMAGE_REQUESTS: 16, - LOAD_TILES_FUNCTION: () => {} + LOAD_TILES_FUNCTION_MAP: {} }; export default config; From c8379319587f59df6c19b006be097dafcd50aa54 Mon Sep 17 00:00:00 2001 From: Abel Vazquez Date: Sun, 20 Dec 2020 14:31:23 +0100 Subject: [PATCH 04/15] working custom source --- .github/ISSUE_TEMPLATE/Bug_report.md | 76 +++++++-------- .github/ISSUE_TEMPLATE/Feature_request.md | 108 +++++++++++----------- .github/ISSUE_TEMPLATE/Question.md | 48 +++++----- src/index.js | 40 +++++++- src/util/ajax.js | 13 ++- src/util/config.js | 6 +- 6 files changed, 171 insertions(+), 120 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md index 0762a093b6..25a4bb5be8 100644 --- a/.github/ISSUE_TEMPLATE/Bug_report.md +++ b/.github/ISSUE_TEMPLATE/Bug_report.md @@ -1,38 +1,38 @@ ---- -name: Bug report -about: Report a bug - ---- - - - -**mapbox-gl-js version**: - -**browser**: - -### Steps to Trigger Behavior - - 1. - 2. - 3. - -### Link to Demonstration - - - -https://jsbin.com/ - -### Expected Behavior - -### Actual Behavior +--- +name: Bug report +about: Report a bug + +--- + + + +**mapbox-gl-js version**: + +**browser**: + +### Steps to Trigger Behavior + + 1. + 2. + 3. + +### Link to Demonstration + + + +https://jsbin.com/ + +### Expected Behavior + +### Actual Behavior diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md index 8dd6641dcf..ea18fe16ec 100644 --- a/.github/ISSUE_TEMPLATE/Feature_request.md +++ b/.github/ISSUE_TEMPLATE/Feature_request.md @@ -1,54 +1,54 @@ ---- -name: Feature request -about: Suggest a feature or enhancement - ---- - -## Motivation - - - -## Design Alternatives - - - -## Design - - - -### Mock-Up - - - -### Concepts - - - -### Implementation - - +--- +name: Feature request +about: Suggest a feature or enhancement + +--- + +## Motivation + + + +## Design Alternatives + + + +## Design + + + +### Mock-Up + + + +### Concepts + + + +### Implementation + + diff --git a/.github/ISSUE_TEMPLATE/Question.md b/.github/ISSUE_TEMPLATE/Question.md index 6e03e6bfec..383581e74b 100644 --- a/.github/ISSUE_TEMPLATE/Question.md +++ b/.github/ISSUE_TEMPLATE/Question.md @@ -1,24 +1,24 @@ ---- -name: Question -about: Report a question that isn't answered in our docs - ---- - - - -**mapbox-gl-js version**: - -### Question - - - -### Links to related documentation - - +--- +name: Question +about: Report a question that isn't answered in our docs + +--- + + + +**mapbox-gl-js version**: + +### Question + + + +### Links to related documentation + + diff --git a/src/index.js b/src/index.js index 7928a81485..dbc99448a3 100644 --- a/src/index.js +++ b/src/index.js @@ -26,6 +26,8 @@ import WorkerPool from './util/worker_pool'; import {prewarm, clearPrewarmedResources} from './util/global_worker_pool'; import {clearTileCache} from './util/tile_request_cache'; import {PerformanceUtils} from './util/performance'; +import type {RequestParameters, ResponseCallback} from './util/ajax'; +import type {Cancelable} from './types/cancelable'; const exported = { version, @@ -170,7 +172,43 @@ const exported = { clearTileCache(callback); }, - workerUrl: '' + workerUrl: '', + + /** + * Sets a custom load tile function that will be called when the using a source that starts with a custom url. + * The example below will be triggered for custom:// urls. + * The function to be used will recieve the request parameters and should call the callback with the resulting request, + * For example a pbf vector tile non compressed represented as ArrayBuffer: + * ``` + maplibre.addProtocol("custom", (params, callback) => { + fetch(`https://${params.url.split("://")[1]}`) + .then(t => { + if (t.status == 200) { + t.arrayBuffer().then(arr => { + callback(null, arr, null, null); + }); + } else { + callback(new Error(`Tile fetch error: ${t.statusText}`)); + } + }) + .catch(e => { + callback(new Error(e)); + }); + return { cancel: () => { } }; + }); + * // the following is an example of a way to return an error when trying to load a tile + * addProtocol('custom', (params, callback) => { + * callback(new Error(someErrorMessage)); + * return { cancel: () => { } }; + * }); + * ``` + */ + addProtocol(customUrl: string, loadFn: (requestParameters: RequestParameters, callback: ResponseCallback) => Cancelable) { + config.REGISTERED_PROTOCOLS[customUrl] = loadFn; + }, + removeProtocol(customUrl: string) { + delete config.REGISTERED_PROTOCOLS[customUrl]; + } }; //This gets automatically stripped out in production builds. diff --git a/src/util/ajax.js b/src/util/ajax.js index 86f58e6e37..abfeb735fe 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -241,7 +241,18 @@ export const makeRequest = function(requestParameters: RequestParameters, callba // - Safari exposes window.AbortController, but it doesn't work actually abort any requests in // some versions (see https://bugs.webkit.org/show_bug.cgi?id=174980#c2) // - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In - // this case we unconditionally use XHR on the current thread since referrers don't matter. + // this case we unconditionally use XHR on the current thread since referrers don't matter. + if (!(/^https?:|^file:/.test(requestParameters.url))){ + let p = requestParameters.url.substring(0, requestParameters.url.indexOf('://')); + if (isWorker() && self.worker && self.worker.actor) { + return self.worker.actor.send('getResource', requestParameters, callback); + } + if (!isWorker()) { + let f = (config.REGISTERED_PROTOCOLS[p] === void 0) ? makeFetchRequest : config.REGISTERED_PROTOCOLS[p]; + return f(requestParameters, callback); + } + } + if (!isFileURL(requestParameters.url)) { if (window.fetch && window.Request && window.AbortController && window.Request.prototype.hasOwnProperty('signal')) { return makeFetchRequest(requestParameters, callback); diff --git a/src/util/config.js b/src/util/config.js index 8c9872d1d2..d7a8f402da 100644 --- a/src/util/config.js +++ b/src/util/config.js @@ -6,7 +6,8 @@ type Config = {| FEEDBACK_URL: string, REQUIRE_ACCESS_TOKEN: boolean, ACCESS_TOKEN: ?string, - MAX_PARALLEL_IMAGE_REQUESTS: number + MAX_PARALLEL_IMAGE_REQUESTS: number, + REGISTERED_PROTOCOLS: object |}; const config: Config = { @@ -24,7 +25,8 @@ const config: Config = { FEEDBACK_URL: 'https://apps.mapbox.com/feedback', REQUIRE_ACCESS_TOKEN: true, ACCESS_TOKEN: null, - MAX_PARALLEL_IMAGE_REQUESTS: 16 + MAX_PARALLEL_IMAGE_REQUESTS: 16, + REGISTERED_PROTOCOLS: {} }; export default config; From ec5847372c51b6d85662d7a53e0470e8da9ec57a Mon Sep 17 00:00:00 2001 From: Abel Vazquez Date: Sun, 20 Dec 2020 14:34:47 +0100 Subject: [PATCH 05/15] working custom source --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cd01db1f6e..ff152ef6e5 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,4 @@ yarn-error.log yarn-debug.log npm-debug.log .idea +.github/ISSUE_TEMPLATE/ \ No newline at end of file From c6939ccf58388f9bf9a271a88e25c810244e60f2 Mon Sep 17 00:00:00 2001 From: Abel Vazquez Date: Sun, 20 Dec 2020 14:35:17 +0100 Subject: [PATCH 06/15] working custom source --- .gitignore | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ff152ef6e5..82c800b6d0 100644 --- a/.gitignore +++ b/.gitignore @@ -26,5 +26,4 @@ _site yarn-error.log yarn-debug.log npm-debug.log -.idea -.github/ISSUE_TEMPLATE/ \ No newline at end of file +.idea \ No newline at end of file From da5b243164821839143b65f46c9ae91289effec0 Mon Sep 17 00:00:00 2001 From: Abel Vazquez Date: Sun, 20 Dec 2020 14:56:02 +0100 Subject: [PATCH 07/15] minor change --- src/util/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/ajax.js b/src/util/ajax.js index abfeb735fe..3d89092cb8 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -243,11 +243,11 @@ export const makeRequest = function(requestParameters: RequestParameters, callba // - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In // this case we unconditionally use XHR on the current thread since referrers don't matter. if (!(/^https?:|^file:/.test(requestParameters.url))){ - let p = requestParameters.url.substring(0, requestParameters.url.indexOf('://')); if (isWorker() && self.worker && self.worker.actor) { return self.worker.actor.send('getResource', requestParameters, callback); } if (!isWorker()) { + const p = requestParameters.url.substring(0, requestParameters.url.indexOf('://')); let f = (config.REGISTERED_PROTOCOLS[p] === void 0) ? makeFetchRequest : config.REGISTERED_PROTOCOLS[p]; return f(requestParameters, callback); } From fe64316c758897e045964e50318985ce30c0fa93 Mon Sep 17 00:00:00 2001 From: Abel Vazquez Date: Sun, 20 Dec 2020 15:43:06 +0100 Subject: [PATCH 08/15] minor change --- src/util/ajax.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/ajax.js b/src/util/ajax.js index 3d89092cb8..1031bc6c92 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -248,8 +248,8 @@ export const makeRequest = function(requestParameters: RequestParameters, callba } if (!isWorker()) { const p = requestParameters.url.substring(0, requestParameters.url.indexOf('://')); - let f = (config.REGISTERED_PROTOCOLS[p] === void 0) ? makeFetchRequest : config.REGISTERED_PROTOCOLS[p]; - return f(requestParameters, callback); + const f = config.REGISTERED_PROTOCOLS[p]; + return ((f === void 0) ? makeFetchRequest : f)(requestParameters, callback); } } From fb496c5f24738a68164a71cb81bb1d3dba2ab496 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Fri, 19 Feb 2021 20:55:15 -0500 Subject: [PATCH 09/15] A few minor styling fixes --- .gitignore | 2 +- src/util/ajax.js | 2 +- src/util/config.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 82c800b6d0..cd01db1f6e 100644 --- a/.gitignore +++ b/.gitignore @@ -26,4 +26,4 @@ _site yarn-error.log yarn-debug.log npm-debug.log -.idea \ No newline at end of file +.idea diff --git a/src/util/ajax.js b/src/util/ajax.js index e446eb17db..90b6c3579e 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -241,7 +241,7 @@ export const makeRequest = function(requestParameters: RequestParameters, callba // - Safari exposes window.AbortController, but it doesn't work actually abort any requests in // some versions (see https://bugs.webkit.org/show_bug.cgi?id=174980#c2) // - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In - // this case we unconditionally use XHR on the current thread since referrers don't matter. + // this case we unconditionally use XHR on the current thread since referrers don't matter. if (!(/^https?:|^file:/.test(requestParameters.url))){ if (isWorker() && self.worker && self.worker.actor) { return self.worker.actor.send('getResource', requestParameters, callback); diff --git a/src/util/config.js b/src/util/config.js index d7a8f402da..f3fb927bd3 100644 --- a/src/util/config.js +++ b/src/util/config.js @@ -7,7 +7,7 @@ type Config = {| REQUIRE_ACCESS_TOKEN: boolean, ACCESS_TOKEN: ?string, MAX_PARALLEL_IMAGE_REQUESTS: number, - REGISTERED_PROTOCOLS: object + REGISTERED_PROTOCOLS: object, |}; const config: Config = { @@ -26,7 +26,7 @@ const config: Config = { REQUIRE_ACCESS_TOKEN: true, ACCESS_TOKEN: null, MAX_PARALLEL_IMAGE_REQUESTS: 16, - REGISTERED_PROTOCOLS: {} + REGISTERED_PROTOCOLS: {}, }; export default config; From b927e92a8454fb5454a085e47839bb46d20f512f Mon Sep 17 00:00:00 2001 From: HarelM Date: Sat, 5 Jun 2021 15:28:23 +0300 Subject: [PATCH 10/15] Fix lint, typescript, and code review comment --- src/index.d.ts | 181 +++++++++++++++++++++++++++++------------------ src/index.js | 35 +++++---- src/util/ajax.js | 8 +-- 3 files changed, 138 insertions(+), 86 deletions(-) diff --git a/src/index.d.ts b/src/index.d.ts index d3c65af21f..b5a2a1b4ac 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -15,10 +15,10 @@ /// -export = mapboxgl; -export as namespace mapboxgl; +export = maplibregl; +export as namespace maplibregl; -declare namespace mapboxgl { +declare namespace maplibregl { let accessToken: string; let version: string; let baseApiUrl: string; @@ -42,13 +42,52 @@ declare namespace mapboxgl { * Tiles may still be cached by the browser in some cases. */ export function clearStorage(callback?: (err?: Error) => void): void; + /** + * Sets a custom load tile function that will be called when using a source that starts with a custom url schema. + * The example below will be triggered for custom:// urls defined in the sources list in the style definitions. + * The function passed will receive the request parameters and should call the callback with the resulting request, + * for example a pbf vector tile, non-compressed, represented as ArrayBuffer. + * @param {string} customProtocol - the protocol to hook, for example 'custom' + * @param {Function} loadFn - the function to use when trying to fetch a tile specified by the customProtocol + * @example + * // this will fetch a file using the fetch API (this is obviously a non iteresting example...) + * maplibre.addProtocol('custom', (params, callback) => { + fetch(`https://${params.url.split("://")[1]}`) + .then(t => { + if (t.status == 200) { + t.arrayBuffer().then(arr => { + callback(null, arr, null, null); + }); + } else { + callback(new Error(`Tile fetch error: ${t.statusText}`)); + } + }) + .catch(e => { + callback(new Error(e)); + }); + return { cancel: () => { } }; + }); + * // the following is an example of a way to return an error when trying to load a tile + * maplibre.addProtocol('custom2', (params, callback) => { + * callback(new Error('someErrorMessage')); + * return { cancel: () => { } }; + * }); + */ + export function addProtocol(customProtocol: string, loadFn: (requestParameters: RequestParameters, callback: ResponseCallback) => Cancelable); + /** + * Removes a previusly added protocol + * @param {string} customProtocol - the custom protocol to remove registration for + * @example + * maplibregl.removeProtocol('custom'); + */ + export function removeProtocol(customProtocol: string); export function setRTLTextPlugin(pluginURL: string, callback: (error: Error) => void, deferred?: boolean): void; export function getRTLTextPluginStatus(): PluginStatus; /** * Initializes resources like WebWorkers that can be shared across maps to lower load - * times in some situations. `mapboxgl.workerUrl` and `mapboxgl.workerCount`, if being + * times in some situations. `maplibregl.workerUrl` and `maplibregl.workerCount`, if being * used, must be set before `prewarm()` is called to have an effect. * * By default, the lifecycle of these resources is managed automatically, and they are @@ -56,7 +95,7 @@ declare namespace mapboxgl { * resources will be created ahead of time, and will not be cleared when the last Map * is removed from the page. This allows them to be re-used by new Map instances that * are created later. They can be manually cleared by calling - * `mapboxgl.clearPrewarmedResources()`. This is only necessary if your web page remains + * `maplibregl.clearPrewarmedResources()`. This is only necessary if your web page remains * active but stops using maps altogether. * * This is primarily useful when using GL-JS maps in a single page app, wherein a user @@ -66,7 +105,7 @@ declare namespace mapboxgl { export function prewarm(): void; /** - * Clears up resources that have previously been created by `mapboxgl.prewarm()`. + * Clears up resources that have previously been created by `maplibregl.prewarm()`. * Note that this is typically not necessary. You should only call this function * if you expect the user of your app to not return to a Map view at any point * in your application. @@ -239,9 +278,9 @@ declare namespace mapboxgl { setRenderWorldCopies(renderWorldCopies?: boolean): this; - project(lnglat: LngLatLike): mapboxgl.Point; + project(lnglat: LngLatLike): maplibregl.Point; - unproject(point: PointLike): mapboxgl.LngLat; + unproject(point: PointLike): maplibregl.LngLat; isMoving(): boolean; @@ -294,9 +333,9 @@ declare namespace mapboxgl { } & FilterOptions, ): MapboxGeoJSONFeature[]; - setStyle(style: mapboxgl.Style | string, options?: { diff?: boolean; localIdeographFontFamily?: string }): this; + setStyle(style: maplibregl.Style | string, options?: { diff?: boolean; localIdeographFontFamily?: string }): this; - getStyle(): mapboxgl.Style; + getStyle(): maplibregl.Style; isStyleLoaded(): boolean; @@ -329,13 +368,13 @@ declare namespace mapboxgl { listImages(): string[]; - addLayer(layer: mapboxgl.AnyLayer, before?: string): this; + addLayer(layer: maplibregl.AnyLayer, before?: string): this; moveLayer(id: string, beforeId?: string): this; removeLayer(id: string): this; - getLayer(id: string): mapboxgl.AnyLayer; + getLayer(id: string): maplibregl.AnyLayer; setFilter(layer: string, filter?: any[] | boolean | null, options?: FilterOptions | null): this; @@ -351,18 +390,18 @@ declare namespace mapboxgl { getLayoutProperty(layer: string, name: string): any; - setLight(options: mapboxgl.Light, lightOptions?: any): this; + setLight(options: maplibregl.Light, lightOptions?: any): this; - getLight(): mapboxgl.Light; + getLight(): maplibregl.Light; setFeatureState( - feature: FeatureIdentifier | mapboxgl.MapboxGeoJSONFeature, + feature: FeatureIdentifier | maplibregl.MapboxGeoJSONFeature, state: { [key: string]: any }, ): void; - getFeatureState(feature: FeatureIdentifier | mapboxgl.MapboxGeoJSONFeature): { [key: string]: any }; + getFeatureState(feature: FeatureIdentifier | maplibregl.MapboxGeoJSONFeature): { [key: string]: any }; - removeFeatureState(target: FeatureIdentifier | mapboxgl.MapboxGeoJSONFeature, key?: string): void; + removeFeatureState(target: FeatureIdentifier | maplibregl.MapboxGeoJSONFeature, key?: string): void; getContainer(): HTMLElement; @@ -393,27 +432,27 @@ declare namespace mapboxgl { repaint: boolean; - getCenter(): mapboxgl.LngLat; + getCenter(): maplibregl.LngLat; - setCenter(center: LngLatLike, eventData?: mapboxgl.EventData): this; + setCenter(center: LngLatLike, eventData?: maplibregl.EventData): this; - panBy(offset: PointLike, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + panBy(offset: PointLike, options?: maplibregl.AnimationOptions, eventData?: maplibregl.EventData): this; - panTo(lnglat: LngLatLike, options?: mapboxgl.AnimationOptions, eventdata?: mapboxgl.EventData): this; + panTo(lnglat: LngLatLike, options?: maplibregl.AnimationOptions, eventdata?: maplibregl.EventData): this; getZoom(): number; - setZoom(zoom: number, eventData?: mapboxgl.EventData): this; + setZoom(zoom: number, eventData?: maplibregl.EventData): this; - zoomTo(zoom: number, options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + zoomTo(zoom: number, options?: maplibregl.AnimationOptions, eventData?: maplibregl.EventData): this; - zoomIn(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + zoomIn(options?: maplibregl.AnimationOptions, eventData?: maplibregl.EventData): this; - zoomOut(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + zoomOut(options?: maplibregl.AnimationOptions, eventData?: maplibregl.EventData): this; getBearing(): number; - setBearing(bearing: number, eventData?: mapboxgl.EventData): this; + setBearing(bearing: number, eventData?: maplibregl.EventData): this; /** * Returns the current padding applied around the map viewport. @@ -440,13 +479,13 @@ declare namespace mapboxgl { */ setPadding(padding: PaddingOptions, eventData?: EventData): this; - rotateTo(bearing: number, options?: mapboxgl.AnimationOptions, eventData?: EventData): this; + rotateTo(bearing: number, options?: maplibregl.AnimationOptions, eventData?: EventData): this; - resetNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + resetNorth(options?: maplibregl.AnimationOptions, eventData?: maplibregl.EventData): this; - resetNorthPitch(options?: mapboxgl.AnimationOptions | null, eventData?: mapboxgl.EventData | null): this; + resetNorthPitch(options?: maplibregl.AnimationOptions | null, eventData?: maplibregl.EventData | null): this; - snapToNorth(options?: mapboxgl.AnimationOptions, eventData?: mapboxgl.EventData): this; + snapToNorth(options?: maplibregl.AnimationOptions, eventData?: maplibregl.EventData): this; getPitch(): number; @@ -454,7 +493,7 @@ declare namespace mapboxgl { cameraForBounds(bounds: LngLatBoundsLike, options?: CameraForBoundsOptions): CameraForBoundsResult | undefined; - fitBounds(bounds: LngLatBoundsLike, options?: mapboxgl.FitBoundsOptions, eventData?: mapboxgl.EventData): this; + fitBounds(bounds: LngLatBoundsLike, options?: maplibregl.FitBoundsOptions, eventData?: maplibregl.EventData): this; fitScreenCoordinates( p0: PointLike, @@ -464,11 +503,11 @@ declare namespace mapboxgl { eventData?: EventData, ): this; - jumpTo(options: mapboxgl.CameraOptions, eventData?: mapboxgl.EventData): this; + jumpTo(options: maplibregl.CameraOptions, eventData?: maplibregl.EventData): this; - easeTo(options: mapboxgl.EaseToOptions, eventData?: mapboxgl.EventData): this; + easeTo(options: maplibregl.EaseToOptions, eventData?: maplibregl.EventData): this; - flyTo(options: mapboxgl.FlyToOptions, eventData?: mapboxgl.EventData): this; + flyTo(options: maplibregl.FlyToOptions, eventData?: maplibregl.EventData): this; isEasing(): boolean; @@ -687,7 +726,7 @@ declare namespace mapboxgl { scrollZoom?: boolean; /** stylesheet location */ - style?: mapboxgl.Style | string; + style?: maplibregl.Style | string; /** If true, the map will automatically resize when the browser window resizes */ trackResize?: boolean; @@ -718,7 +757,7 @@ declare namespace mapboxgl { maxTileCacheSize?: number; /** - * If specified, map will use this token instead of the one defined in mapboxgl.accessToken. + * If specified, map will use this token instead of the one defined in maplibregl.accessToken. * * @default null */ @@ -758,6 +797,10 @@ declare namespace mapboxgl { export type TransformRequestFunction = (url: string, resourceType: ResourceType) => RequestParameters; + export type ResponseCallback = (error?: Error, data?: T, cacheControl?: string, expires?: string) => void; + + export type Cancelable = { cancel: () => void }; + export interface PaddingOptions { top: number; bottom: number; @@ -775,7 +818,7 @@ declare namespace mapboxgl { * BoxZoomHandler */ export class BoxZoomHandler { - constructor(map: mapboxgl.Map); + constructor(map: maplibregl.Map); isEnabled(): boolean; @@ -790,7 +833,7 @@ declare namespace mapboxgl { * ScrollZoomHandler */ export class ScrollZoomHandler { - constructor(map: mapboxgl.Map); + constructor(map: maplibregl.Map); isEnabled(): boolean; @@ -807,7 +850,7 @@ declare namespace mapboxgl { * DragPenHandler */ export class DragPanHandler { - constructor(map: mapboxgl.Map); + constructor(map: maplibregl.Map); isEnabled(): boolean; @@ -822,7 +865,7 @@ declare namespace mapboxgl { * DragRotateHandler */ export class DragRotateHandler { - constructor(map: mapboxgl.Map, options?: { bearingSnap?: number; pitchWithRotate?: boolean }); + constructor(map: maplibregl.Map, options?: { bearingSnap?: number; pitchWithRotate?: boolean }); isEnabled(): boolean; @@ -837,7 +880,7 @@ declare namespace mapboxgl { * KeyboardHandler */ export class KeyboardHandler { - constructor(map: mapboxgl.Map); + constructor(map: maplibregl.Map); isEnabled(): boolean; @@ -877,7 +920,7 @@ declare namespace mapboxgl { * DoubleClickZoomHandler */ export class DoubleClickZoomHandler { - constructor(map: mapboxgl.Map); + constructor(map: maplibregl.Map); isEnabled(): boolean; @@ -890,7 +933,7 @@ declare namespace mapboxgl { * TouchZoomRotateHandler */ export class TouchZoomRotateHandler { - constructor(map: mapboxgl.Map); + constructor(map: maplibregl.Map); isEnabled(): boolean; @@ -904,7 +947,7 @@ declare namespace mapboxgl { } export class TouchPitchHandler { - constructor(map: mapboxgl.Map); + constructor(map: maplibregl.Map); enable(): void; @@ -994,15 +1037,15 @@ declare namespace mapboxgl { * Popup */ export class Popup extends Evented { - constructor(options?: mapboxgl.PopupOptions); + constructor(options?: maplibregl.PopupOptions); - addTo(map: mapboxgl.Map): this; + addTo(map: maplibregl.Map): this; isOpen(): boolean; remove(): this; - getLngLat(): mapboxgl.LngLat; + getLngLat(): maplibregl.LngLat; /** * Sets the geographical location of the popup's anchor, and moves the popup to it. Replaces trackPointer() behavior. @@ -1036,7 +1079,7 @@ declare namespace mapboxgl { * @param {string} className Non-empty string with CSS class name to add to popup container * * @example - * let popup = new mapboxgl.Popup() + * let popup = new maplibregl.Popup() * popup.addClassName('some-class') */ addClassName(className: string): void; @@ -1047,7 +1090,7 @@ declare namespace mapboxgl { * @param {string} className Non-empty string with CSS class name to remove from popup container * * @example - * let popup = new mapboxgl.Popup() + * let popup = new maplibregl.Popup() * popup.removeClassName('some-class') */ removeClassName(className: string): void; @@ -1068,7 +1111,7 @@ declare namespace mapboxgl { * @returns {boolean} if the class was removed return false, if class was added, then return true * * @example - * let popup = new mapboxgl.Popup() + * let popup = new maplibregl.Popup() * popup.toggleClassName('toggleClass') */ toggleClassName(className: string): boolean; @@ -1187,7 +1230,7 @@ declare namespace mapboxgl { export class GeoJSONSource implements GeoJSONSourceRaw { type: 'geojson'; - constructor(options?: mapboxgl.GeoJSONSourceOptions); + constructor(options?: maplibregl.GeoJSONSourceOptions); setData(data: GeoJSON.Feature | GeoJSON.FeatureCollection | String): this; @@ -1249,7 +1292,7 @@ declare namespace mapboxgl { export class VideoSource implements VideoSourceRaw { type: 'video'; - constructor(options?: mapboxgl.VideoSourceOptions); + constructor(options?: maplibregl.VideoSourceOptions); getVideo(): HTMLVideoElement; @@ -1272,7 +1315,7 @@ declare namespace mapboxgl { export class ImageSource implements ImageSourceRaw { type: 'image'; - constructor(options?: mapboxgl.ImageSourceOptions); + constructor(options?: maplibregl.ImageSourceOptions); updateImage(options: ImageSourceOptions): this; @@ -1362,7 +1405,7 @@ declare namespace mapboxgl { constructor(lng: number, lat: number); /** Return a new LngLat object whose longitude is wrapped to the range (-180, 180). */ - wrap(): mapboxgl.LngLat; + wrap(): maplibregl.LngLat; /** Return a LngLat as an array */ toArray(): number[]; @@ -1376,7 +1419,7 @@ declare namespace mapboxgl { toBounds(radius: number): LngLatBounds; - static convert(input: LngLatLike): mapboxgl.LngLat; + static convert(input: LngLatLike): maplibregl.LngLat; } /** @@ -1397,22 +1440,22 @@ declare namespace mapboxgl { contains(lnglat: LngLatLike): boolean; /** Extend the bounds to include a given LngLat or LngLatBounds. */ - extend(obj: mapboxgl.LngLatLike | mapboxgl.LngLatBoundsLike): this; + extend(obj: maplibregl.LngLatLike | maplibregl.LngLatBoundsLike): this; /** Get the point equidistant from this box's corners */ - getCenter(): mapboxgl.LngLat; + getCenter(): maplibregl.LngLat; /** Get southwest corner */ - getSouthWest(): mapboxgl.LngLat; + getSouthWest(): maplibregl.LngLat; /** Get northeast corner */ - getNorthEast(): mapboxgl.LngLat; + getNorthEast(): maplibregl.LngLat; /** Get northwest corner */ - getNorthWest(): mapboxgl.LngLat; + getNorthWest(): maplibregl.LngLat; /** Get southeast corner */ - getSouthEast(): mapboxgl.LngLat; + getSouthEast(): maplibregl.LngLat; /** Get west edge longitude */ getWest(): number; @@ -1436,7 +1479,7 @@ declare namespace mapboxgl { isEmpty(): boolean; /** Convert an array to a LngLatBounds object, or return an existing LngLatBounds object unchanged. */ - static convert(input: LngLatBoundsLike): mapboxgl.LngLatBounds; + static convert(input: LngLatBoundsLike): maplibregl.LngLatBounds; } /** @@ -1529,9 +1572,9 @@ declare namespace mapboxgl { * Marker */ export class Marker extends Evented { - constructor(options?: mapboxgl.MarkerOptions); + constructor(options?: maplibregl.MarkerOptions); - constructor(element?: HTMLElement, options?: mapboxgl.MarkerOptions); + constructor(element?: HTMLElement, options?: maplibregl.MarkerOptions); addTo(map: Map): this; @@ -1823,10 +1866,10 @@ declare namespace mapboxgl { delayEndEvents?: number; } - export interface FitBoundsOptions extends mapboxgl.FlyToOptions { + export interface FitBoundsOptions extends maplibregl.FlyToOptions { linear?: boolean; - padding?: number | mapboxgl.PaddingOptions; - offset?: mapboxgl.PointLike; + padding?: number | maplibregl.PaddingOptions; + offset?: maplibregl.PointLike; maxZoom?: number; maxDuration?: number; } @@ -2038,7 +2081,7 @@ declare namespace mapboxgl { * @param map The Map this custom layer was just added to. * @param gl The gl context for the map. */ - onRemove?(map: mapboxgl.Map, gl: WebGLRenderingContext): void; + onRemove?(map: maplibregl.Map, gl: WebGLRenderingContext): void; /** * Optional method called when the layer has been added to the Map with Map#addLayer. @@ -2046,7 +2089,7 @@ declare namespace mapboxgl { * @param map The Map this custom layer was just added to. * @param gl The gl context for the map. */ - onAdd?(map: mapboxgl.Map, gl: WebGLRenderingContext): void; + onAdd?(map: maplibregl.Map, gl: WebGLRenderingContext): void; /** * Optional method called during a render frame to allow a layer to prepare resources diff --git a/src/index.js b/src/index.js index 74b5b8edd9..e559b7defb 100644 --- a/src/index.js +++ b/src/index.js @@ -175,12 +175,15 @@ const exported = { workerUrl: '', /** - * Sets a custom load tile function that will be called when the using a source that starts with a custom url. - * The example below will be triggered for custom:// urls. - * The function to be used will recieve the request parameters and should call the callback with the resulting request, - * For example a pbf vector tile non compressed represented as ArrayBuffer: - * ``` - maplibre.addProtocol("custom", (params, callback) => { + * Sets a custom load tile function that will be called when using a source that starts with a custom url schema. + * The example below will be triggered for custom:// urls defined in the sources list in the style definitions. + * The function passed will receive the request parameters and should call the callback with the resulting request, + * for example a pbf vector tile, non-compressed, represented as ArrayBuffer. + * @param {string} customProtocol - the protocol to hook, for example 'custom' + * @param {Function} loadFn - the function to use when trying to fetch a tile specified by the customProtocol + * @example + * // this will fetch a file using the fetch API (this is obviously a non iteresting example...) + * maplibre.addProtocol('custom', (params, callback) => { fetch(`https://${params.url.split("://")[1]}`) .then(t => { if (t.status == 200) { @@ -197,17 +200,23 @@ const exported = { return { cancel: () => { } }; }); * // the following is an example of a way to return an error when trying to load a tile - * addProtocol('custom', (params, callback) => { - * callback(new Error(someErrorMessage)); + * maplibre.addProtocol('custom2', (params, callback) => { + * callback(new Error('someErrorMessage')); * return { cancel: () => { } }; * }); - * ``` */ - addProtocol(customUrl: string, loadFn: (requestParameters: RequestParameters, callback: ResponseCallback) => Cancelable) { - config.REGISTERED_PROTOCOLS[customUrl] = loadFn; + addProtocol(customProtocol: string, loadFn: (requestParameters: RequestParameters, callback: ResponseCallback) => Cancelable) { + config.REGISTERED_PROTOCOLS[customProtocol] = loadFn; }, - removeProtocol(customUrl: string) { - delete config.REGISTERED_PROTOCOLS[customUrl]; + + /** + * Removes a previusly added protocol + * @param {string} customProtocol - the custom protocol to remove registration for + * @example + * maplibregl.removeProtocol('custom'); + */ + removeProtocol(customProtocol: string) { + delete config.REGISTERED_PROTOCOLS[customProtocol]; } }; diff --git a/src/util/ajax.js b/src/util/ajax.js index 90b6c3579e..e1a033c614 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -242,14 +242,14 @@ export const makeRequest = function(requestParameters: RequestParameters, callba // some versions (see https://bugs.webkit.org/show_bug.cgi?id=174980#c2) // - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In // this case we unconditionally use XHR on the current thread since referrers don't matter. - if (!(/^https?:|^file:/.test(requestParameters.url))){ + if (!(/^https?:|^file:/.test(requestParameters.url))) { if (isWorker() && self.worker && self.worker.actor) { return self.worker.actor.send('getResource', requestParameters, callback); } if (!isWorker()) { - const p = requestParameters.url.substring(0, requestParameters.url.indexOf('://')); - const f = config.REGISTERED_PROTOCOLS[p]; - return ((f === void 0) ? makeFetchRequest : f)(requestParameters, callback); + const protocol = requestParameters.url.substring(0, requestParameters.url.indexOf('://')); + const action = config.REGISTERED_PROTOCOLS[protocol] ?? makeFetchRequest; + return action(requestParameters, callback); } } if (!isFileURL(requestParameters.url)) { From 187b6411f2166d6c2333265e095bacd1a20bc8d3 Mon Sep 17 00:00:00 2001 From: HarelM Date: Sat, 5 Jun 2021 15:41:52 +0300 Subject: [PATCH 11/15] Fix compilation --- src/util/ajax.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/ajax.js b/src/util/ajax.js index e1a033c614..7fb3ae1918 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -248,7 +248,7 @@ export const makeRequest = function(requestParameters: RequestParameters, callba } if (!isWorker()) { const protocol = requestParameters.url.substring(0, requestParameters.url.indexOf('://')); - const action = config.REGISTERED_PROTOCOLS[protocol] ?? makeFetchRequest; + const action = config.REGISTERED_PROTOCOLS[protocol] || makeFetchRequest; return action(requestParameters, callback); } } From 8d207dcc08780d633654be853ba234601c0ac202 Mon Sep 17 00:00:00 2001 From: HarelM Date: Sat, 5 Jun 2021 16:00:43 +0300 Subject: [PATCH 12/15] Fix flow definition of config and get image tests --- src/util/ajax.js | 2 +- src/util/config.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util/ajax.js b/src/util/ajax.js index 7fb3ae1918..83f0431211 100644 --- a/src/util/ajax.js +++ b/src/util/ajax.js @@ -242,7 +242,7 @@ export const makeRequest = function(requestParameters: RequestParameters, callba // some versions (see https://bugs.webkit.org/show_bug.cgi?id=174980#c2) // - Requests for resources with the file:// URI scheme don't work with the Fetch API either. In // this case we unconditionally use XHR on the current thread since referrers don't matter. - if (!(/^https?:|^file:/.test(requestParameters.url))) { + if (/:\/\//.test(requestParameters.url) && !(/^https?:|^file:/.test(requestParameters.url))) { if (isWorker() && self.worker && self.worker.actor) { return self.worker.actor.send('getResource', requestParameters, callback); } diff --git a/src/util/config.js b/src/util/config.js index f3fb927bd3..d8bb2dce26 100644 --- a/src/util/config.js +++ b/src/util/config.js @@ -7,7 +7,7 @@ type Config = {| REQUIRE_ACCESS_TOKEN: boolean, ACCESS_TOKEN: ?string, MAX_PARALLEL_IMAGE_REQUESTS: number, - REGISTERED_PROTOCOLS: object, + REGISTERED_PROTOCOLS: { [string]: any }, |}; const config: Config = { From d687660f05b49792ef2bfe4f1ee02d162ab2c5c7 Mon Sep 17 00:00:00 2001 From: HarelM Date: Sat, 5 Jun 2021 16:11:03 +0300 Subject: [PATCH 13/15] remove strict to avoid circular dependencies --- src/util/config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/config.js b/src/util/config.js index d8bb2dce26..95d559d313 100644 --- a/src/util/config.js +++ b/src/util/config.js @@ -1,4 +1,4 @@ -// @flow strict +// @flow type Config = {| API_URL: string, From 8e1e9c16fba2123fb30bb1dd3539e9c53dcdf972 Mon Sep 17 00:00:00 2001 From: Harel M Date: Thu, 17 Jun 2021 23:30:14 +0300 Subject: [PATCH 14/15] Update CHANGELOG.md Added link to issue and item in the changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7551571d4f..33d75582a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ### Features and improvements - *...Add new stuff here...* +- Added custom protocol support to allow overriding ajax calls ((#29)[https://github.com/maplibre/maplibre-gl-js/issues/29]) - Added setTransformRequest to map (#159) - Publish @maplibre/maplibre-gl-style-spec v14.0.0 on NPM (#149) - Replace link to mapbox on LogoControl by link to maplibre (#151) From 9444a6e11627775f39fcbb3a8556aa465d66dc22 Mon Sep 17 00:00:00 2001 From: Harel M Date: Thu, 17 Jun 2021 23:31:29 +0300 Subject: [PATCH 15/15] Update package.json Increment rc candidate number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 490e9ad90c..ab7bb30342 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "maplibre-gl", "description": "BSD licensed community fork of mapbox-gl, a WebGL interactive maps library", - "version": "1.14.1-rc.1", + "version": "1.14.1-rc.2", "main": "dist/maplibre-gl.js", "style": "dist/maplibre-gl.css", "license": "BSD-3-Clause",