@acalcutt/maplibre-gl-native-test 5.0.20 → 5.2.1-pre.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,13 @@
1
- ### [Mapbox GL Native](https://github.com/mapbox/mapbox-gl-native) by Mapbox
1
+ ### [Maplibre Native](https://github.com/maplibre/maplibre-native/)
2
2
 
3
3
  ```
4
- mapbox-gl-native Copyright (c) 2014-2020 Mapbox.
4
+ BSD 2-Clause License
5
+
6
+ Copyright (c) 2021 MapLibre contributors
7
+
8
+ Copyright (c) 2018-2021 MapTiler.com
9
+
10
+ Copyright (c) 2014-2020 Mapbox
5
11
 
6
12
  Redistribution and use in source and binary forms, with or without
7
13
  modification, are permitted provided that the following conditions are
package/README.md CHANGED
@@ -1,152 +1,87 @@
1
- # MapLibre GL Native - Open-Source Mapbox GL Native
1
+ [![MapLibre Logo](https://maplibre.org/img/maplibre-logo-big.svg)](https://maplibre.org/)
2
2
 
3
- SDK for iOS, Android and other platforms
3
+ # MapLibre Native
4
4
 
5
- MapLibre GL Native is a community led fork derived from [mapbox-gl-native](https://github.com/mapbox/mapbox-gl-native) prior to their switch to a non-OSS license. The fork also includes Maps SDK for iOS and MacOS (forked from [mapbox-gl-native-ios](https://github.com/mapbox/mapbox-gl-native-ios)) and Android SDK (forked from [mapbox-gl-native-android](https://github.com/mapbox/mapbox-gl-native-android)). These platform-specific SDKs were merged under platform directory and they reference mapbox-gl-native directly, not as a submodule.
5
+ [![codecov](https://codecov.io/github/maplibre/maplibre-native/branch/main/graph/badge.svg?token=8ZQRRY56ZA)](https://codecov.io/github/maplibre/maplibre-native) [![](https://img.shields.io/badge/Slack-%23maplibre--native-2EB67D?logo=slack)](https://slack.openstreetmap.us/)
6
6
 
7
- Beside merging in platform specific SDKs, the following changes were made compared to original mapbox projects:
7
+ MapLibre Native is a free and open-source library for publishing maps in your apps and desktop applications on various platforms. Fast displaying of maps is possible thanks to GPU-accelerated vector tile rendering.
8
8
 
9
- * The code was upgraded so that it can be built using latest clang compiler / Xcode 12.
10
- * CI/CD was migrated from CircleCI to GitHub Actions.
11
- * Along with GitHub releases, binaries are distributed as follows:
12
- * The iOS binaries distribution was upgraded from fat packages to Swift package containing XCFramework.
13
- * The Android binaries are distributed to GitHub maven package repository.
9
+ This project originated as a fork of Mapbox GL Native, before their switch to a non-OSS license in December 2020. For more information, see: [`FORK.md`](./FORK.md).
14
10
 
15
- > The mapbox-gl-native was forked from [d60fd30 - mgbl 1.6.0](https://github.com/mapbox/mapbox-gl-native/tree/d60fd302b1f6563e7d16952f8855122fdcc85f73), mapbox-gl-native-ios from [a139216](https://github.com/mapbox/mapbox-gl-native-ios/commit/a139216) and mapbox-gl-native-android from [4c12fb2](https://github.com/mapbox/mapbox-gl-native-android/commit/4c12fb2c)
16
- ## Build Status
11
+ <p align="center">
12
+ <img src="https://user-images.githubusercontent.com/649392/211550776-8779041a-7c12-4bed-a7bd-c2ec80af2b29.png" alt="Android device with MapLibre" width="24%"> <img src="https://user-images.githubusercontent.com/649392/211550762-0f42ebc9-05ab-4d89-bd59-c306453ea9af.png" alt="iOS device with MapLibre" width="25%">
13
+ </p>
17
14
 
18
- | SDK | Build | Build status |
19
- |---------------------------------------------------------------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
20
- | [Maps SDK for iOS](platform/ios/) | CI | [![GitHub Action build status](https://github.com/maplibre/maplibre-gl-native/workflows/ios-ci/badge.svg)](https://github.com/maplibre/maplibre-gl-native/workflows/ios-ci) |
21
- | [Maps SDK for iOS](platform/ios/) | Release | [![GitHub Action build status](https://github.com/maplibre/maplibre-gl-native/workflows/ios-release/badge.svg)](https://github.com/maplibre/maplibre-gl-native/workflows/ios-release) |
22
- | [Maps SDK for Android](platform/android/) | CI | [![GitHub Action build status](https://github.com/maplibre/maplibre-gl-native/workflows/android-ci/badge.svg)](https://github.com/maplibre/maplibre-gl-native/workflows/android-ci) |
23
- | [Maps SDK for Android](platform/android/) | Release | [![GitHub Action build status](https://github.com/maplibre/maplibre-gl-native/workflows/android-release/badge.svg)](https://github.com/maplibre/maplibre-gl-native/workflows/android-release) |
15
+ ## Getting Started
24
16
 
17
+ To get started with MapLibre Native, go to your platform below.
25
18
 
26
- ## Sponsors
19
+ ## Documentation
27
20
 
28
- We thank everyone who supported us financially in the past and special thanks to the people and organizations who support us with recurring dontations:
21
+ The documentation of MapLibre Native is a work in progress. To get an architectural overview and to learn about the current state of the project and its path forward read the [MapLibre Native Markdown Book](https://maplibre.org/maplibre-native/docs/book/). See below for platform-specific documentation.
29
22
 
30
- [MIERUNE Inc.](https://www.mierune.co.jp/?lang=en) [@MIERUNE](https://github.com/MIERUNE), [@jawg](https://github.com/jawg), [@nekoyasan](https://github.com/nekoyasan), [@atierian](https://github.com/atierian), [@photoprism](https://github.com/photoprism), [@kaplanlior](https://github.com/kaplanlior), [@francois2metz](https://github.com/francois2metz), [@Schneider-Geo](https://github.com/Schneider-Geo), [@serghov](https://github.com/serghov), [@ambientlight](https://github.com/ambientlight), [@joschi77](https://github.com/joschi77), [@geoffhill](https://github.com/geoffhill), [@jasongode](https://github.com/jasongode)
23
+ ## Platforms
31
24
 
32
- ## Installation
25
+ - [⭐️ Android](platform/android/README.md)
26
+ - [⭐️ iOS](platform/ios/README.md)
27
+ - [GLFW](platform/glfw)
28
+ - [Linux](platform/linux/README.md)
29
+ - [Node.js](platform/node/README.md)
30
+ - [Qt](platform/qt/README.md)
31
+ - [Windows](platform/windows/README.md)
32
+ - [macOS](platform/macos/README.md)
33
33
 
34
- ### Android
34
+ Platforms with a ⭐️ are **MapLibre Core Projects** and have a substantial amount of financial resources allocated to them. Learn about the different [project tiers](https://github.com/maplibre/maplibre/blob/main/PROJECT_TIERS.md#project-tiers).
35
35
 
36
- 1. Add bintray maven repositories to your build.gradle at project level so that you can access MapLibre packages for Android:
36
+ ## Renderer Modularization & Metal
37
37
 
38
- ```gradle
39
- allprojects {
40
- repositories {
41
- ...
42
- mavenCentral()
43
- }
44
- }
45
- ```
38
+ ![image-metal](https://user-images.githubusercontent.com/53421382/214308933-66cd4efb-b5a5-4de3-b4b4-7ed59045a1c3.png)
46
39
 
47
- > Note: [Bintray was turn off May 1st, 2021](https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/) so we migrated all packages to maven central.
40
+ MapLibre Native is being actively developed. Our big goal for 2023 is to modularize the OpenGL renderer and implement a Metal graphics backend (https://developer.apple.com/metal/). This will improve the performance and yield lower power consumption on iOS devices. At the same time, the Metal preparations will help us in the implementation of a Vulkan graphics backend.
48
41
 
49
- 2. Add the library as a dependency into your module build.gradle
42
+ Your help in preparing the codebase for the latest graphics backends is more than welcome. Feel free to reach out if you are interested in joining the effort!
50
43
 
51
- ```gradle
52
- dependencies {
53
- ...
54
- implementation 'org.maplibre.gl:android-sdk:9.4.0'
55
- ...
56
- }
57
- ```
44
+ - Check out the [news](https://maplibre.org/news/) on MapLibre's website.
45
+ - See the [Design Proposals](https://github.com/maplibre/maplibre-native/tree/main/design-proposals) that have been accepted and are being worked on, the most recent ones being the [Rendering Modularization Design Proposal](design-proposals/2022-10-27-rendering-modularization.md) and the [Metal Port Design Proposal](design-proposals/2022-11-29-metal-port.md).
58
46
 
59
- 3. Sync gradle and rebuild your app
47
+ ## Contributing
60
48
 
61
- ### iOS
49
+ To contribute to MapLibre Native, see [`CONTRIBUTING.md`](CONTRIBUTING.md) and (if applicable) the specific instructions for the platform you want to contribute to.
62
50
 
63
- 1. To add a package dependency to your Xcode project, select File > Swift Packages > Add Package Dependency and enter its repository URL. You can also navigate to your target’s General pane, and in the “Frameworks, Libraries, and Embedded Content” section, click the + button, select Add Other, and choose Add Package Dependency.
51
+ ### Getting Involved
64
52
 
65
- 2. Either add MapLibre GitHub distribution URL (https://github.com/maplibre/maplibre-gl-native-distribution) or search for `maplibre-gl-native` package.
53
+ Join the `#maplibre-native` Slack channel at OSMUS. Get an invite at https://slack.openstreetmap.us/
66
54
 
