styled-map-package-api 5.0.0-pre.2 → 5.0.0-pre.3

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,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-qfyJk4ot.cjs';
3
+ import { D as DownloadStream } from './types-Bhn0-Ldk.cjs';
4
4
  import { BBox } from './utils/geo.cjs';
5
5
  import 'ky';
6
6
  import '@maplibre/maplibre-gl-style-spec';
@@ -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-qfyJk4ot.js';
3
+ import { D as DownloadStream } from './types-Bhn0-Ldk.js';
4
4
  import { BBox } from './utils/geo.js';
5
5
  import 'ky';
6
6
  import '@maplibre/maplibre-gl-style-spec';
@@ -22,6 +22,7 @@ __export(from_mbtiles_exports, {
22
22
  });
23
23
  module.exports = __toCommonJS(from_mbtiles_exports);
24
24
  var import_mbtiles_reader = require("mbtiles-reader");
25
+ var import_misc = require('./utils/misc.cjs');
25
26
  var import_streams = require('./utils/streams.cjs');
26
27
  var import_writer = require('./writer.cjs');
27
28
  const SOURCE_ID = "mbtiles-source";
@@ -35,13 +36,26 @@ function fromMBTiles(source) {
35
36
  if (reader.metadata.format === "pbf") {
36
37
  throw new Error("Vector MBTiles are not yet supported");
37
38
  }
39
+ const {
40
+ name,
41
+ minzoom,
42
+ maxzoom,
43
+ scheme,
44
+ attribution,
45
+ description,
46
+ version: tilesetVersion
47
+ } = reader.metadata;
38
48
  const style = {
39
49
  version: 8,
40
- name: reader.metadata.name,
50
+ name,
41
51
  sources: {
42
52
  [SOURCE_ID]: {
43
- ...reader.metadata,
44
- type: "raster"
53
+ type: "raster",
54
+ tileSize: 256,
55
+ minzoom,
56
+ maxzoom,
57
+ scheme,
58
+ attribution
45
59
  }
46
60
  },
47
61
  layers: [
@@ -62,6 +76,12 @@ function fromMBTiles(source) {
62
76
  }
63
77
  ]
64
78
  };
79
+ if (description || tilesetVersion) {
80
+ style.metadata = {
81
+ "mbtiles:description": description,
82
+ "mbtiles:version": tilesetVersion
83
+ };
84
+ }
65
85
  const writer = new import_writer.Writer(style);
66
86
  outputReader = writer.outputStream.getReader();
67
87
  conversionDone = (async () => {
@@ -92,8 +112,7 @@ function fromMBTiles(source) {
92
112
  pipeAbort.abort(reason);
93
113
  await conversionDone;
94
114
  await /** @type {ReadableStreamDefaultReader<Uint8Array>} */
95
- outputReader.cancel(reason).catch(() => {
96
- });
115
+ outputReader.cancel(reason).catch(import_misc.noop);
97
116
  }
98
117
  });
99
118
  }
@@ -1,4 +1,5 @@
1
1
  import { MBTiles } from "mbtiles-reader";
2
+ import { noop } from "./utils/misc.js";
2
3
  import { readableFromAsync } from "./utils/streams.js";
3
4
  import { Writer } from "./writer.js";
4
5
  const SOURCE_ID = "mbtiles-source";
