styled-map-package-api 5.0.0-pre.0 → 5.0.0-pre.1
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.
- package/README.md +90 -0
- package/dist/download.d.cts +1 -2
- package/dist/download.d.ts +1 -2
- package/dist/index.d.cts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/reader.d.cts +1 -2
- package/dist/reader.d.ts +1 -2
- package/dist/server.d.cts +1 -2
- package/dist/server.d.ts +1 -2
- package/dist/style-downloader.d.cts +1 -2
- package/dist/style-downloader.d.ts +1 -2
- package/dist/tile-downloader.d.cts +1 -2
- package/dist/tile-downloader.d.ts +1 -2
- package/dist/{types-CJq90eOB.d.cts → types-DPei6PMF.d.cts} +1 -2
- package/dist/{types-CJq90eOB.d.ts → types-DPei6PMF.d.ts} +1 -2
- package/dist/utils/file-formats.d.cts +1 -2
- package/dist/utils/file-formats.d.ts +1 -2
- package/dist/utils/style.d.cts +1 -2
- package/dist/utils/style.d.ts +1 -2
- package/dist/utils/templates.d.cts +1 -2
- package/dist/utils/templates.d.ts +1 -2
- package/dist/writer.cjs +1 -3
- package/dist/writer.d.cts +1 -2
- package/dist/writer.d.ts +1 -2
- package/dist/writer.js +1 -3
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# styled-map-package-api
|
|
2
|
+
|
|
3
|
+
JavaScript API for reading, writing, and serving Styled Map Package (`.smp`) files. Works in both Node.js and browsers.
|
|
4
|
+
|
|
5
|
+
An `.smp` file is a ZIP archive containing all the resources needed to serve a MapLibre vector styled map offline: style JSON, vector and raster tiles, glyphs (fonts), sprites, and metadata.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install styled-map-package-api
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### Reading an SMP file
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { Reader } from 'styled-map-package-api/reader'
|
|
19
|
+
|
|
20
|
+
const reader = new Reader('path/to/map.smp')
|
|
21
|
+
const style = await reader.getStyle()
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
### Writing an SMP file
|
|
25
|
+
|
|
26
|
+
```js
|
|
27
|
+
import { Writer } from 'styled-map-package-api/writer'
|
|
28
|
+
|
|
29
|
+
const writer = new Writer(style, sources)
|
|
30
|
+
const stream = writer.outputStream
|
|
31
|
+
// Pipe stream to a file or other writable destination
|
|
32
|
+
await writer.finish()
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Serving over HTTP
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
import { Reader } from 'styled-map-package-api/reader'
|
|
39
|
+
import { createServer } from 'styled-map-package-api/server'
|
|
40
|
+
|
|
41
|
+
const reader = new Reader('path/to/map.smp')
|
|
42
|
+
const server = createServer()
|
|
43
|
+
// server.fetch(request, reader) returns a WHATWG Response
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Downloading a map for offline use
|
|
47
|
+
|
|
48
|
+
```js
|
|
49
|
+
import { download } from 'styled-map-package-api/download'
|
|
50
|
+
|
|
51
|
+
const stream = download({
|
|
52
|
+
styleUrl: 'https://demotiles.maplibre.org/style.json',
|
|
53
|
+
bbox: [-180, -80, 180, 80],
|
|
54
|
+
maxzoom: 5,
|
|
55
|
+
})
|
|
56
|
+
// Pipe the ReadableStream to a file
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Converting from MBTiles
|
|
60
|
+
|
|
61
|
+
```js
|
|
62
|
+
import { fromMBTiles } from 'styled-map-package-api/from-mbtiles'
|
|
63
|
+
|
|
64
|
+
const stream = fromMBTiles('path/to/tiles.mbtiles')
|
|
65
|
+
// Pipe the ReadableStream to an .smp file
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## API
|
|
69
|
+
|
|
70
|
+
### Exports
|
|
71
|
+
|
|
72
|
+
| Export path | Description |
|
|
73
|
+
| ----------------------------------------- | ----------------------------------------------------------------- |
|
|
74
|
+
| `styled-map-package-api` | Main entry — `Reader`, `Writer`, `createServer`, `download`, etc. |
|
|
75
|
+
| `styled-map-package-api/reader` | `Reader` class for reading `.smp` files |
|
|
76
|
+
| `styled-map-package-api/writer` | `Writer` class for creating `.smp` files |
|
|
77
|
+
| `styled-map-package-api/server` | `createServer()` — HTTP handler using WHATWG Request/Response |
|
|
78
|
+
| `styled-map-package-api/download` | `download()` — download an online map style for offline use |
|
|
79
|
+
| `styled-map-package-api/style-downloader` | `StyleDownloader` — downloads styles, sprites, and glyphs |
|
|
80
|
+
| `styled-map-package-api/tile-downloader` | `downloadTiles()` — downloads tile data |
|
|
81
|
+
| `styled-map-package-api/from-mbtiles` | `fromMBTiles()` — convert MBTiles to SMP stream |
|
|
82
|
+
| `styled-map-package-api/utils/mapbox` | Mapbox URL detection and API utilities |
|
|
83
|
+
|
|
84
|
+
### Browser support
|
|
85
|
+
|
|
86
|
+
All stream APIs use WHATWG `ReadableStream`, making the library compatible with both Node.js and browser environments. The `Reader` class accepts either a file path (Node.js) or a `ZipReader` instance (browser).
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT
|
package/dist/download.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlyphDownloadStats } from './style-downloader.cjs';
|
|
2
2
|
import { TileDownloadStats } from './tile-downloader.cjs';
|
|
3
|
-
import { D as DownloadStream } from './types-
|
|
3
|
+
import { D as DownloadStream } from './types-DPei6PMF.cjs';
|
|
4
4
|
import { BBox } from './utils/geo.cjs';
|
|
5
5
|
import 'ky';
|
|
6
6
|
import '@maplibre/maplibre-gl-style-spec';
|
|
@@ -9,7 +9,6 @@ import './utils/streams.cjs';
|
|
|
9
9
|
import 'stream/web';
|
|
10
10
|
import 'geojson';
|
|
11
11
|
import 'type-fest';
|
|
12
|
-
import 'events';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* @typedef {object} DownloadProgress
|
package/dist/download.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlyphDownloadStats } from './style-downloader.js';
|
|
2
2
|
import { TileDownloadStats } from './tile-downloader.js';
|
|
3
|
-
import { D as DownloadStream } from './types-
|
|
3
|
+
import { D as DownloadStream } from './types-DPei6PMF.js';
|
|
4
4
|
import { BBox } from './utils/geo.js';
|
|
5
5
|
import 'ky';
|
|
6
6
|
import '@maplibre/maplibre-gl-style-spec';
|
|
@@ -9,7 +9,6 @@ import './utils/streams.js';
|
|
|
9
9
|
import 'stream/web';
|
|
10
10
|
import 'geojson';
|
|
11
11
|
import 'type-fest';
|
|
12
|
-
import 'events';
|
|
13
12
|
|
|
14
13
|
/**
|
|
15
14
|
* @typedef {object} DownloadProgress
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SMPSource$1, a as SMPStyle$1 } from './types-
|
|
2
|
-
export { W as Writer } from './types-
|
|
1
|
+
import { S as SMPSource$1, a as SMPStyle$1 } from './types-DPei6PMF.cjs';
|
|
2
|
+
export { W as Writer } from './types-DPei6PMF.cjs';
|
|
3
3
|
export { Reader } from './reader.cjs';
|
|
4
4
|
export { createServer } from './server.cjs';
|
|
5
5
|
export { StyleDownloader } from './style-downloader.cjs';
|
|
@@ -9,7 +9,6 @@ export { fromMBTiles } from './from-mbtiles.cjs';
|
|
|
9
9
|
import '@maplibre/maplibre-gl-style-spec';
|
|
10
10
|
import 'geojson';
|
|
11
11
|
import 'type-fest';
|
|
12
|
-
import 'events';
|
|
13
12
|
import '@gmaclennan/zip-reader';
|
|
14
13
|
import 'itty-router';
|
|
15
14
|
import 'itty-router/IttyRouter';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { S as SMPSource$1, a as SMPStyle$1 } from './types-
|
|
2
|
-
export { W as Writer } from './types-
|
|
1
|
+
import { S as SMPSource$1, a as SMPStyle$1 } from './types-DPei6PMF.js';
|
|
2
|
+
export { W as Writer } from './types-DPei6PMF.js';
|
|
3
3
|
export { Reader } from './reader.js';
|
|
4
4
|
export { createServer } from './server.js';
|
|
5
5
|
export { StyleDownloader } from './style-downloader.js';
|
|
@@ -9,7 +9,6 @@ export { fromMBTiles } from './from-mbtiles.js';
|
|
|
9
9
|
import '@maplibre/maplibre-gl-style-spec';
|
|
10
10
|
import 'geojson';
|
|
11
11
|
import 'type-fest';
|
|
12
|
-
import 'events';
|
|
13
12
|
import '@gmaclennan/zip-reader';
|
|
14
13
|
import 'itty-router';
|
|
15
14
|
import 'itty-router/IttyRouter';
|
package/dist/reader.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as SMPStyle } from './types-
|
|
1
|
+
import { a as SMPStyle } from './types-DPei6PMF.cjs';
|
|
2
2
|
import * as _gmaclennan_zip_reader from '@gmaclennan/zip-reader';
|
|
3
3
|
import '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
import 'geojson';
|
|
5
5
|
import 'type-fest';
|
|
6
|
-
import 'events';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* @typedef {object} Resource
|
package/dist/reader.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { a as SMPStyle } from './types-
|
|
1
|
+
import { a as SMPStyle } from './types-DPei6PMF.js';
|
|
2
2
|
import * as _gmaclennan_zip_reader from '@gmaclennan/zip-reader';
|
|
3
3
|
import '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
import 'geojson';
|
|
5
5
|
import 'type-fest';
|
|
6
|
-
import 'events';
|
|
7
6
|
|
|
8
7
|
/**
|
|
9
8
|
* @typedef {object} Resource
|
package/dist/server.d.cts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { RequestLike } from 'itty-router';
|
|
2
2
|
import { Reader } from './reader.cjs';
|
|
3
3
|
import { IttyRouter } from 'itty-router/IttyRouter';
|
|
4
|
-
import './types-
|
|
4
|
+
import './types-DPei6PMF.cjs';
|
|
5
5
|
import '@maplibre/maplibre-gl-style-spec';
|
|
6
6
|
import 'geojson';
|
|
7
7
|
import 'type-fest';
|
|
8
|
-
import 'events';
|
|
9
8
|
import '@gmaclennan/zip-reader';
|
|
10
9
|
|
|
11
10
|
/**
|
package/dist/server.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { RequestLike } from 'itty-router';
|
|
2
2
|
import { Reader } from './reader.js';
|
|
3
3
|
import { IttyRouter } from 'itty-router/IttyRouter';
|
|
4
|
-
import './types-
|
|
4
|
+
import './types-DPei6PMF.js';
|
|
5
5
|
import '@maplibre/maplibre-gl-style-spec';
|
|
6
6
|
import 'geojson';
|
|
7
7
|
import 'type-fest';
|
|
8
|
-
import 'events';
|
|
9
8
|
import '@gmaclennan/zip-reader';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as ky from 'ky';
|
|
2
2
|
import { BBox } from './utils/geo.cjs';
|
|
3
|
-
import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-
|
|
3
|
+
import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-DPei6PMF.cjs';
|
|
4
4
|
import { TileDownloadStats } from './tile-downloader.cjs';
|
|
5
5
|
import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
6
6
|
import 'geojson';
|
|
7
7
|
import 'type-fest';
|
|
8
|
-
import 'events';
|
|
9
8
|
import './utils/fetch.cjs';
|
|
10
9
|
import './utils/streams.cjs';
|
|
11
10
|
import 'stream/web';
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import * as ky from 'ky';
|
|
2
2
|
import { BBox } from './utils/geo.js';
|
|
3
|
-
import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-
|
|
3
|
+
import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-DPei6PMF.js';
|
|
4
4
|
import { TileDownloadStats } from './tile-downloader.js';
|
|
5
5
|
import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
6
6
|
import 'geojson';
|
|
7
7
|
import 'type-fest';
|
|
8
|
-
import 'events';
|
|
9
8
|
import './utils/fetch.js';
|
|
10
9
|
import './utils/streams.js';
|
|
11
10
|
import 'stream/web';
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { T as TileInfo$1 } from './types-
|
|
1
|
+
import { T as TileInfo$1 } from './types-DPei6PMF.cjs';
|
|
2
2
|
import { BBox } from './utils/geo.cjs';
|
|
3
3
|
import { FetchQueue } from './utils/fetch.cjs';
|
|
4
4
|
import '@maplibre/maplibre-gl-style-spec';
|
|
5
5
|
import 'geojson';
|
|
6
6
|
import 'type-fest';
|
|
7
|
-
import 'events';
|
|
8
7
|
import './utils/streams.cjs';
|
|
9
8
|
import 'stream/web';
|
|
10
9
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { T as TileInfo$1 } from './types-
|
|
1
|
+
import { T as TileInfo$1 } from './types-DPei6PMF.js';
|
|
2
2
|
import { BBox } from './utils/geo.js';
|
|
3
3
|
import { FetchQueue } from './utils/fetch.js';
|
|
4
4
|
import '@maplibre/maplibre-gl-style-spec';
|
|
5
5
|
import 'geojson';
|
|
6
6
|
import 'type-fest';
|
|
7
|
-
import 'events';
|
|
8
7
|
import './utils/streams.js';
|
|
9
8
|
import 'stream/web';
|
|
10
9
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StyleSpecification, SourceSpecification, GeoJSONSourceSpecification, VectorSourceSpecification, RasterSourceSpecification, RasterDEMSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
2
|
import { GeoJSON, BBox } from 'geojson';
|
|
3
3
|
import { SetRequired } from 'type-fest';
|
|
4
|
-
import { EventEmitter } from 'events';
|
|
5
4
|
|
|
6
5
|
/** @typedef {string | Uint8Array | ReadableStream } Source */
|
|
7
6
|
/** @typedef {`${number}-${number}`} GlyphRange */
|
|
@@ -34,7 +33,7 @@ declare const SUPPORTED_SOURCE_TYPES: readonly ["raster", "vector", "geojson"];
|
|
|
34
33
|
* `witer.finish()` and then wait for your writable stream to `finish` before
|
|
35
34
|
* using the output.
|
|
36
35
|
*/
|
|
37
|
-
declare class Writer
|
|
36
|
+
declare class Writer {
|
|
38
37
|
static SUPPORTED_SOURCE_TYPES: readonly ["raster", "vector", "geojson"];
|
|
39
38
|
/**
|
|
40
39
|
* @param {any} style A v7 or v8 MapLibre style. v7 styles will be migrated to
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { StyleSpecification, SourceSpecification, GeoJSONSourceSpecification, VectorSourceSpecification, RasterSourceSpecification, RasterDEMSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
2
|
import { GeoJSON, BBox } from 'geojson';
|
|
3
3
|
import { SetRequired } from 'type-fest';
|
|
4
|
-
import { EventEmitter } from 'events';
|
|
5
4
|
|
|
6
5
|
/** @typedef {string | Uint8Array | ReadableStream } Source */
|
|
7
6
|
/** @typedef {`${number}-${number}`} GlyphRange */
|
|
@@ -34,7 +33,7 @@ declare const SUPPORTED_SOURCE_TYPES: readonly ["raster", "vector", "geojson"];
|
|
|
34
33
|
* `witer.finish()` and then wait for your writable stream to `finish` before
|
|
35
34
|
* using the output.
|
|
36
35
|
*/
|
|
37
|
-
declare class Writer
|
|
36
|
+
declare class Writer {
|
|
38
37
|
static SUPPORTED_SOURCE_TYPES: readonly ["raster", "vector", "geojson"];
|
|
39
38
|
/**
|
|
40
39
|
* @param {any} style A v7 or v8 MapLibre style. v7 styles will be migrated to
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { c as TileFormat } from '../types-
|
|
1
|
+
import { c as TileFormat } from '../types-DPei6PMF.cjs';
|
|
2
2
|
import '@maplibre/maplibre-gl-style-spec';
|
|
3
3
|
import 'geojson';
|
|
4
4
|
import 'type-fest';
|
|
5
|
-
import 'events';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* For a given buffer, determine the tile format based on the magic bytes.
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { c as TileFormat } from '../types-
|
|
1
|
+
import { c as TileFormat } from '../types-DPei6PMF.js';
|
|
2
2
|
import '@maplibre/maplibre-gl-style-spec';
|
|
3
3
|
import 'geojson';
|
|
4
4
|
import 'type-fest';
|
|
5
|
-
import 'events';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* For a given buffer, determine the tile format based on the magic bytes.
|
package/dist/utils/style.d.cts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BBox } from './geo.cjs';
|
|
2
|
-
import { I as InlinedSource } from '../types-
|
|
2
|
+
import { I as InlinedSource } from '../types-DPei6PMF.cjs';
|
|
3
3
|
import * as _maplibre_maplibre_gl_style_spec from '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
import { StyleSpecification, ValidationError } from '@maplibre/maplibre-gl-style-spec';
|
|
5
5
|
import 'geojson';
|
|
6
6
|
import 'type-fest';
|
|
7
|
-
import 'events';
|
|
8
7
|
|
|
9
8
|
/** @import {StyleSpecification, ExpressionSpecification, ValidationError} from '@maplibre/maplibre-gl-style-spec' */
|
|
10
9
|
/**
|
package/dist/utils/style.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { BBox } from './geo.js';
|
|
2
|
-
import { I as InlinedSource } from '../types-
|
|
2
|
+
import { I as InlinedSource } from '../types-DPei6PMF.js';
|
|
3
3
|
import * as _maplibre_maplibre_gl_style_spec from '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
import { StyleSpecification, ValidationError } from '@maplibre/maplibre-gl-style-spec';
|
|
5
5
|
import 'geojson';
|
|
6
6
|
import 'type-fest';
|
|
7
|
-
import 'events';
|
|
8
7
|
|
|
9
8
|
/** @import {StyleSpecification, ExpressionSpecification, ValidationError} from '@maplibre/maplibre-gl-style-spec' */
|
|
10
9
|
/**
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as type_fest from 'type-fest';
|
|
2
|
-
import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-
|
|
2
|
+
import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-DPei6PMF.cjs';
|
|
3
3
|
import '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
import 'geojson';
|
|
5
|
-
import 'events';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @param {string} path
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as type_fest from 'type-fest';
|
|
2
|
-
import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-
|
|
2
|
+
import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-DPei6PMF.js';
|
|
3
3
|
import '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
import 'geojson';
|
|
5
|
-
import 'events';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* @param {string} path
|
package/dist/writer.cjs
CHANGED
|
@@ -24,7 +24,6 @@ __export(writer_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(writer_exports);
|
|
25
25
|
var import_maplibre_gl_style_spec = require("@maplibre/maplibre-gl-style-spec");
|
|
26
26
|
var import_bbox = require("@turf/bbox");
|
|
27
|
-
var import_events = require("events");
|
|
28
27
|
var import_filter_obj = require("filter-obj");
|
|
29
28
|
var import_zip_writer = require("zip-writer");
|
|
30
29
|
var import_file_formats = require('./utils/file-formats.cjs');
|
|
@@ -41,7 +40,7 @@ const SUPPORTED_SOURCE_TYPES = (
|
|
|
41
40
|
"geojson"
|
|
42
41
|
]
|
|
43
42
|
);
|
|
44
|
-
class Writer
|
|
43
|
+
class Writer {
|
|
45
44
|
#zipWriter = new import_zip_writer.ZipWriter();
|
|
46
45
|
/** @type {Set<string>} */
|
|
47
46
|
#addedFiles = /* @__PURE__ */ new Set();
|
|
@@ -64,7 +63,6 @@ class Writer extends import_events.EventEmitter {
|
|
|
64
63
|
* this is typed as `any` and validated internally)
|
|
65
64
|
*/
|
|
66
65
|
constructor(style) {
|
|
67
|
-
super();
|
|
68
66
|
if (!style || !("version" in style)) {
|
|
69
67
|
throw new Error("Invalid style");
|
|
70
68
|
}
|
package/dist/writer.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { G as GlyphInfo, d as GlyphRange, e as SUPPORTED_SOURCE_TYPES, f as Source, g as SourceInfo, c as TileFormat, T as TileInfo, W as Writer } from './types-
|
|
2
|
-
import 'events';
|
|
1
|
+
export { G as GlyphInfo, d as GlyphRange, e as SUPPORTED_SOURCE_TYPES, f as Source, g as SourceInfo, c as TileFormat, T as TileInfo, W as Writer } from './types-DPei6PMF.cjs';
|
|
3
2
|
import '@maplibre/maplibre-gl-style-spec';
|
|
4
3
|
import 'geojson';
|
|
5
4
|
import 'type-fest';
|
package/dist/writer.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { G as GlyphInfo, d as GlyphRange, e as SUPPORTED_SOURCE_TYPES, f as Source, g as SourceInfo, c as TileFormat, T as TileInfo, W as Writer } from './types-
|
|
2
|
-
import 'events';
|
|
1
|
+
export { G as GlyphInfo, d as GlyphRange, e as SUPPORTED_SOURCE_TYPES, f as Source, g as SourceInfo, c as TileFormat, T as TileInfo, W as Writer } from './types-DPei6PMF.js';
|
|
3
2
|
import '@maplibre/maplibre-gl-style-spec';
|
|
4
3
|
import 'geojson';
|
|
5
4
|
import 'type-fest';
|
package/dist/writer.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { validateStyleMin, migrate } from "@maplibre/maplibre-gl-style-spec";
|
|
2
2
|
import { bbox } from "@turf/bbox";
|
|
3
|
-
import { EventEmitter } from "events";
|
|
4
3
|
import { excludeKeys } from "filter-obj";
|
|
5
4
|
import { ZipWriter } from "zip-writer";
|
|
6
5
|
import { getTileFormatFromStream } from "./utils/file-formats.js";
|
|
@@ -29,7 +28,7 @@ const SUPPORTED_SOURCE_TYPES = (
|
|
|
29
28
|
"geojson"
|
|
30
29
|
]
|
|
31
30
|
);
|
|
32
|
-
class Writer
|
|
31
|
+
class Writer {
|
|
33
32
|
#zipWriter = new ZipWriter();
|
|
34
33
|
/** @type {Set<string>} */
|
|
35
34
|
#addedFiles = /* @__PURE__ */ new Set();
|
|
@@ -52,7 +51,6 @@ class Writer extends EventEmitter {
|
|
|
52
51
|
* this is typed as `any` and validated internally)
|
|
53
52
|
*/
|
|
54
53
|
constructor(style) {
|
|
55
|
-
super();
|
|
56
54
|
if (!style || !("version" in style)) {
|
|
57
55
|
throw new Error("Invalid style");
|
|
58
56
|
}
|
package/package.json
CHANGED