styled-map-package 4.1.0 → 5.0.0-pre.0
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/bin/smp-download.js +9 -5
- package/bin/smp-mbtiles.js +5 -7
- package/bin/smp-view.js +2 -3
- package/lib/reporters.js +92 -0
- package/package.json +8 -185
- package/LICENSE.md +0 -7
- package/README.md +0 -28
- package/dist/download.cjs +0 -101
- package/dist/download.d.cts +0 -65
- package/dist/download.d.ts +0 -65
- package/dist/download.js +0 -77
- package/dist/from-mbtiles.cjs +0 -91
- package/dist/from-mbtiles.d.cts +0 -17
- package/dist/from-mbtiles.d.ts +0 -17
- package/dist/from-mbtiles.js +0 -57
- package/dist/index.cjs +0 -49
- package/dist/index.d.cts +0 -27
- package/dist/index.d.ts +0 -27
- package/dist/index.js +0 -18
- package/dist/reader-watch.cjs +0 -135
- package/dist/reader-watch.d.cts +0 -24
- package/dist/reader-watch.d.ts +0 -24
- package/dist/reader-watch.js +0 -101
- package/dist/reader.cjs +0 -168
- package/dist/reader.d.cts +0 -62
- package/dist/reader.d.ts +0 -62
- package/dist/reader.js +0 -139
- package/dist/reporters.cjs +0 -122
- package/dist/reporters.d.cts +0 -10
- package/dist/reporters.d.ts +0 -10
- package/dist/reporters.js +0 -88
- package/dist/server.cjs +0 -78
- package/dist/server.d.cts +0 -48
- package/dist/server.d.ts +0 -48
- package/dist/server.js +0 -54
- package/dist/style-downloader.cjs +0 -312
- package/dist/style-downloader.d.cts +0 -120
- package/dist/style-downloader.d.ts +0 -120
- package/dist/style-downloader.js +0 -288
- package/dist/tile-downloader.cjs +0 -158
- package/dist/tile-downloader.d.cts +0 -84
- package/dist/tile-downloader.d.ts +0 -84
- package/dist/tile-downloader.js +0 -126
- package/dist/types-yLQy3AKR.d.cts +0 -192
- package/dist/types-yLQy3AKR.d.ts +0 -192
- package/dist/utils/errors.cjs +0 -41
- package/dist/utils/errors.d.cts +0 -18
- package/dist/utils/errors.d.ts +0 -18
- package/dist/utils/errors.js +0 -16
- package/dist/utils/fetch.cjs +0 -96
- package/dist/utils/fetch.d.cts +0 -51
- package/dist/utils/fetch.d.ts +0 -51
- package/dist/utils/fetch.js +0 -62
- package/dist/utils/file-formats.cjs +0 -98
- package/dist/utils/file-formats.d.cts +0 -35
- package/dist/utils/file-formats.d.ts +0 -35
- package/dist/utils/file-formats.js +0 -62
- package/dist/utils/geo.cjs +0 -84
- package/dist/utils/geo.d.cts +0 -46
- package/dist/utils/geo.d.ts +0 -46
- package/dist/utils/geo.js +0 -56
- package/dist/utils/mapbox.cjs +0 -121
- package/dist/utils/mapbox.d.cts +0 -43
- package/dist/utils/mapbox.d.ts +0 -43
- package/dist/utils/mapbox.js +0 -91
- package/dist/utils/misc.cjs +0 -39
- package/dist/utils/misc.d.cts +0 -22
- package/dist/utils/misc.d.ts +0 -22
- package/dist/utils/misc.js +0 -13
- package/dist/utils/streams.cjs +0 -130
- package/dist/utils/streams.d.cts +0 -73
- package/dist/utils/streams.d.ts +0 -73
- package/dist/utils/streams.js +0 -103
- package/dist/utils/style.cjs +0 -126
- package/dist/utils/style.d.cts +0 -69
- package/dist/utils/style.d.ts +0 -69
- package/dist/utils/style.js +0 -98
- package/dist/utils/templates.cjs +0 -118
- package/dist/utils/templates.d.cts +0 -80
- package/dist/utils/templates.d.ts +0 -80
- package/dist/utils/templates.js +0 -81
- package/dist/writer.cjs +0 -449
- package/dist/writer.d.cts +0 -7
- package/dist/writer.d.ts +0 -7
- package/dist/writer.js +0 -424
- package/node_modules/@node-rs/crc32/LICENSE +0 -21
- package/node_modules/@node-rs/crc32/README.md +0 -61
- package/node_modules/@node-rs/crc32/browser.js +0 -1
- package/node_modules/@node-rs/crc32/index.d.ts +0 -5
- package/node_modules/@node-rs/crc32/index.js +0 -368
- package/node_modules/@node-rs/crc32/package.json +0 -97
- package/node_modules/@node-rs/crc32-linux-x64-gnu/README.md +0 -3
- package/node_modules/@node-rs/crc32-linux-x64-gnu/crc32.linux-x64-gnu.node +0 -0
- package/node_modules/@node-rs/crc32-linux-x64-gnu/package.json +0 -43
- package/node_modules/@node-rs/crc32-linux-x64-musl/README.md +0 -3
- package/node_modules/@node-rs/crc32-linux-x64-musl/crc32.linux-x64-musl.node +0 -0
- package/node_modules/@node-rs/crc32-linux-x64-musl/package.json +0 -43
- package/node_modules/define-data-property/.eslintrc +0 -24
- package/node_modules/define-data-property/.github/FUNDING.yml +0 -12
- package/node_modules/define-data-property/.nycrc +0 -13
- package/node_modules/define-data-property/CHANGELOG.md +0 -70
- package/node_modules/define-data-property/LICENSE +0 -21
- package/node_modules/define-data-property/README.md +0 -67
- package/node_modules/define-data-property/index.d.ts +0 -12
- package/node_modules/define-data-property/index.js +0 -56
- package/node_modules/define-data-property/package.json +0 -106
- package/node_modules/define-data-property/test/index.js +0 -392
- package/node_modules/define-data-property/tsconfig.json +0 -59
- package/node_modules/define-properties/.editorconfig +0 -13
- package/node_modules/define-properties/.eslintrc +0 -19
- package/node_modules/define-properties/.github/FUNDING.yml +0 -12
- package/node_modules/define-properties/.nycrc +0 -9
- package/node_modules/define-properties/CHANGELOG.md +0 -91
- package/node_modules/define-properties/LICENSE +0 -21
- package/node_modules/define-properties/README.md +0 -84
- package/node_modules/define-properties/index.js +0 -47
- package/node_modules/define-properties/package.json +0 -88
- package/node_modules/es-define-property/.eslintrc +0 -13
- package/node_modules/es-define-property/.github/FUNDING.yml +0 -12
- package/node_modules/es-define-property/.nycrc +0 -9
- package/node_modules/es-define-property/CHANGELOG.md +0 -29
- package/node_modules/es-define-property/LICENSE +0 -21
- package/node_modules/es-define-property/README.md +0 -49
- package/node_modules/es-define-property/index.d.ts +0 -3
- package/node_modules/es-define-property/index.js +0 -14
- package/node_modules/es-define-property/package.json +0 -81
- package/node_modules/es-define-property/test/index.js +0 -56
- package/node_modules/es-define-property/tsconfig.json +0 -10
- package/node_modules/es-errors/.eslintrc +0 -5
- package/node_modules/es-errors/.github/FUNDING.yml +0 -12
- package/node_modules/es-errors/CHANGELOG.md +0 -40
- package/node_modules/es-errors/LICENSE +0 -21
- package/node_modules/es-errors/README.md +0 -55
- package/node_modules/es-errors/eval.d.ts +0 -3
- package/node_modules/es-errors/eval.js +0 -4
- package/node_modules/es-errors/index.d.ts +0 -3
- package/node_modules/es-errors/index.js +0 -4
- package/node_modules/es-errors/package.json +0 -80
- package/node_modules/es-errors/range.d.ts +0 -3
- package/node_modules/es-errors/range.js +0 -4
- package/node_modules/es-errors/ref.d.ts +0 -3
- package/node_modules/es-errors/ref.js +0 -4
- package/node_modules/es-errors/syntax.d.ts +0 -3
- package/node_modules/es-errors/syntax.js +0 -4
- package/node_modules/es-errors/test/index.js +0 -19
- package/node_modules/es-errors/tsconfig.json +0 -49
- package/node_modules/es-errors/type.d.ts +0 -3
- package/node_modules/es-errors/type.js +0 -4
- package/node_modules/es-errors/uri.d.ts +0 -3
- package/node_modules/es-errors/uri.js +0 -4
- package/node_modules/globalthis/.eslintrc +0 -18
- package/node_modules/globalthis/.nycrc +0 -10
- package/node_modules/globalthis/CHANGELOG.md +0 -109
- package/node_modules/globalthis/LICENSE +0 -21
- package/node_modules/globalthis/README.md +0 -70
- package/node_modules/globalthis/auto.js +0 -3
- package/node_modules/globalthis/implementation.browser.js +0 -11
- package/node_modules/globalthis/implementation.js +0 -3
- package/node_modules/globalthis/index.js +0 -19
- package/node_modules/globalthis/package.json +0 -99
- package/node_modules/globalthis/polyfill.js +0 -10
- package/node_modules/globalthis/shim.js +0 -29
- package/node_modules/globalthis/test/implementation.js +0 -11
- package/node_modules/globalthis/test/index.js +0 -11
- package/node_modules/globalthis/test/native.js +0 -26
- package/node_modules/globalthis/test/shimmed.js +0 -29
- package/node_modules/globalthis/test/tests.js +0 -36
- package/node_modules/gopd/.eslintrc +0 -16
- package/node_modules/gopd/.github/FUNDING.yml +0 -12
- package/node_modules/gopd/CHANGELOG.md +0 -45
- package/node_modules/gopd/LICENSE +0 -21
- package/node_modules/gopd/README.md +0 -40
- package/node_modules/gopd/gOPD.d.ts +0 -1
- package/node_modules/gopd/gOPD.js +0 -4
- package/node_modules/gopd/index.d.ts +0 -5
- package/node_modules/gopd/index.js +0 -15
- package/node_modules/gopd/package.json +0 -77
- package/node_modules/gopd/test/index.js +0 -36
- package/node_modules/gopd/tsconfig.json +0 -9
- package/node_modules/has-property-descriptors/.eslintrc +0 -13
- package/node_modules/has-property-descriptors/.github/FUNDING.yml +0 -12
- package/node_modules/has-property-descriptors/.nycrc +0 -9
- package/node_modules/has-property-descriptors/CHANGELOG.md +0 -35
- package/node_modules/has-property-descriptors/LICENSE +0 -21
- package/node_modules/has-property-descriptors/README.md +0 -43
- package/node_modules/has-property-descriptors/index.js +0 -22
- package/node_modules/has-property-descriptors/package.json +0 -77
- package/node_modules/has-property-descriptors/test/index.js +0 -57
- package/node_modules/is-it-type/License +0 -19
- package/node_modules/is-it-type/README.md +0 -102
- package/node_modules/is-it-type/changelog.md +0 -239
- package/node_modules/is-it-type/dist/cjs/is-it-type.js +0 -173
- package/node_modules/is-it-type/dist/cjs/is-it-type.js.map +0 -1
- package/node_modules/is-it-type/dist/cjs/is-it-type.min.js +0 -2
- package/node_modules/is-it-type/dist/cjs/is-it-type.min.js.map +0 -1
- package/node_modules/is-it-type/dist/esm/is-it-type.js +0 -143
- package/node_modules/is-it-type/dist/esm/is-it-type.js.map +0 -1
- package/node_modules/is-it-type/dist/esm/is-it-type.min.js +0 -2
- package/node_modules/is-it-type/dist/esm/is-it-type.min.js.map +0 -1
- package/node_modules/is-it-type/dist/esm/package.json +0 -3
- package/node_modules/is-it-type/dist/umd/is-it-type.js +0 -450
- package/node_modules/is-it-type/dist/umd/is-it-type.js.map +0 -1
- package/node_modules/is-it-type/dist/umd/is-it-type.min.js +0 -2
- package/node_modules/is-it-type/dist/umd/is-it-type.min.js.map +0 -1
- package/node_modules/is-it-type/es/index.js +0 -8
- package/node_modules/is-it-type/es/package.json +0 -3
- package/node_modules/is-it-type/index.js +0 -10
- package/node_modules/is-it-type/package.json +0 -87
- package/node_modules/is-it-type/src/index.js +0 -169
- package/node_modules/object-keys/.editorconfig +0 -13
- package/node_modules/object-keys/.eslintrc +0 -17
- package/node_modules/object-keys/.travis.yml +0 -277
- package/node_modules/object-keys/CHANGELOG.md +0 -232
- package/node_modules/object-keys/LICENSE +0 -21
- package/node_modules/object-keys/README.md +0 -76
- package/node_modules/object-keys/implementation.js +0 -122
- package/node_modules/object-keys/index.js +0 -32
- package/node_modules/object-keys/isArguments.js +0 -17
- package/node_modules/object-keys/package.json +0 -88
- package/node_modules/object-keys/test/index.js +0 -5
- package/node_modules/simple-invariant/License +0 -19
- package/node_modules/simple-invariant/README.md +0 -64
- package/node_modules/simple-invariant/changelog.md +0 -31
- package/node_modules/simple-invariant/index.js +0 -19
- package/node_modules/simple-invariant/package.json +0 -50
- package/node_modules/yauzl-promise/License +0 -19
- package/node_modules/yauzl-promise/README.md +0 -440
- package/node_modules/yauzl-promise/index.js +0 -10
- package/node_modules/yauzl-promise/lib/entry.js +0 -312
- package/node_modules/yauzl-promise/lib/index.js +0 -160
- package/node_modules/yauzl-promise/lib/reader.js +0 -289
- package/node_modules/yauzl-promise/lib/shared.js +0 -20
- package/node_modules/yauzl-promise/lib/utils.js +0 -105
- package/node_modules/yauzl-promise/lib/zip.js +0 -1224
- package/node_modules/yauzl-promise/package.json +0 -56
package/bin/smp-download.js
CHANGED
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
import { input, number } from '@inquirer/prompts'
|
|
3
3
|
import { Command, InvalidArgumentError } from 'commander'
|
|
4
4
|
import fs from 'fs'
|
|
5
|
-
import {
|
|
5
|
+
import { download } from 'styled-map-package-api/download'
|
|
6
|
+
import {
|
|
7
|
+
isMapboxURL,
|
|
8
|
+
API_URL as MAPBOX_API_URL,
|
|
9
|
+
} from 'styled-map-package-api/utils/mapbox'
|
|
6
10
|
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
import {
|
|
11
|
+
import { Writable } from 'node:stream'
|
|
12
|
+
|
|
13
|
+
import { ttyReporter } from '../lib/reporters.js'
|
|
10
14
|
|
|
11
15
|
const program = new Command()
|
|
12
16
|
|
|
@@ -129,7 +133,7 @@ program
|
|
|
129
133
|
accessToken: token,
|
|
130
134
|
})
|
|
131
135
|
const outputStream = output ? fs.createWriteStream(output) : process.stdout
|
|
132
|
-
await
|
|
136
|
+
await readStream.pipeTo(Writable.toWeb(outputStream))
|
|
133
137
|
})
|
|
134
138
|
|
|
135
139
|
program.parseAsync(process.argv)
|
package/bin/smp-mbtiles.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander'
|
|
3
|
-
import {
|
|
3
|
+
import { fromMBTiles } from 'styled-map-package-api/from-mbtiles'
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import fs from 'node:fs'
|
|
6
|
+
import { Writable } from 'node:stream'
|
|
6
7
|
|
|
7
8
|
const program = new Command()
|
|
8
9
|
|
|
@@ -11,11 +12,8 @@ program
|
|
|
11
12
|
.option('-o, --output <file>', 'output smp file')
|
|
12
13
|
.argument('<mbtiles>', 'MBTiles file to convert')
|
|
13
14
|
.action(async (mbtilesPath, { output }) => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} else {
|
|
17
|
-
await pipeline(fromMBTiles(mbtilesPath), process.stdout)
|
|
18
|
-
}
|
|
15
|
+
const dest = output ? fs.createWriteStream(output) : process.stdout
|
|
16
|
+
await fromMBTiles(mbtilesPath).pipeTo(Writable.toWeb(dest))
|
|
19
17
|
})
|
|
20
18
|
|
|
21
19
|
program.parseAsync(process.argv)
|
package/bin/smp-view.js
CHANGED
|
@@ -5,12 +5,11 @@ import fsPromises from 'fs/promises'
|
|
|
5
5
|
import http from 'http'
|
|
6
6
|
import { AutoRouter } from 'itty-router'
|
|
7
7
|
import openApp from 'open'
|
|
8
|
+
import { Reader } from 'styled-map-package-api/reader'
|
|
9
|
+
import { createServer } from 'styled-map-package-api/server'
|
|
8
10
|
|
|
9
11
|
import path from 'node:path'
|
|
10
12
|
|
|
11
|
-
import { Reader } from '../dist/reader.js'
|
|
12
|
-
import { createServer } from '../dist/server.js'
|
|
13
|
-
|
|
14
13
|
const program = new Command()
|
|
15
14
|
|
|
16
15
|
program
|
package/lib/reporters.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import chalk, { chalkStderr } from 'chalk'
|
|
2
|
+
import logSymbols from 'log-symbols'
|
|
3
|
+
import ora from 'ora'
|
|
4
|
+
import prettyBytes from 'pretty-bytes'
|
|
5
|
+
import prettyMilliseconds from 'pretty-ms'
|
|
6
|
+
import { Writable } from 'readable-stream'
|
|
7
|
+
|
|
8
|
+
chalk.level = chalkStderr.level
|
|
9
|
+
|
|
10
|
+
const TASKS = /** @type {const} */ ([
|
|
11
|
+
'style',
|
|
12
|
+
'sprites',
|
|
13
|
+
'tiles',
|
|
14
|
+
'glyphs',
|
|
15
|
+
'output',
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
const TASK_LABEL = /** @type {const} */ ({
|
|
19
|
+
style: 'Downloading Map Style',
|
|
20
|
+
sprites: 'Downloading Sprites',
|
|
21
|
+
tiles: 'Downloading Tiles',
|
|
22
|
+
glyphs: 'Downloading Glyphs',
|
|
23
|
+
output: 'Writing Styled Map Package',
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
const TASK_SUFFIX =
|
|
27
|
+
/** @type {{ [K in (typeof TASKS)[number]]: (progress: import('styled-map-package-api/download').DownloadProgress[K]) => string }} */ ({
|
|
28
|
+
style: () => '',
|
|
29
|
+
sprites: ({ downloaded }) => `${downloaded}`,
|
|
30
|
+
tiles: ({ total, skipped, totalBytes, downloaded }) => {
|
|
31
|
+
const formattedTotal = total.toLocaleString()
|
|
32
|
+
const formattedCompleted = (downloaded + skipped)
|
|
33
|
+
.toLocaleString()
|
|
34
|
+
.padStart(formattedTotal.length)
|
|
35
|
+
return `${formattedCompleted}/${formattedTotal} (${prettyBytes(totalBytes)})`
|
|
36
|
+
},
|
|
37
|
+
glyphs: ({ total, downloaded, totalBytes }) =>
|
|
38
|
+
`${downloaded}/${total} (${prettyBytes(totalBytes)})`,
|
|
39
|
+
output: ({ totalBytes }) => `${prettyBytes(totalBytes)}`,
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A writable stream to reporting download progress to a TTY terminal. Write
|
|
44
|
+
* progress messages to this stream for a pretty-printed progress task-list in
|
|
45
|
+
* the terminal.
|
|
46
|
+
*/
|
|
47
|
+
export function ttyReporter() {
|
|
48
|
+
/** @type {import('styled-map-package-api/download').DownloadProgress | undefined} */
|
|
49
|
+
let stats
|
|
50
|
+
let current = 0
|
|
51
|
+
/** @type {import('ora').Ora} */
|
|
52
|
+
let spinner
|
|
53
|
+
return new Writable({
|
|
54
|
+
objectMode: true,
|
|
55
|
+
// @ts-ignore - missing type def
|
|
56
|
+
construct(cb) {
|
|
57
|
+
process.stderr.write('\n')
|
|
58
|
+
spinner = ora(TASK_LABEL[TASKS[current]]).start()
|
|
59
|
+
cb()
|
|
60
|
+
},
|
|
61
|
+
/** @param {ArrayLike<{ chunk: import('styled-map-package-api/download').DownloadProgress, encoding: string }>} chunks */
|
|
62
|
+
writev(chunks, cb) {
|
|
63
|
+
stats = chunks[chunks.length - 1].chunk
|
|
64
|
+
while (current < TASKS.length && stats[TASKS[current]].done) {
|
|
65
|
+
spinner.suffixText = chalk.dim(
|
|
66
|
+
TASK_SUFFIX[TASKS[current]](
|
|
67
|
+
// @ts-ignore - too complicated for TS
|
|
68
|
+
stats[TASKS[current]],
|
|
69
|
+
),
|
|
70
|
+
)
|
|
71
|
+
spinner.succeed()
|
|
72
|
+
if (++current < TASKS.length) {
|
|
73
|
+
spinner = ora(TASK_LABEL[TASKS[current]]).start()
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (current < TASKS.length) {
|
|
77
|
+
spinner.suffixText = chalk.dim(
|
|
78
|
+
TASK_SUFFIX[TASKS[current]](
|
|
79
|
+
// @ts-ignore - too complicated for TS
|
|
80
|
+
stats[TASKS[current]],
|
|
81
|
+
),
|
|
82
|
+
)
|
|
83
|
+
} else {
|
|
84
|
+
process.stderr.write(
|
|
85
|
+
`${chalk.green(logSymbols.success)} Completed in ${prettyMilliseconds(stats.elapsedMs)}\n`,
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
cb()
|
|
90
|
+
},
|
|
91
|
+
})
|
|
92
|
+
}
|
package/package.json
CHANGED
|
@@ -1,216 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "styled-map-package",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "5.0.0-pre.0",
|
|
4
|
+
"description": "CLI for creating, viewing, and converting Styled Map Package (.smp) files",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.cjs",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
9
|
-
"exports": {
|
|
10
|
-
".": {
|
|
11
|
-
"import": {
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"default": "./dist/index.js"
|
|
14
|
-
},
|
|
15
|
-
"require": {
|
|
16
|
-
"types": "./dist/index.d.cts",
|
|
17
|
-
"default": "./dist/index.cjs"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
"./reader": {
|
|
21
|
-
"import": {
|
|
22
|
-
"types": "./dist/reader.d.ts",
|
|
23
|
-
"default": "./dist/reader.js"
|
|
24
|
-
},
|
|
25
|
-
"require": {
|
|
26
|
-
"types": "./dist/reader.d.cts",
|
|
27
|
-
"default": "./dist/reader.cjs"
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"./reader-watch": {
|
|
31
|
-
"import": {
|
|
32
|
-
"types": "./dist/reader-watch.d.ts",
|
|
33
|
-
"default": "./dist/reader-watch.js"
|
|
34
|
-
},
|
|
35
|
-
"require": {
|
|
36
|
-
"types": "./dist/reader-watch.d.cts",
|
|
37
|
-
"default": "./dist/reader-watch.cjs"
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"./writer": {
|
|
41
|
-
"import": {
|
|
42
|
-
"types": "./dist/writer.d.ts",
|
|
43
|
-
"default": "./dist/writer.js"
|
|
44
|
-
},
|
|
45
|
-
"require": {
|
|
46
|
-
"types": "./dist/writer.d.cts",
|
|
47
|
-
"default": "./dist/writer.cjs"
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
"./server": {
|
|
51
|
-
"import": {
|
|
52
|
-
"types": "./dist/server.d.ts",
|
|
53
|
-
"default": "./dist/server.js"
|
|
54
|
-
},
|
|
55
|
-
"require": {
|
|
56
|
-
"types": "./dist/server.d.cts",
|
|
57
|
-
"default": "./dist/server.cjs"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"./style-downloader": {
|
|
61
|
-
"import": {
|
|
62
|
-
"types": "./dist/style-downloader.d.ts",
|
|
63
|
-
"default": "./dist/style-downloader.js"
|
|
64
|
-
},
|
|
65
|
-
"require": {
|
|
66
|
-
"types": "./dist/style-downloader.d.cts",
|
|
67
|
-
"default": "./dist/style-downloader.cjs"
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
"./tile-downloader": {
|
|
71
|
-
"import": {
|
|
72
|
-
"types": "./dist/tile-downloader.d.ts",
|
|
73
|
-
"default": "./dist/tile-downloader.js"
|
|
74
|
-
},
|
|
75
|
-
"require": {
|
|
76
|
-
"types": "./dist/tile-downloader.d.cts",
|
|
77
|
-
"default": "./dist/tile-downloader.cjs"
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"./download": {
|
|
81
|
-
"import": {
|
|
82
|
-
"types": "./dist/download.d.ts",
|
|
83
|
-
"default": "./dist/download.js"
|
|
84
|
-
},
|
|
85
|
-
"require": {
|
|
86
|
-
"types": "./dist/download.d.cts",
|
|
87
|
-
"default": "./dist/download.cjs"
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"./from-mbtiles": {
|
|
91
|
-
"import": {
|
|
92
|
-
"types": "./dist/from-mbtiles.d.ts",
|
|
93
|
-
"default": "./dist/from-mbtiles.js"
|
|
94
|
-
},
|
|
95
|
-
"require": {
|
|
96
|
-
"types": "./dist/from-mbtiles.d.cts",
|
|
97
|
-
"default": "./dist/from-mbtiles.cjs"
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"./package.json": "./package.json"
|
|
101
|
-
},
|
|
102
6
|
"bin": {
|
|
103
7
|
"styled-map-package": "bin/smp.js",
|
|
104
8
|
"smp": "bin/smp.js"
|
|
105
9
|
},
|
|
106
10
|
"files": [
|
|
107
11
|
"bin",
|
|
108
|
-
"
|
|
12
|
+
"lib",
|
|
109
13
|
"map-viewer"
|
|
110
14
|
],
|
|
111
15
|
"scripts": {
|
|
112
|
-
"test": "
|
|
113
|
-
"prepare": "husky && patch-package",
|
|
114
|
-
"lint": "eslint .",
|
|
115
|
-
"types": "tsc",
|
|
116
|
-
"build": "tsup",
|
|
117
|
-
"prepack": "npm run build"
|
|
16
|
+
"test": "echo 'No CLI tests yet'"
|
|
118
17
|
},
|
|
119
18
|
"keywords": [],
|
|
120
|
-
"author": "",
|
|
121
19
|
"license": "MIT",
|
|
122
20
|
"dependencies": {
|
|
21
|
+
"styled-map-package-api": "^5.0.0-pre.0",
|
|
123
22
|
"@inquirer/prompts": "^6.0.1",
|
|
124
|
-
"@mapbox/sphericalmercator": "^1.2.0",
|
|
125
|
-
"@maplibre/maplibre-gl-style-spec": "^20.3.1",
|
|
126
|
-
"@placemarkio/check-geojson": "^0.1.12",
|
|
127
|
-
"@turf/bbox": "^7.2.0",
|
|
128
|
-
"@turf/helpers": "^7.2.0",
|
|
129
23
|
"@whatwg-node/server": "^0.10.17",
|
|
130
|
-
"ansi-diff": "^1.2.0",
|
|
131
|
-
"archiver": "^7.0.1",
|
|
132
|
-
"buffer-peek-stream": "^1.1.0",
|
|
133
24
|
"chalk": "^5.4.1",
|
|
134
25
|
"commander": "^12.1.0",
|
|
135
|
-
"filter-obj": "^6.1.0",
|
|
136
|
-
"into-stream": "^8.0.1",
|
|
137
|
-
"is-stream": "^4.0.1",
|
|
138
26
|
"itty-router": "^5.0.22",
|
|
139
|
-
"ky": "^1.7.5",
|
|
140
27
|
"log-symbols": "^7.0.0",
|
|
141
|
-
"map-obj": "^5.0.2",
|
|
142
|
-
"mbtiles-reader": "^1.0.0",
|
|
143
28
|
"open": "^10.1.0",
|
|
144
29
|
"ora": "^8.2.0",
|
|
145
|
-
"p-event": "^6.0.1",
|
|
146
|
-
"p-limit": "^6.2.0",
|
|
147
30
|
"pretty-bytes": "^6.1.1",
|
|
148
31
|
"pretty-ms": "^9.2.0",
|
|
149
|
-
"readable-stream": "^4.7.0"
|
|
150
|
-
"temp-dir": "^3.0.0",
|
|
151
|
-
"yauzl-promise": "^4.0.0",
|
|
152
|
-
"yocto-queue": "^1.1.1"
|
|
153
|
-
},
|
|
154
|
-
"devDependencies": {
|
|
155
|
-
"@commander-js/extra-typings": "^12.1.0",
|
|
156
|
-
"@eslint/js": "^9.25.1",
|
|
157
|
-
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
|
|
158
|
-
"@types/archiver": "^6.0.3",
|
|
159
|
-
"@types/geojson": "^7946.0.16",
|
|
160
|
-
"@types/http-errors": "^2.0.4",
|
|
161
|
-
"@types/mapbox__sphericalmercator": "^1.2.3",
|
|
162
|
-
"@types/node": "^18.19.130",
|
|
163
|
-
"@types/readable-stream": "^4.0.18",
|
|
164
|
-
"@types/yauzl-promise": "^4.0.1",
|
|
165
|
-
"ava": "^6.2.0",
|
|
166
|
-
"esbuild-fix-imports-plugin": "^1.0.20",
|
|
167
|
-
"eslint": "^9.25.1",
|
|
168
|
-
"execa": "^9.4.0",
|
|
169
|
-
"fast-png": "^6.3.0",
|
|
170
|
-
"globals": "^16.0.0",
|
|
171
|
-
"husky": "^9.1.7",
|
|
172
|
-
"lint-staged": "^15.4.3",
|
|
173
|
-
"patch-package": "^8.0.1",
|
|
174
|
-
"pixel-stream": "^1.0.3",
|
|
175
|
-
"playwright": "^1.50.1",
|
|
176
|
-
"prettier": "^3.5.2",
|
|
177
|
-
"random-bytes-readable-stream": "^3.0.0",
|
|
178
|
-
"sharp": "^0.33.5",
|
|
179
|
-
"tempy": "^3.1.0",
|
|
180
|
-
"tsup": "^8.4.0",
|
|
181
|
-
"type-fest": "^4.35.0",
|
|
182
|
-
"typescript": "^5.9.3"
|
|
183
|
-
},
|
|
184
|
-
"bundleDependencies": [
|
|
185
|
-
"yauzl-promise"
|
|
186
|
-
],
|
|
187
|
-
"prettier": {
|
|
188
|
-
"semi": false,
|
|
189
|
-
"singleQuote": true,
|
|
190
|
-
"importOrder": [
|
|
191
|
-
"^node:",
|
|
192
|
-
"^[./]"
|
|
193
|
-
],
|
|
194
|
-
"importOrderSeparation": true,
|
|
195
|
-
"plugins": [
|
|
196
|
-
"@trivago/prettier-plugin-sort-imports"
|
|
197
|
-
]
|
|
198
|
-
},
|
|
199
|
-
"lint-staged": {
|
|
200
|
-
"*.js": [
|
|
201
|
-
"eslint --cache --fix"
|
|
202
|
-
],
|
|
203
|
-
"*.{js,css,md}": "prettier --write"
|
|
204
|
-
},
|
|
205
|
-
"directories": {
|
|
206
|
-
"lib": "lib",
|
|
207
|
-
"test": "test"
|
|
32
|
+
"readable-stream": "^4.7.0"
|
|
208
33
|
},
|
|
209
34
|
"repository": {
|
|
210
35
|
"type": "git",
|
|
211
|
-
"url": "git+https://github.com/digidem/styled-map-package.git"
|
|
212
|
-
|
|
213
|
-
"bugs": {
|
|
214
|
-
"url": "https://github.com/digidem/styled-map-package/issues"
|
|
36
|
+
"url": "git+https://github.com/digidem/styled-map-package.git",
|
|
37
|
+
"directory": "packages/cli"
|
|
215
38
|
}
|
|
216
39
|
}
|
package/LICENSE.md
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
Copyright (c) 2024 Awana Digital
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
-
|
|
5
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
-
|
|
7
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
# Styled Map Package
|
|
2
|
-
|
|
3
|
-
A Styled Map Package (`.smp`) file is a Zip archive containing all the resources needed to serve a Maplibre vector styled map offline. This includes the style JSON, vector and raster tiles, glyphs (fonts), the sprite image, and the sprite metadata.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
Install globally to use the `smp` command.
|
|
8
|
-
|
|
9
|
-
```sh
|
|
10
|
-
npm install --global styled-map-package
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
Download an online map to a styled map package file, specifying the bounding box (west, south, east, north) and max zoom level.
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
smp download https://demotiles.maplibre.org/style.json \
|
|
19
|
-
--bbox '-180,-80,180,80' \
|
|
20
|
-
--zoom 5 \
|
|
21
|
-
--output demotiles.smp
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Start a server and open in the default browser.
|
|
25
|
-
|
|
26
|
-
```sh
|
|
27
|
-
smp view demotiles.smp --open
|
|
28
|
-
```
|
package/dist/download.cjs
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var download_exports = {};
|
|
20
|
-
__export(download_exports, {
|
|
21
|
-
download: () => download
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(download_exports);
|
|
24
|
-
var import_readable_stream = require("readable-stream");
|
|
25
|
-
var import_promises = require("stream/promises");
|
|
26
|
-
var import_style_downloader = require('./style-downloader.cjs');
|
|
27
|
-
var import_writer = require('./writer.cjs');
|
|
28
|
-
function download({ bbox, maxzoom, styleUrl, onprogress, accessToken }) {
|
|
29
|
-
const downloader = new import_style_downloader.StyleDownloader(styleUrl, {
|
|
30
|
-
concurrency: 24,
|
|
31
|
-
mapboxAccessToken: accessToken
|
|
32
|
-
});
|
|
33
|
-
let start = Date.now();
|
|
34
|
-
let progress = {
|
|
35
|
-
tiles: { downloaded: 0, totalBytes: 0, total: 0, skipped: 0, done: false },
|
|
36
|
-
style: { done: false },
|
|
37
|
-
sprites: { downloaded: 0, done: false },
|
|
38
|
-
glyphs: { downloaded: 0, total: 0, totalBytes: 0, done: false },
|
|
39
|
-
output: { totalBytes: 0, done: false },
|
|
40
|
-
elapsedMs: 0
|
|
41
|
-
};
|
|
42
|
-
const sizeCounter = new import_readable_stream.Transform({
|
|
43
|
-
transform(chunk, encoding, cb) {
|
|
44
|
-
handleProgress({
|
|
45
|
-
output: {
|
|
46
|
-
totalBytes: progress.output.totalBytes + chunk.length,
|
|
47
|
-
done: false
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
cb(null, chunk);
|
|
51
|
-
},
|
|
52
|
-
final(cb) {
|
|
53
|
-
handleProgress({ output: { ...progress.output, done: true } });
|
|
54
|
-
cb();
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
function handleProgress(update) {
|
|
58
|
-
progress = { ...progress, ...update, elapsedMs: Date.now() - start };
|
|
59
|
-
onprogress?.(progress);
|
|
60
|
-
}
|
|
61
|
-
;
|
|
62
|
-
(async () => {
|
|
63
|
-
const style = await downloader.getStyle();
|
|
64
|
-
const writer = new import_writer.Writer(style);
|
|
65
|
-
handleProgress({ style: { done: true } });
|
|
66
|
-
writer.outputStream.pipe(sizeCounter);
|
|
67
|
-
writer.on("error", (err) => sizeCounter.destroy(err));
|
|
68
|
-
try {
|
|
69
|
-
for await (const spriteInfo of downloader.getSprites()) {
|
|
70
|
-
await writer.addSprite(spriteInfo);
|
|
71
|
-
handleProgress({
|
|
72
|
-
sprites: { downloaded: progress.sprites.downloaded + 1, done: false }
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
handleProgress({ sprites: { ...progress.sprites, done: true } });
|
|
76
|
-
const tiles = downloader.getTiles({
|
|
77
|
-
bounds: bbox,
|
|
78
|
-
maxzoom,
|
|
79
|
-
onprogress: (tileStats) => handleProgress({ tiles: { ...tileStats, done: false } })
|
|
80
|
-
});
|
|
81
|
-
await (0, import_promises.pipeline)(tiles, writer.createTileWriteStream({ concurrency: 24 }));
|
|
82
|
-
handleProgress({ tiles: { ...progress.tiles, done: true } });
|
|
83
|
-
const glyphs = downloader.getGlyphs({
|
|
84
|
-
onprogress: (glyphStats) => handleProgress({ glyphs: { ...glyphStats, done: false } })
|
|
85
|
-
});
|
|
86
|
-
await (0, import_promises.pipeline)(glyphs, writer.createGlyphWriteStream());
|
|
87
|
-
handleProgress({ glyphs: { ...progress.glyphs, done: true } });
|
|
88
|
-
writer.finish();
|
|
89
|
-
} catch (err) {
|
|
90
|
-
writer.outputStream.destroy(
|
|
91
|
-
/** @type {Error} */
|
|
92
|
-
err
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
})();
|
|
96
|
-
return sizeCounter;
|
|
97
|
-
}
|
|
98
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
99
|
-
0 && (module.exports = {
|
|
100
|
-
download
|
|
101
|
-
});
|
package/dist/download.d.cts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { GlyphDownloadStats } from './style-downloader.cjs';
|
|
2
|
-
import { TileDownloadStats } from './tile-downloader.cjs';
|
|
3
|
-
import { D as DownloadStream } from './types-yLQy3AKR.cjs';
|
|
4
|
-
import { BBox } from './utils/geo.cjs';
|
|
5
|
-
import 'ky';
|
|
6
|
-
import 'stream';
|
|
7
|
-
import '@maplibre/maplibre-gl-style-spec';
|
|
8
|
-
import './utils/fetch.cjs';
|
|
9
|
-
import './utils/streams.cjs';
|
|
10
|
-
import 'readable-stream';
|
|
11
|
-
import 'geojson';
|
|
12
|
-
import 'type-fest';
|
|
13
|
-
import 'events';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @typedef {object} DownloadProgress
|
|
17
|
-
* @property {import('./tile-downloader.js').TileDownloadStats & { done: boolean }} tiles
|
|
18
|
-
* @property {{ done: boolean }} style
|
|
19
|
-
* @property {{ downloaded: number, done: boolean }} sprites
|
|
20
|
-
* @property {import('./style-downloader.js').GlyphDownloadStats & { done: boolean }} glyphs
|
|
21
|
-
* @property {{ totalBytes: number, done: boolean }} output
|
|
22
|
-
* @property {number} elapsedMs
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Download a map style and its resources for a given bounding box and max zoom
|
|
26
|
-
* level. Returns a readable stream of a "styled map package", a zip file
|
|
27
|
-
* containing all the resources needed to serve the style offline.
|
|
28
|
-
*
|
|
29
|
-
* @param {object} opts
|
|
30
|
-
* @param {import("./utils/geo.js").BBox} opts.bbox Bounding box to download tiles for
|
|
31
|
-
* @param {number} opts.maxzoom Max zoom level to download tiles for
|
|
32
|
-
* @param {string} opts.styleUrl URL of the style to download
|
|
33
|
-
* @param { (progress: DownloadProgress) => void } [opts.onprogress] Optional callback for reporting progress
|
|
34
|
-
* @param {string} [opts.accessToken]
|
|
35
|
-
* @returns {import('./types.js').DownloadStream} Readable stream of the output styled map file
|
|
36
|
-
*/
|
|
37
|
-
declare function download({ bbox, maxzoom, styleUrl, onprogress, accessToken }: {
|
|
38
|
-
bbox: BBox;
|
|
39
|
-
maxzoom: number;
|
|
40
|
-
styleUrl: string;
|
|
41
|
-
onprogress?: ((progress: DownloadProgress) => void) | undefined;
|
|
42
|
-
accessToken?: string | undefined;
|
|
43
|
-
}): DownloadStream;
|
|
44
|
-
type DownloadProgress = {
|
|
45
|
-
tiles: TileDownloadStats & {
|
|
46
|
-
done: boolean;
|
|
47
|
-
};
|
|
48
|
-
style: {
|
|
49
|
-
done: boolean;
|
|
50
|
-
};
|
|
51
|
-
sprites: {
|
|
52
|
-
downloaded: number;
|
|
53
|
-
done: boolean;
|
|
54
|
-
};
|
|
55
|
-
glyphs: GlyphDownloadStats & {
|
|
56
|
-
done: boolean;
|
|
57
|
-
};
|
|
58
|
-
output: {
|
|
59
|
-
totalBytes: number;
|
|
60
|
-
done: boolean;
|
|
61
|
-
};
|
|
62
|
-
elapsedMs: number;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export { type DownloadProgress, download };
|
package/dist/download.d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { GlyphDownloadStats } from './style-downloader.js';
|
|
2
|
-
import { TileDownloadStats } from './tile-downloader.js';
|
|
3
|
-
import { D as DownloadStream } from './types-yLQy3AKR.js';
|
|
4
|
-
import { BBox } from './utils/geo.js';
|
|
5
|
-
import 'ky';
|
|
6
|
-
import 'stream';
|
|
7
|
-
import '@maplibre/maplibre-gl-style-spec';
|
|
8
|
-
import './utils/fetch.js';
|
|
9
|
-
import './utils/streams.js';
|
|
10
|
-
import 'readable-stream';
|
|
11
|
-
import 'geojson';
|
|
12
|
-
import 'type-fest';
|
|
13
|
-
import 'events';
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @typedef {object} DownloadProgress
|
|
17
|
-
* @property {import('./tile-downloader.js').TileDownloadStats & { done: boolean }} tiles
|
|
18
|
-
* @property {{ done: boolean }} style
|
|
19
|
-
* @property {{ downloaded: number, done: boolean }} sprites
|
|
20
|
-
* @property {import('./style-downloader.js').GlyphDownloadStats & { done: boolean }} glyphs
|
|
21
|
-
* @property {{ totalBytes: number, done: boolean }} output
|
|
22
|
-
* @property {number} elapsedMs
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* Download a map style and its resources for a given bounding box and max zoom
|
|
26
|
-
* level. Returns a readable stream of a "styled map package", a zip file
|
|
27
|
-
* containing all the resources needed to serve the style offline.
|
|
28
|
-
*
|
|
29
|
-
* @param {object} opts
|
|
30
|
-
* @param {import("./utils/geo.js").BBox} opts.bbox Bounding box to download tiles for
|
|
31
|
-
* @param {number} opts.maxzoom Max zoom level to download tiles for
|
|
32
|
-
* @param {string} opts.styleUrl URL of the style to download
|
|
33
|
-
* @param { (progress: DownloadProgress) => void } [opts.onprogress] Optional callback for reporting progress
|
|
34
|
-
* @param {string} [opts.accessToken]
|
|
35
|
-
* @returns {import('./types.js').DownloadStream} Readable stream of the output styled map file
|
|
36
|
-
*/
|
|
37
|
-
declare function download({ bbox, maxzoom, styleUrl, onprogress, accessToken }: {
|
|
38
|
-
bbox: BBox;
|
|
39
|
-
maxzoom: number;
|
|
40
|
-
styleUrl: string;
|
|
41
|
-
onprogress?: ((progress: DownloadProgress) => void) | undefined;
|
|
42
|
-
accessToken?: string | undefined;
|
|
43
|
-
}): DownloadStream;
|
|
44
|
-
type DownloadProgress = {
|
|
45
|
-
tiles: TileDownloadStats & {
|
|
46
|
-
done: boolean;
|
|
47
|
-
};
|
|
48
|
-
style: {
|
|
49
|
-
done: boolean;
|
|
50
|
-
};
|
|
51
|
-
sprites: {
|
|
52
|
-
downloaded: number;
|
|
53
|
-
done: boolean;
|
|
54
|
-
};
|
|
55
|
-
glyphs: GlyphDownloadStats & {
|
|
56
|
-
done: boolean;
|
|
57
|
-
};
|
|
58
|
-
output: {
|
|
59
|
-
totalBytes: number;
|
|
60
|
-
done: boolean;
|
|
61
|
-
};
|
|
62
|
-
elapsedMs: number;
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export { type DownloadProgress, download };
|