@@ -12,13 +13,26 @@ function fromMBTiles(source) {
12
13
  if (reader.metadata.format === "pbf") {
13
14
  throw new Error("Vector MBTiles are not yet supported");
14
15
  }
16
+ const {
17
+ name,
18
+ minzoom,
19
+ maxzoom,
20
+ scheme,
21
+ attribution,
22
+ description,
23
+ version: tilesetVersion
24
+ } = reader.metadata;
15
25
  const style = {
16
26
  version: 8,
17
- name: reader.metadata.name,
27
+ name,
18
28
  sources: {
19
29
  [SOURCE_ID]: {
20
- ...reader.metadata,
21
- type: "raster"
30
+ type: "raster",
31
+ tileSize: 256,
32
+ minzoom,
33
+ maxzoom,
34
+ scheme,
35
+ attribution
22
36
  }
23
37
  },
24
38
  layers: [
@@ -39,6 +53,12 @@ function fromMBTiles(source) {
39
53
  }
40
54
  ]
41
55
  };
56
+ if (description || tilesetVersion) {
57
+ style.metadata = {
58
+ "mbtiles:description": description,
59
+ "mbtiles:version": tilesetVersion
60
+ };
61
+ }
42
62
  const writer = new Writer(style);
43
63
  outputReader = writer.outputStream.getReader();
44
64
  conversionDone = (async () => {
@@ -69,8 +89,7 @@ function fromMBTiles(source) {
69
89
  pipeAbort.abort(reason);
70
90
  await conversionDone;
71
91
  await /** @type {ReadableStreamDefaultReader<Uint8Array>} */
72
- outputReader.cancel(reason).catch(() => {
73
- });
92
+ outputReader.cancel(reason).catch(noop);
74
93
  }
75
94
  });
76
95
  }
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SMPSource$1, a as SMPStyle$1 } from './types-qfyJk4ot.cjs';
2
- export { W as Writer } from './types-qfyJk4ot.cjs';
1
+ import { S as SMPSource$1, a as SMPStyle$1 } from './types-Bhn0-Ldk.cjs';
2
+ export { W as Writer } from './types-Bhn0-Ldk.cjs';
3
3
  export { Reader } from './reader.cjs';
4
4
  export { createServer } from './server.cjs';
5
5
  export { StyleDownloader } from './style-downloader.cjs';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as SMPSource$1, a as SMPStyle$1 } from './types-qfyJk4ot.js';
2
- export { W as Writer } from './types-qfyJk4ot.js';
1
+ import { S as SMPSource$1, a as SMPStyle$1 } from './types-Bhn0-Ldk.js';
2
+ export { W as Writer } from './types-Bhn0-Ldk.js';
3
3
  export { Reader } from './reader.js';
4
4
  export { createServer } from './server.js';
5
5
  export { StyleDownloader } from './style-downloader.js';
package/dist/reader.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SMPStyle } from './types-qfyJk4ot.cjs';
1
+ import { a as SMPStyle } from './types-Bhn0-Ldk.cjs';
2
2
  import * as _gmaclennan_zip_reader from '@gmaclennan/zip-reader';
3
3
  import '@maplibre/maplibre-gl-style-spec';
4
4
  import 'geojson';
package/dist/reader.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as SMPStyle } from './types-qfyJk4ot.js';
1
+ import { a as SMPStyle } from './types-Bhn0-Ldk.js';
2
2
  import * as _gmaclennan_zip_reader from '@gmaclennan/zip-reader';
3
3
  import '@maplibre/maplibre-gl-style-spec';
4
4
  import 'geojson';
package/dist/server.d.cts CHANGED
@@ -1,7 +1,7 @@
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-qfyJk4ot.cjs';
4
+ import './types-Bhn0-Ldk.cjs';
5
5
  import '@maplibre/maplibre-gl-style-spec';
6
6
  import 'geojson';
7
7
  import 'type-fest';
package/dist/server.d.ts CHANGED
@@ -1,7 +1,7 @@
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-qfyJk4ot.js';
4
+ import './types-Bhn0-Ldk.js';
5
5
  import '@maplibre/maplibre-gl-style-spec';
6
6
  import 'geojson';
7
7
  import 'type-fest';
@@ -1,6 +1,6 @@
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-qfyJk4ot.cjs';
3
+ import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-Bhn0-Ldk.cjs';
4
4
  import { TileDownloadStats } from './tile-downloader.cjs';
5
5
  import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
6
6
  import 'geojson';
@@ -1,6 +1,6 @@
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-qfyJk4ot.js';
3
+ import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-Bhn0-Ldk.js';
4
4
  import { TileDownloadStats } from './tile-downloader.js';