67
- 3. Choose "next". Xcode should clone the distribution repository and download the binaries.
55
+ ### Bounties 💰
68
56
 
69
- ## Alternative installation
57
+ Thanks to our sponsors, we are able to award bounties to developers making contributions toward certain [bounty directions](https://github.com/maplibre/maplibre/issues?q=is%3Aissue+is%3Aopen+label%3A%22bounty+direction%22). To get started doing bounties, refer to the [step-by-step bounties guide](https://maplibre.org/roadmap/step-by-step-bounties-guide/).
70
58
 
71
- You can also download pre-build from releases in this repository.
59
+ We thank everyone who supported us financially in the past and special thanks to the people and organizations who support us with recurring donations!
72
60
 
73
- ## How to create your own build
61
+ Read more about the MapLibre Sponsorship Program at [https://maplibre.org/sponsors/](https://maplibre.org/sponsors/).
74
62
 
75
- ### Source code checkout
63
+ Platinum:
76
64
 
77
- ```bash
78
- git clone --recurse-submodules https://github.com/maplibre/maplibre-gl-native.git
79
- ```
65
+ <a href="https://aws.com"><img src="https://maplibre.org/img/aws-logo.svg" alt="Logo AWS" width="25%"/></a>
80
66
 
81
- ### Build
67
+ Gold:
82
68
 
83
- MapLibre uses tags for its Android & iOS releases based on [SemVer](https://semver.org) versioning. This is useful for checking out a particular released version for feature enhancments or debugging.
69
+ <a href="https://meta.com"><img src="https://maplibre.org/img/meta-logo.svg" alt="Logo Meta" width="25%"/></a>
84
70
 
85
- You can list available tags by issuing the command `git tag`, then use the result
71
+ Silver:
86
72
 
87
- ```bash
88
- # 1. Obtain a list of tags, which matches to release versions
89
- git tag
73
+ <a href="https://www.mierune.co.jp/?lang=en"><img src="https://maplibre.org/img/mierune-logo.svg" alt="Logo MIERUNE" width="25%"/></a>
90
74
 
91
- # 2. Set a convenience variable with the desired TAG
92
- # TAG=android-v9.2.1
93
- # TAG=android-v9.4.2
94
- TAG=ios-v5.11.0
95
- # TAG=ios-v5.12.0-pre.1
75
+ <a href="https://komoot.com/"><img src="https://maplibre.org/img/komoot-logo.svg" alt="Logo komoot" width="25%"/></a>
96
76
 
97
- # 3. Check out a particular TAG
98
- git checkout tags/$TAG -b $TAG
77
+ <a href="https://www.jawg.io/"><img src="https://maplibre.org/img/jawgmaps-logo.svg" alt="Logo JawgMaps" width="25%"/></a>
99
78
 
100
- # 4. build, debug or enhance features based on the tag
101
- # clean, if you need to troubleshoot build dependencies by using `make clean`
102
- ```
79
+ <a href="https://www.radar.com/"><img src="https://maplibre.org/img/radar-logo.svg" alt="Logo Radar" width="25%"/></a>
103
80
 
104
- #### Android
81
+ Backers and Supporters:
105
82
 
106
- > Make sure you have set Android SDK path in platform/android/local.properties, variable sdk.dir
83
+ [![](https://opencollective.com/maplibre/backers.svg?avatarHeight=50&width=600)](https://opencollective.com/maplibre)
107
84
 
108
- ```bash
109
- cd platform/android
110
- BUILDTYPE=Release make apackage
111
- ```
85
+ ## License
112
86
 
113
- Binaries are produced in `platform/android/MapboxGLAndroidSDK/build/outputs/aar/MapboxGLAndroidSDK-release.aar`
114
- Please refer to [Mapbox Maps SDK for Android](platform/android/) for detailed instructions.
115
-
116
- #### iOS
117
-
118
- You can run automated test on a Simulator or Device by changing to the Scheme `iosapp` and choosing `Product` > `Test` (or use `⌘-U`). Use `⌘-9` to navigate to `Reports` to see results and browse through screenshots. This method of testing should work well with CI tools such as GitHub Actions, Xcode Server Bots, & AWS Device Farm.
119
-
120
- ```bash
121
- cd platform/ios
122
-
123
- # make and open the Xcode workspace
124
- make iproj
125
-
126
- # make Xcode workspace, but run in headless mode
127
- make iproj CI=1
128
-
129
- # Make Frameworks
130
- make xcframework BUILDTYPE=Release
131
-
132
- # test
133
- make ios-test
134
-
135
- # UITests
136
- # You can review uitest results: $(IOS_OUTPUT_PATH)/Logs/Test
137
- make ios-uitest
138
- ```
139
-
140
- The packaging script will produce a `Mapbox.xcframework` in the `platform/ios/build/ios/pkg/dynamic` folder.
141
- Please refer to [Mapbox Maps SDK for iOS](platform/ios/platform/ios/) for detailed instructions.
142
-
143
-
144
- #### MacOS
145
-
146
- ```bash
147
- cd platform/ios
148
- make xpackage
149
- ```
150
-
151
- This produces a `Mapbox.framework` in the `platform/ios/build/macos/pkg/` folder.
152
- Please refer to [Mapbox Maps SDK for macos](platform/ios/platform/macos/) for detailed instructions.
87
+ **MapLibre Native** is licensed under the [BSD 2-Clause License](./LICENSE.md).
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@acalcutt/maplibre-gl-native-test",
3
- "version": "5.0.20",
4
- "description": "Renders map tiles with Maplibre GL",
3
+ "version": "5.2.1-pre.11",
4
+ "description": "Renders map tiles with MapLibre Native",
5
5
  "keywords": [
6
6
  "maplibre",
7
7
  "gl"
@@ -10,67 +10,67 @@
10
10
  "lib": "lib"
11
11
  },
12
12
  "files": [
13
- "lib"
13
+ "lib",
14
+ "platform/node/index.d.ts"
14
15
  ],
15
16
  "main": "platform/node/index.js",
17
+ "types": "platform/node/index.d.ts",
16
18
  "repository": {
17
19
  "type": "git",
18
- "url": "git+https://github.com/acalcutt/maplibre-gl-native.git"
20
+ "url": "git+https://github.com/WifiDB/maplibre-native.git"
19
21
  },
20
22
  "license": "BSD-2-Clause",
21
23
  "dependencies": {
22
- "@mapbox/cmake-node-module": "^1.2.0",
23
- "@mapbox/node-pre-gyp": "^1.0.9",
24
- "@acalcutt/node-pre-gyp-github": "1.4.5",
25
- "minimatch": "^3.0.4",
24
+ "@acalcutt/node-pre-gyp": "^1.0.14",
25
+ "@acalcutt/node-pre-gyp-github": "1.4.8",
26
+ "minimatch": "^7.2.0",
26
27
  "npm-run-all": "^4.0.2"
27
28
  },
28
29
  "devDependencies": {
29
- "@mapbox/flow-remove-types": "^1.3.0-await.upstream.2",
30
- "@mapbox/mvt-fixtures": "3.5.1",
31
- "@octokit/plugin-retry": "^2.2.0",
32
- "@octokit/rest": "^16.0.0",
33
- "aws-sdk": "^2.285.1",
30
+ "@mapbox/flow-remove-types": "^2.0.0",
31
+ "@mapbox/mvt-fixtures": "3.10.0",
32
+ "@octokit/plugin-retry": "^4.1.2",
33
+ "@octokit/rest": "^19.0.7",
34
+ "argparse": "^2.0.1",
35
+ "aws-sdk": "^2.1318.0",
34
36
  "csscolorparser": "~1.0.2",
35
37
  "d3-queue": "3.0.7",
36
- "diff": "4.0.1",
37
- "ejs": "^2.5.7",
38
+ "diff": "5.1.0",
39
+ "ejs": "^3.1.8",
38
40
  "esm": "~3.2.25",
39
- "express": "^4.11.1",
40
- "json-stringify-pretty-compact": "^2.0.0",
41
- "jsonwebtoken": "^8.3.0",
41
+ "express": "^4.18.2",
42
+ "json-stringify-pretty-compact": "^4.0.0",
43
+ "jsonwebtoken": "^9.0.0",
42
44
  "lodash": "^4.16.4",
43
45
  "lodash.template": "4.5.0",
44
46
  "mapbox-gl-styles": "2.0.2",
45
- "pixelmatch": "^4.0.2",
46
- "pngjs": "^3.4.0",
47
- "pretty-bytes": "^5.1.0",
47
+ "pixelmatch": "^5.3.0",
48
+ "pngjs": "^6.0.0",
49
+ "pretty-bytes": "^6.1.0",
48
50
  "request": "^2.88.0",
49
- "semver": "^5.5.0",
51
+ "semver": "^7.5.2",
50
52
  "shuffle-seed": "1.1.6",
51
- "st": "1.2.2",
52
- "tape": "^4.5.1",
53
- "xcode": "^1.0.0"
53
+ "st": "3.0.0",
54
+ "tape": "^5.6.3",
55
+ "xcode": "^3.0.1"
54
56
  },
55
57
  "engines": {
56
58
  "node": ">=6"
57
59
  },
58
60
  "scripts": {
59
- "install": "node-pre-gyp install --fallback-to-build=true",
61
+ "install": "node-pre-gyp install --fallback-to-build=false",
60
62
  "test": "tape platform/node/test/js/**/*.test.js",
61
63
  "test-memory": "node --expose-gc platform/node/test/memory.test.js",
62
64
  "test-expressions": "node -r esm platform/node/test/expression.test.js",
63
65
  "test-render": "node -r esm platform/node/test/render.test.js",
64
- "test-query": "node -r esm platform/node/test/query.test.js",
65
- "package": "node-pre-gyp package",
66
- "release": "node-pre-gyp-github publish --release"
66
+ "test-query": "node -r esm platform/node/test/query.test.js"
67
67
  },
68
68
  "gypfile": true,
69
69
  "binary": {
70
70
  "module_name": "mbgl",
71
71
  "module_path": "./lib/{node_abi}",
72
- "host": "https://github.com/acalcutt/maplibre-gl-native/releases/download/",
73
- "remote_path": "node-test_v{version}",
72
+ "host": "https://github.com/WifiDB/maplibre-native/releases/download/",
73
+ "remote_path": "node-v{version}",
74
74
  "package_name": "{node_abi}-{platform}-{arch}-{configuration}.tar.gz"
75
75
  }
76
76
  }
@@ -1,18 +1,17 @@
1
1
  # @maplibre/maplibre-gl-native
2
2
 
3
- [![NPM](https://nodei.co/npm/@maplibre/maplibre-gl-native.png)](https://npmjs.org/package/@maplibre/maplibre-gl-native)
4
- [![node-ci](https://github.com/maplibre/maplibre-gl-native/actions/workflows/node-ci.yml/badge.svg)](https://github.com/maplibre/maplibre-gl-native/actions/workflows/node-ci.yml)
3
+ [![Version](https://img.shields.io/npm/v/@maplibre/maplibre-gl-native?style=flat)](https://www.npmjs.com/package/@maplibre/maplibre-gl-native)
4
+ [![node-ci](https://github.com/maplibre/maplibre-native/actions/workflows/node-ci.yml/badge.svg)](https://github.com/maplibre/maplibre-native/actions/workflows/node-ci.yml)
5
5
 
6
6
  ## Installing
7
7
 
8
- #### :warn: This package isn't live yet.
8
+ Binaries are available and downloaded during install for the following platforms:
9
9
 
10
- Requires a modern C++ runtime that supports C++14.
11
-
12
- By default, installs binaries. On these platforms no additional dependencies are needed.
13
-
14
- - 64 bit macOS or 64 bit Linux
15
- - Node.js v10.x
10
+ - Operating systems:
11
+ - Ubuntu 22.04 (amd64/arm64)
12
+ - macOS 12 (amd64/arm64)
13
+ - Windows (amd64)
14
+ - Node.js 16, 18, 20
16
15
 
17
16
  Run:
18
17
 
@@ -20,18 +19,48 @@ Run:
20
19
  npm install @maplibre/maplibre-gl-native
21
20
  ```
22
21
 
23
- Other platforms will fall back to a source compile with `make node`; see [DEVELOPING.md](DEVELOPING.md) for details on
24
- building from source.
22
+ Further platforms might work [with additional libraries installed](https://github.com/maplibre/maplibre-native/tree/main/platform/linux#prerequisites).
25
23
 
26
24
  ## Testing
27
25
 
28
26
  ```
29
27
  npm test
30
- npm run test-suite
31
28
  ```
32
29
 
33
30
  ## Rendering a map tile
34
31
 
32
+ The minimal example requires only the instantiation of the `mbgl.Map` object, loading a style and calling the `map.render` method:
33
+
34
+ ```js
35
+ var mbgl = require('@maplibre/maplibre-gl-native');
36
+ var sharp = require('sharp');
37
+
38
+ var map = new mbgl.Map();
39
+
40
+ map.load(require('./test/fixtures/style.json'));
41
+
42
+ map.render(function(err, buffer) {
43
+ if (err) throw err;
44
+
45
+ map.release();
46
+
47
+ var image = sharp(buffer, {
48
+ raw: {
49
+ width: 512,
50
+ height: 512,
51
+ channels: 4
52
+ }
53
+ });
54
+
55
+ // Convert raw image buffer to PNG
56
+ image.toFile('image.png', function(err) {
57
+ if (err) throw err;
58
+ });
59
+ });
60
+ ```
61
+
62
+ But you can customize the map providing an options object to `mbgl.Map` constructor and to `map.render` method:
63
+
35
64
  ```js
36
65
  var fs = require('fs');
37
66
  var path = require('path');
@@ -89,7 +118,7 @@ When you are finished using a map object, you can call `map.release()` to perman
89
118
 
90
119
  ## Implementing a file source
91
120
 
92
- When creating a `Map`, you must pass an options object (with a required `request` method and optional 'ratio' number) as the first parameter.
121
+ When creating a `Map`, you can optionally pass an options object (with an optional `request` method and optional `ratio` number) as the first parameter. The `request()` method handles a request for a resource. The `ratio` sets the scale at which the map will render tiles, such as `2.0` for rendering images for high pixel density displays:
93
122
 
94
123
  ```js
95
124
  var map = new mbgl.Map({
@@ -100,7 +129,7 @@ var map = new mbgl.Map({
100
129
  });
101
130
  ```
102
131
 
103
- The `request()` method handles a request for a resource. The `ratio` sets the scale at which the map will render tiles, such as `2.0` for rendering images for high pixel density displays. The `req` parameter has two properties:
132
+ If you omit the `request` method, the `map` object will use the default internal request handlers, which is ok for most cases. However, if you have specific needs, you can implement your own `request` handler. When a `request` method is provided, all `map` resources will be requested by calling the `request` method with two parameters, called `req` and `callback` respectively in this example. The `req` parameter has two properties:
104
133
 
105
134
  ```json
106
135
  {
@@ -109,7 +138,7 @@ The `request()` method handles a request for a resource. The `ratio` sets the sc
109
138
  }
110
139
  ```
111
140
 
112
- The `kind` is an enum and defined in [`mbgl.Resource`](https://github.com/maplibre/maplibre-gl-native/blob/main/include/mbgl/storage/resource.hpp):
141
+ The `kind` is an enum and defined in [`mbgl.Resource`](https://github.com/maplibre/maplibre-native/blob/main/include/mbgl/storage/resource.hpp):
113
142
 
114
143
  ```json
115
144
  {
@@ -125,7 +154,18 @@ The `kind` is an enum and defined in [`mbgl.Resource`](https://github.com/maplib
125
154
 
126
155
  The `kind` enum has no significance for anything but serves as a hint to your implemention as to what sort of resource to expect. E.g., your implementation could choose caching strategies based on the expected file type.
127
156
 
128
- The `request` implementation should pass uncompressed data to `callback`. If you are downloading assets from a source that applies gzip transport encoding, the implementation must decompress the results before passing them on.
157
+ The `callback` parameter is a function that must be called with two parameters: an error message (if there are no errors, then you must pass `null`), and a response object:
158
+
159
+ ```js
160
+ {
161
+ data: {data}, // required, must be a byte array, usually a Buffer object
162
+ modified: {modified}, // Date, optional
163
+ expires: {expires}, // Date, optional
164
+ etag: {etag} // string, optional
165
+ }
166
+ ```
167
+
168
+ If there is no data to be sent to the `callback` (empty data, or `no-content` respose), then it must be called without parameters. The `request` implementation should pass uncompressed data to `callback`. If you are downloading assets from a source that applies gzip transport encoding, the implementation must decompress the results before passing them on.
129
169
 
130
170
  A sample implementation that reads files from disk would look like the following:
131
171
 
@@ -175,6 +215,8 @@ var map = new mbgl.Map({
175
215
  response.data = body;
176
216
 
177
217
  callback(null, response);
218
+ } else if (res.statusCode == 204) {
219
+ callback();
178
220
  } else {
179
221
  callback(new Error(JSON.parse(body).message));
180
222
  }
@@ -187,7 +229,7 @@ Stylesheets are free to use any protocols, but your implementation of `request`
187
229
 
188
230
  ## Listening for log events
189
231
 
190
- The module imported with `require('maplibre-gl-native')` inherits from [`EventEmitter`](https://nodejs.org/api/events.html), and the `NodeLogObserver` will push log events to this. Log messages can have [`class`](https://github.com/maplibre/maplibre-gl-native/blob/node-v2.1.0/include/mbgl/platform/event.hpp#L43-L60), [`severity`](https://github.com/maplibre/maplibre-gl-native/blob/node-v2.1.0/include/mbgl/platform/event.hpp#L17-L23), `code` ([HTTP status codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)), and `text` parameters.
232
+ The module imported with `require('maplibre-gl-native')` inherits from [`EventEmitter`](https://nodejs.org/api/events.html), and the `NodeLogObserver` will push log events to this. Log messages can have [`class`](https://github.com/maplibre/maplibre-native/blob/node-v2.1.0/include/mbgl/platform/event.hpp#L43-L60), [`severity`](https://github.com/maplibre/maplibre-native/blob/node-v2.1.0/include/mbgl/platform/event.hpp#L17-L23), `code` ([HTTP status codes](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html)), and `text` parameters.
191
233
 
192
234
  ```js
193
235
  var mbgl = require('@maplibre/maplibre-gl-native');