5
5
  import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
6
6
  import 'geojson';
@@ -1,4 +1,4 @@
1
- import { T as TileInfo$1 } from './types-qfyJk4ot.cjs';
1
+ import { T as TileInfo$1 } from './types-Bhn0-Ldk.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';
@@ -1,4 +1,4 @@
1
- import { T as TileInfo$1 } from './types-qfyJk4ot.js';
1
+ import { T as TileInfo$1 } from './types-Bhn0-Ldk.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';
@@ -189,6 +189,7 @@ type TransformSMPStyle<T extends StyleSpecification> = Omit<T, 'sources'> & {
189
189
  'smp:sourceFolders': {
190
190
  [_: string]: string;
191
191
  };
192
+ [key: string]: unknown;
192
193
  };
193
194
  sources: {
194
195
  [_: string]: SMPSource;
@@ -189,6 +189,7 @@ type TransformSMPStyle<T extends StyleSpecification> = Omit<T, 'sources'> & {
189
189
  'smp:sourceFolders': {
190
190
  [_: string]: string;
191
191
  };
192
+ [key: string]: unknown;
192
193
  };
193
194
  sources: {
194
195
  [_: string]: SMPSource;
@@ -1,4 +1,4 @@
1
- import { c as TileFormat } from '../types-qfyJk4ot.cjs';
1
+ import { c as TileFormat } from '../types-Bhn0-Ldk.cjs';
2
2
  import '@maplibre/maplibre-gl-style-spec';
3
3
  import 'geojson';
4
4
  import 'type-fest';
@@ -1,4 +1,4 @@
1
- import { c as TileFormat } from '../types-qfyJk4ot.js';
1
+ import { c as TileFormat } from '../types-Bhn0-Ldk.js';
2
2
  import '@maplibre/maplibre-gl-style-spec';
3
3
  import 'geojson';
4
4
  import 'type-fest';
@@ -1,5 +1,5 @@
1
1
  import { BBox } from './geo.cjs';
2
- import { I as InlinedSource } from '../types-qfyJk4ot.cjs';
2
+ import { I as InlinedSource } from '../types-Bhn0-Ldk.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';
@@ -1,5 +1,5 @@
1
1
  import { BBox } from './geo.js';
2
- import { I as InlinedSource } from '../types-qfyJk4ot.js';
2
+ import { I as InlinedSource } from '../types-Bhn0-Ldk.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';
@@ -1,5 +1,5 @@
1
1
  import * as type_fest from 'type-fest';
2
- import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-qfyJk4ot.cjs';
2
+ import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-Bhn0-Ldk.cjs';
3
3
  import '@maplibre/maplibre-gl-style-spec';
4
4
  import 'geojson';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import * as type_fest from 'type-fest';
2
- import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-qfyJk4ot.js';
2
+ import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-Bhn0-Ldk.js';
3
3
  import '@maplibre/maplibre-gl-style-spec';
4
4
  import 'geojson';
5
5
 
package/dist/writer.d.cts CHANGED
@@ -1,4 +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, h as WriterOptions } from './types-qfyJk4ot.cjs';
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, h as WriterOptions } from './types-Bhn0-Ldk.cjs';
2
2
  import '@maplibre/maplibre-gl-style-spec';
3
3
  import 'geojson';
4
4
  import 'type-fest';
package/dist/writer.d.ts CHANGED
@@ -1,4 +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, h as WriterOptions } from './types-qfyJk4ot.js';
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, h as WriterOptions } from './types-Bhn0-Ldk.js';
2
2
  import '@maplibre/maplibre-gl-style-spec';
3
3
  import 'geojson';
4
4
  import 'type-fest';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "styled-map-package-api",
3
- "version": "5.0.0-pre.2",
3
+ "version": "5.0.0-pre.3",
4
4
  "description": "JavaScript API for reading, writing, and serving Styled Map Package (.smp) files",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",