styled-map-package 4.0.0 → 4.1.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 +1 -1
- package/bin/smp-view.js +32 -23
- package/dist/download.d.cts +1 -1
- package/dist/download.d.ts +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/reader-watch.d.cts +1 -1
- package/dist/reader-watch.d.ts +1 -1
- package/dist/reader.cjs +2 -1
- package/dist/reader.d.cts +1 -1
- package/dist/reader.d.ts +1 -1
- package/dist/reader.js +2 -1
- package/dist/server.cjs +3 -4
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +3 -4
- package/dist/style-downloader.cjs +2 -2
- package/dist/style-downloader.d.cts +1 -1
- package/dist/style-downloader.d.ts +1 -1
- package/dist/style-downloader.js +2 -2
- package/dist/tile-downloader.cjs +2 -2
- package/dist/tile-downloader.d.cts +1 -1
- package/dist/tile-downloader.d.ts +1 -1
- package/dist/tile-downloader.js +2 -2
- package/dist/{types-B4Xn1F9K.d.cts → types-yLQy3AKR.d.cts} +6 -3
- package/dist/{types-B4Xn1F9K.d.ts → types-yLQy3AKR.d.ts} +6 -3
- package/dist/utils/file-formats.d.cts +1 -1
- package/dist/utils/file-formats.d.ts +1 -1
- package/dist/utils/style.cjs +2 -2
- package/dist/utils/style.d.cts +1 -1
- package/dist/utils/style.d.ts +1 -1
- package/dist/utils/style.js +2 -2
- package/dist/utils/templates.cjs +4 -0
- package/dist/utils/templates.d.cts +4 -2
- package/dist/utils/templates.d.ts +4 -2
- package/dist/utils/templates.js +2 -0
- package/dist/writer.cjs +51 -3
- package/dist/writer.d.cts +1 -1
- package/dist/writer.d.ts +1 -1
- package/dist/writer.js +53 -3
- package/node_modules/@node-rs/crc32/LICENSE +21 -0
- package/node_modules/@node-rs/crc32/README.md +61 -0
- package/node_modules/@node-rs/crc32/browser.js +1 -0
- package/node_modules/@node-rs/crc32/index.d.ts +5 -0
- package/node_modules/@node-rs/crc32/index.js +368 -0
- package/node_modules/@node-rs/crc32/package.json +97 -0
- package/node_modules/@node-rs/crc32-linux-x64-gnu/README.md +3 -0
- 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 +43 -0
- package/node_modules/@node-rs/crc32-linux-x64-musl/README.md +3 -0
- 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 +43 -0
- package/node_modules/define-data-property/.eslintrc +24 -0
- package/node_modules/define-data-property/.github/FUNDING.yml +12 -0
- package/node_modules/define-data-property/.nycrc +13 -0
- package/node_modules/define-data-property/CHANGELOG.md +70 -0
- package/node_modules/define-data-property/LICENSE +21 -0
- package/node_modules/define-data-property/README.md +67 -0
- package/node_modules/define-data-property/index.d.ts +12 -0
- package/node_modules/define-data-property/index.js +56 -0
- package/node_modules/define-data-property/package.json +106 -0
- package/node_modules/define-data-property/test/index.js +392 -0
- package/node_modules/define-data-property/tsconfig.json +59 -0
- package/node_modules/define-properties/.editorconfig +13 -0
- package/node_modules/define-properties/.eslintrc +19 -0
- package/node_modules/define-properties/.github/FUNDING.yml +12 -0
- package/node_modules/define-properties/.nycrc +9 -0
- package/node_modules/define-properties/CHANGELOG.md +91 -0
- package/node_modules/define-properties/LICENSE +21 -0
- package/node_modules/define-properties/README.md +84 -0
- package/node_modules/define-properties/index.js +47 -0
- package/node_modules/define-properties/package.json +88 -0
- package/node_modules/es-define-property/.eslintrc +13 -0
- package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
- package/node_modules/es-define-property/.nycrc +9 -0
- package/node_modules/es-define-property/CHANGELOG.md +29 -0
- package/node_modules/es-define-property/LICENSE +21 -0
- package/node_modules/es-define-property/README.md +49 -0
- package/node_modules/es-define-property/index.d.ts +3 -0
- package/node_modules/es-define-property/index.js +14 -0
- package/node_modules/es-define-property/package.json +81 -0
- package/node_modules/es-define-property/test/index.js +56 -0
- package/node_modules/es-define-property/tsconfig.json +10 -0
- package/node_modules/es-errors/.eslintrc +5 -0
- package/node_modules/es-errors/.github/FUNDING.yml +12 -0
- package/node_modules/es-errors/CHANGELOG.md +40 -0
- package/node_modules/es-errors/LICENSE +21 -0
- package/node_modules/es-errors/README.md +55 -0
- package/node_modules/es-errors/eval.d.ts +3 -0
- package/node_modules/es-errors/eval.js +4 -0
- package/node_modules/es-errors/index.d.ts +3 -0
- package/node_modules/es-errors/index.js +4 -0
- package/node_modules/es-errors/package.json +80 -0
- package/node_modules/es-errors/range.d.ts +3 -0
- package/node_modules/es-errors/range.js +4 -0
- package/node_modules/es-errors/ref.d.ts +3 -0
- package/node_modules/es-errors/ref.js +4 -0
- package/node_modules/es-errors/syntax.d.ts +3 -0
- package/node_modules/es-errors/syntax.js +4 -0
- package/node_modules/es-errors/test/index.js +19 -0
- package/node_modules/es-errors/tsconfig.json +49 -0
- package/node_modules/es-errors/type.d.ts +3 -0
- package/node_modules/es-errors/type.js +4 -0
- package/node_modules/es-errors/uri.d.ts +3 -0
- package/node_modules/es-errors/uri.js +4 -0
- package/node_modules/globalthis/.eslintrc +18 -0
- package/node_modules/globalthis/.nycrc +10 -0
- package/node_modules/globalthis/CHANGELOG.md +109 -0
- package/node_modules/globalthis/LICENSE +21 -0
- package/node_modules/globalthis/README.md +70 -0
- package/node_modules/globalthis/auto.js +3 -0
- package/node_modules/globalthis/implementation.browser.js +11 -0
- package/node_modules/globalthis/implementation.js +3 -0
- package/node_modules/globalthis/index.js +19 -0
- package/node_modules/globalthis/package.json +99 -0
- package/node_modules/globalthis/polyfill.js +10 -0
- package/node_modules/globalthis/shim.js +29 -0
- package/node_modules/globalthis/test/implementation.js +11 -0
- package/node_modules/globalthis/test/index.js +11 -0
- package/node_modules/globalthis/test/native.js +26 -0
- package/node_modules/globalthis/test/shimmed.js +29 -0
- package/node_modules/globalthis/test/tests.js +36 -0
- package/node_modules/gopd/.eslintrc +16 -0
- package/node_modules/gopd/.github/FUNDING.yml +12 -0
- package/node_modules/gopd/CHANGELOG.md +45 -0
- package/node_modules/gopd/LICENSE +21 -0
- package/node_modules/gopd/README.md +40 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +15 -0
- package/node_modules/gopd/package.json +77 -0
- package/node_modules/gopd/test/index.js +36 -0
- package/node_modules/gopd/tsconfig.json +9 -0
- package/node_modules/has-property-descriptors/.eslintrc +13 -0
- package/node_modules/has-property-descriptors/.github/FUNDING.yml +12 -0
- package/node_modules/has-property-descriptors/.nycrc +9 -0
- package/node_modules/has-property-descriptors/CHANGELOG.md +35 -0
- package/node_modules/has-property-descriptors/LICENSE +21 -0
- package/node_modules/has-property-descriptors/README.md +43 -0
- package/node_modules/has-property-descriptors/index.js +22 -0
- package/node_modules/has-property-descriptors/package.json +77 -0
- package/node_modules/has-property-descriptors/test/index.js +57 -0
- package/node_modules/is-it-type/License +19 -0
- package/node_modules/is-it-type/README.md +102 -0
- package/node_modules/is-it-type/changelog.md +239 -0
- package/node_modules/is-it-type/dist/cjs/is-it-type.js +173 -0
- package/node_modules/is-it-type/dist/cjs/is-it-type.js.map +1 -0
- package/node_modules/is-it-type/dist/cjs/is-it-type.min.js +2 -0
- package/node_modules/is-it-type/dist/cjs/is-it-type.min.js.map +1 -0
- package/node_modules/is-it-type/dist/esm/is-it-type.js +143 -0
- package/node_modules/is-it-type/dist/esm/is-it-type.js.map +1 -0
- package/node_modules/is-it-type/dist/esm/is-it-type.min.js +2 -0
- package/node_modules/is-it-type/dist/esm/is-it-type.min.js.map +1 -0
- package/node_modules/is-it-type/dist/esm/package.json +3 -0
- package/node_modules/is-it-type/dist/umd/is-it-type.js +450 -0
- package/node_modules/is-it-type/dist/umd/is-it-type.js.map +1 -0
- package/node_modules/is-it-type/dist/umd/is-it-type.min.js +2 -0
- package/node_modules/is-it-type/dist/umd/is-it-type.min.js.map +1 -0
- package/node_modules/is-it-type/es/index.js +8 -0
- package/node_modules/is-it-type/es/package.json +3 -0
- package/node_modules/is-it-type/index.js +10 -0
- package/node_modules/is-it-type/package.json +87 -0
- package/node_modules/is-it-type/src/index.js +169 -0
- package/node_modules/object-keys/.editorconfig +13 -0
- package/node_modules/object-keys/.eslintrc +17 -0
- package/node_modules/object-keys/.travis.yml +277 -0
- package/node_modules/object-keys/CHANGELOG.md +232 -0
- package/node_modules/object-keys/LICENSE +21 -0
- package/node_modules/object-keys/README.md +76 -0
- package/node_modules/object-keys/implementation.js +122 -0
- package/node_modules/object-keys/index.js +32 -0
- package/node_modules/object-keys/isArguments.js +17 -0
- package/node_modules/object-keys/package.json +88 -0
- package/node_modules/object-keys/test/index.js +5 -0
- package/node_modules/simple-invariant/License +19 -0
- package/node_modules/simple-invariant/README.md +64 -0
- package/node_modules/simple-invariant/changelog.md +31 -0
- package/node_modules/simple-invariant/index.js +19 -0
- package/node_modules/simple-invariant/package.json +50 -0
- package/node_modules/yauzl-promise/License +19 -0
- package/node_modules/yauzl-promise/README.md +440 -0
- package/node_modules/yauzl-promise/index.js +10 -0
- package/node_modules/yauzl-promise/lib/entry.js +312 -0
- package/node_modules/yauzl-promise/lib/index.js +160 -0
- package/node_modules/yauzl-promise/lib/reader.js +289 -0
- package/node_modules/yauzl-promise/lib/shared.js +20 -0
- package/node_modules/yauzl-promise/lib/utils.js +105 -0
- package/node_modules/yauzl-promise/lib/zip.js +1224 -0
- package/node_modules/yauzl-promise/package.json +56 -0
- package/package.json +9 -11
package/bin/smp-download.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command, InvalidArgumentError } from '@commander-js/extra-typings'
|
|
3
2
|
import { input, number } from '@inquirer/prompts'
|
|
3
|
+
import { Command, InvalidArgumentError } from 'commander'
|
|
4
4
|
import fs from 'fs'
|
|
5
5
|
import { pipeline } from 'stream/promises'
|
|
6
6
|
|
package/bin/smp-view.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import fastifyStatic from '@fastify/static'
|
|
3
2
|
import { createServerAdapter } from '@whatwg-node/server'
|
|
4
3
|
import { Command } from 'commander'
|
|
5
|
-
import
|
|
4
|
+
import fsPromises from 'fs/promises'
|
|
5
|
+
import http from 'http'
|
|
6
|
+
import { AutoRouter } from 'itty-router'
|
|
6
7
|
import openApp from 'open'
|
|
7
8
|
|
|
8
9
|
import path from 'node:path'
|
|
@@ -28,37 +29,45 @@ program
|
|
|
28
29
|
program.parseAsync(process.argv)
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
|
-
* Serve a styled map package on the given port (defaults to 3000).
|
|
32
|
-
* fastify plugin in `./server.js` for more flexibility.
|
|
32
|
+
* Serve a styled map package on the given port (defaults to 3000).
|
|
33
33
|
*
|
|
34
34
|
* @param {object} opts
|
|
35
35
|
* @param {number} [opts.port]
|
|
36
36
|
* @param {string} opts.filepath
|
|
37
37
|
* @returns
|
|
38
38
|
*/
|
|
39
|
-
function serve({ port = 3000, filepath }) {
|
|
39
|
+
async function serve({ port = 3000, filepath }) {
|
|
40
40
|
const reader = new Reader(path.relative(process.cwd(), filepath))
|
|
41
41
|
const smpServer = createServer({ base: '/map' })
|
|
42
|
-
const serverAdapter = createServerAdapter((request) => {
|
|
43
|
-
return smpServer.fetch(request, reader)
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
const server = fastify()
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
43
|
+
const router = AutoRouter()
|
|
44
|
+
router.get('/', async () => {
|
|
45
|
+
const index = await fsPromises.readFile(
|
|
46
|
+
new URL('../map-viewer/index.html', import.meta.url),
|
|
47
|
+
)
|
|
48
|
+
return new Response(new Uint8Array(index), {
|
|
49
|
+
headers: {
|
|
50
|
+
'Content-Type': 'text/html',
|
|
51
|
+
'Content-Length': String(index.byteLength),
|
|
52
|
+
'Cache-Control': 'public, max-age=0',
|
|
53
|
+
},
|
|
54
|
+
})
|
|
51
55
|
})
|
|
52
|
-
|
|
53
|
-
return
|
|
56
|
+
router.all('/map/*', (request) => {
|
|
57
|
+
return smpServer.fetch(request, reader)
|
|
54
58
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
const server = http.createServer(createServerAdapter(router.fetch))
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
server.listen(port, '127.0.0.1', () => {
|
|
62
|
+
const address = server.address()
|
|
63
|
+
if (typeof address === 'string') {
|
|
64
|
+
resolve(`http://${address}`)
|
|
65
|
+
} else if (address === null) {
|
|
66
|
+
reject(new Error('Failed to get server address'))
|
|
67
|
+
} else {
|
|
68
|
+
resolve(`http://${address.address}:${address.port}`)
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
server.on('error', reject)
|
|
62
72
|
})
|
|
63
|
-
return server.listen({ port })
|
|
64
73
|
}
|
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-yLQy3AKR.cjs';
|
|
4
4
|
import { BBox } from './utils/geo.cjs';
|
|
5
5
|
import 'ky';
|
|
6
6
|
import 'stream';
|
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-yLQy3AKR.js';
|
|
4
4
|
import { BBox } from './utils/geo.js';
|
|
5
5
|
import 'ky';
|
|
6
6
|
import 'stream';
|
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-yLQy3AKR.cjs';
|
|
2
|
+
export { W as Writer } from './types-yLQy3AKR.cjs';
|
|
3
3
|
export { Reader } from './reader.cjs';
|
|
4
4
|
export { ReaderWatch } from './reader-watch.cjs';
|
|
5
5
|
export { createServer } from './server.cjs';
|
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-yLQy3AKR.js';
|
|
2
|
+
export { W as Writer } from './types-yLQy3AKR.js';
|
|
3
3
|
export { Reader } from './reader.js';
|
|
4
4
|
export { ReaderWatch } from './reader-watch.js';
|
|
5
5
|
export { createServer } from './server.js';
|
package/dist/reader-watch.d.cts
CHANGED
package/dist/reader-watch.d.ts
CHANGED
package/dist/reader.cjs
CHANGED
|
@@ -145,7 +145,8 @@ class Reader {
|
|
|
145
145
|
async close() {
|
|
146
146
|
if (this.#closePromise) return this.#closePromise;
|
|
147
147
|
this.#closePromise = (async () => {
|
|
148
|
-
const zip = await this.#zipPromise;
|
|
148
|
+
const zip = await this.#zipPromise.catch(import_misc.noop);
|
|
149
|
+
if (!zip) return;
|
|
149
150
|
await zip.close();
|
|
150
151
|
})();
|
|
151
152
|
return this.#closePromise;
|
package/dist/reader.d.cts
CHANGED
package/dist/reader.d.ts
CHANGED
package/dist/reader.js
CHANGED
|
@@ -117,7 +117,8 @@ class Reader {
|
|
|
117
117
|
async close() {
|
|
118
118
|
if (this.#closePromise) return this.#closePromise;
|
|
119
119
|
this.#closePromise = (async () => {
|
|
120
|
-
const zip = await this.#zipPromise;
|
|
120
|
+
const zip = await this.#zipPromise.catch(noop);
|
|
121
|
+
if (!zip) return;
|
|
121
122
|
await zip.close();
|
|
122
123
|
})();
|
|
123
124
|
return this.#closePromise;
|
package/dist/server.cjs
CHANGED
|
@@ -52,12 +52,11 @@ function createServer({ base = "/" } = {}) {
|
|
|
52
52
|
const router = (0, import_IttyRouter.IttyRouter)({
|
|
53
53
|
base
|
|
54
54
|
}).get("/style.json", async (request, reader) => {
|
|
55
|
-
const baseUrl = new URL(
|
|
55
|
+
const baseUrl = new URL(".", request.url);
|
|
56
56
|
const style = await reader.getStyle(baseUrl.href);
|
|
57
57
|
return json(style);
|
|
58
|
-
}).get("
|
|
59
|
-
const
|
|
60
|
-
const path = decodeURIComponent(url.pathname.slice(base.length - 1));
|
|
58
|
+
}).get(":path+", async (request, reader) => {
|
|
59
|
+
const path = decodeURIComponent(request.params.path);
|
|
61
60
|
const resource = await reader.getResource(path);
|
|
62
61
|
return resourceResponse(resource);
|
|
63
62
|
});
|
package/dist/server.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { RequestLike } from 'itty-router';
|
|
|
2
2
|
import { Reader } from './reader.cjs';
|
|
3
3
|
import { IttyRouter } from 'itty-router/IttyRouter';
|
|
4
4
|
import 'stream';
|
|
5
|
-
import './types-
|
|
5
|
+
import './types-yLQy3AKR.cjs';
|
|
6
6
|
import '@maplibre/maplibre-gl-style-spec';
|
|
7
7
|
import 'geojson';
|
|
8
8
|
import 'type-fest';
|
package/dist/server.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { RequestLike } from 'itty-router';
|
|
|
2
2
|
import { Reader } from './reader.js';
|
|
3
3
|
import { IttyRouter } from 'itty-router/IttyRouter';
|
|
4
4
|
import 'stream';
|
|
5
|
-
import './types-
|
|
5
|
+
import './types-yLQy3AKR.js';
|
|
6
6
|
import '@maplibre/maplibre-gl-style-spec';
|
|
7
7
|
import 'geojson';
|
|
8
8
|
import 'type-fest';
|
package/dist/server.js
CHANGED
|
@@ -29,12 +29,11 @@ function createServer({ base = "/" } = {}) {
|
|
|
29
29
|
const router = IttyRouter({
|
|
30
30
|
base
|
|
31
31
|
}).get("/style.json", async (request, reader) => {
|
|
32
|
-
const baseUrl = new URL(
|
|
32
|
+
const baseUrl = new URL(".", request.url);
|
|
33
33
|
const style = await reader.getStyle(baseUrl.href);
|
|
34
34
|
return json(style);
|
|
35
|
-
}).get("
|
|
36
|
-
const
|
|
37
|
-
const path = decodeURIComponent(url.pathname.slice(base.length - 1));
|
|
35
|
+
}).get(":path+", async (request, reader) => {
|
|
36
|
+
const path = decodeURIComponent(request.params.path);
|
|
38
37
|
const resource = await reader.getResource(path);
|
|
39
38
|
return resourceResponse(resource);
|
|
40
39
|
});
|
|
@@ -252,7 +252,7 @@ class StyleDownloader {
|
|
|
252
252
|
skipped: 0,
|
|
253
253
|
totalBytes: 0
|
|
254
254
|
};
|
|
255
|
-
const tiles = async function* () {
|
|
255
|
+
const tiles = (async function* () {
|
|
256
256
|
const inlinedStyle = await _this.getStyle();
|
|
257
257
|
for await (const [sourceId, source] of Object.entries(
|
|
258
258
|
inlinedStyle.sources
|
|
@@ -284,7 +284,7 @@ class StyleDownloader {
|
|
|
284
284
|
sourceTiles.skipped.map((tile) => ({ ...tile, sourceId }))
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
|
-
}();
|
|
287
|
+
})();
|
|
288
288
|
Object.defineProperty(tiles, "skipped", {
|
|
289
289
|
get() {
|
|
290
290
|
return skipped;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ky from 'ky';
|
|
2
2
|
import { BBox } from './utils/geo.cjs';
|
|
3
3
|
import * as stream from 'stream';
|
|
4
|
-
import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-
|
|
4
|
+
import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-yLQy3AKR.cjs';
|
|
5
5
|
import { TileDownloadStats } from './tile-downloader.cjs';
|
|
6
6
|
import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
7
7
|
import 'geojson';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as ky from 'ky';
|
|
2
2
|
import { BBox } from './utils/geo.js';
|
|
3
3
|
import * as stream from 'stream';
|
|
4
|
-
import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-
|
|
4
|
+
import { b as StyleInlinedSources, G as GlyphInfo, T as TileInfo } from './types-yLQy3AKR.js';
|
|
5
5
|
import { TileDownloadStats } from './tile-downloader.js';
|
|
6
6
|
import { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
7
7
|
import 'geojson';
|
package/dist/style-downloader.js
CHANGED
|
@@ -229,7 +229,7 @@ class StyleDownloader {
|
|
|
229
229
|
skipped: 0,
|
|
230
230
|
totalBytes: 0
|
|
231
231
|
};
|
|
232
|
-
const tiles = async function* () {
|
|
232
|
+
const tiles = (async function* () {
|
|
233
233
|
const inlinedStyle = await _this.getStyle();
|
|
234
234
|
for await (const [sourceId, source] of Object.entries(
|
|
235
235
|
inlinedStyle.sources
|
|
@@ -261,7 +261,7 @@ class StyleDownloader {
|
|
|
261
261
|
sourceTiles.skipped.map((tile) => ({ ...tile, sourceId }))
|
|
262
262
|
);
|
|
263
263
|
}
|
|
264
|
-
}();
|
|
264
|
+
})();
|
|
265
265
|
Object.defineProperty(tiles, "skipped", {
|
|
266
266
|
get() {
|
|
267
267
|
return skipped;
|
package/dist/tile-downloader.cjs
CHANGED
|
@@ -77,7 +77,7 @@ function downloadTiles({
|
|
|
77
77
|
stats.skipped = skipped.length;
|
|
78
78
|
onprogress(stats);
|
|
79
79
|
}
|
|
80
|
-
const tiles = async function* () {
|
|
80
|
+
const tiles = (async function* () {
|
|
81
81
|
const queue = new import_yocto_queue.default();
|
|
82
82
|
const tiles2 = tileIterator({
|
|
83
83
|
bounds,
|
|
@@ -115,7 +115,7 @@ function downloadTiles({
|
|
|
115
115
|
}
|
|
116
116
|
yield [stream, { ...tileInfo, format }];
|
|
117
117
|
}
|
|
118
|
-
}();
|
|
118
|
+
})();
|
|
119
119
|
Object.defineProperty(tiles, "skipped", {
|
|
120
120
|
get() {
|
|
121
121
|
return skipped;
|
package/dist/tile-downloader.js
CHANGED
|
@@ -46,7 +46,7 @@ function downloadTiles({
|
|
|
46
46
|
stats.skipped = skipped.length;
|
|
47
47
|
onprogress(stats);
|
|
48
48
|
}
|
|
49
|
-
const tiles = async function* () {
|
|
49
|
+
const tiles = (async function* () {
|
|
50
50
|
const queue = new Queue();
|
|
51
51
|
const tiles2 = tileIterator({
|
|
52
52
|
bounds,
|
|
@@ -84,7 +84,7 @@ function downloadTiles({
|
|
|
84
84
|
}
|
|
85
85
|
yield [stream, { ...tileInfo, format }];
|
|
86
86
|
}
|
|
87
|
-
}();
|
|
87
|
+
})();
|
|
88
88
|
Object.defineProperty(tiles, "skipped", {
|
|
89
89
|
get() {
|
|
90
90
|
return skipped;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SourceSpecification, GeoJSONSourceSpecification, VectorSourceSpecification, RasterSourceSpecification, RasterDEMSourceSpecification
|
|
1
|
+
import { StyleSpecification, SourceSpecification, GeoJSONSourceSpecification, VectorSourceSpecification, RasterSourceSpecification, RasterDEMSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
2
|
import { GeoJSON, BBox } from 'geojson';
|
|
3
3
|
import * as stream from 'stream';
|
|
4
4
|
import { Readable } from 'stream';
|
|
@@ -111,9 +111,12 @@ declare class Writer extends EventEmitter<[never]> {
|
|
|
111
111
|
* This method must be called to complete the archive.
|
|
112
112
|
* You must wait for your destination write stream to 'finish' before using the output.
|
|
113
113
|
*/
|
|
114
|
-
finish(): void
|
|
114
|
+
finish(): Promise<void>;
|
|
115
115
|
#private;
|
|
116
116
|
}
|
|
117
|
+
type ZipEntry = {
|
|
118
|
+
name: string;
|
|
119
|
+
};
|
|
117
120
|
type Source = string | Buffer | Uint8Array | stream.Readable;
|
|
118
121
|
type SourceInternal = string | Buffer | stream.Readable;
|
|
119
122
|
type GlyphRange = `${number}-${number}`;
|
|
@@ -186,4 +189,4 @@ interface DownloadStream extends Readable {
|
|
|
186
189
|
}
|
|
187
190
|
type OmitUnion<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never;
|
|
188
191
|
|
|
189
|
-
export { type DownloadStream as D, type GlyphInfo as G, type InlinedSource as I, type SMPSource as S, type TileInfo as T, Writer as W, type SMPStyle as a, type StyleInlinedSources as b, type TileFormat as c, type GlyphRange as d, SUPPORTED_SOURCE_TYPES as e, type Source as f, type
|
|
192
|
+
export { type DownloadStream as D, type GlyphInfo as G, type InlinedSource as I, type SMPSource as S, type TileInfo as T, Writer as W, type ZipEntry as Z, type SMPStyle as a, type StyleInlinedSources as b, type TileFormat as c, type GlyphRange as d, SUPPORTED_SOURCE_TYPES as e, type Source as f, type SourceInfo as g, type SourceInternal as h };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SourceSpecification, GeoJSONSourceSpecification, VectorSourceSpecification, RasterSourceSpecification, RasterDEMSourceSpecification
|
|
1
|
+
import { StyleSpecification, SourceSpecification, GeoJSONSourceSpecification, VectorSourceSpecification, RasterSourceSpecification, RasterDEMSourceSpecification } from '@maplibre/maplibre-gl-style-spec';
|
|
2
2
|
import { GeoJSON, BBox } from 'geojson';
|
|
3
3
|
import * as stream from 'stream';
|
|
4
4
|
import { Readable } from 'stream';
|
|
@@ -111,9 +111,12 @@ declare class Writer extends EventEmitter<[never]> {
|
|
|
111
111
|
* This method must be called to complete the archive.
|
|
112
112
|
* You must wait for your destination write stream to 'finish' before using the output.
|
|
113
113
|
*/
|
|
114
|
-
finish(): void
|
|
114
|
+
finish(): Promise<void>;
|
|
115
115
|
#private;
|
|
116
116
|
}
|
|
117
|
+
type ZipEntry = {
|
|
118
|
+
name: string;
|
|
119
|
+
};
|
|
117
120
|
type Source = string | Buffer | Uint8Array | stream.Readable;
|
|
118
121
|
type SourceInternal = string | Buffer | stream.Readable;
|
|
119
122
|
type GlyphRange = `${number}-${number}`;
|
|
@@ -186,4 +189,4 @@ interface DownloadStream extends Readable {
|
|
|
186
189
|
}
|
|
187
190
|
type OmitUnion<T, K extends keyof any> = T extends unknown ? Omit<T, K> : never;
|
|
188
191
|
|
|
189
|
-
export { type DownloadStream as D, type GlyphInfo as G, type InlinedSource as I, type SMPSource as S, type TileInfo as T, Writer as W, type SMPStyle as a, type StyleInlinedSources as b, type TileFormat as c, type GlyphRange as d, SUPPORTED_SOURCE_TYPES as e, type Source as f, type
|
|
192
|
+
export { type DownloadStream as D, type GlyphInfo as G, type InlinedSource as I, type SMPSource as S, type TileInfo as T, Writer as W, type ZipEntry as Z, type SMPStyle as a, type StyleInlinedSources as b, type TileFormat as c, type GlyphRange as d, SUPPORTED_SOURCE_TYPES as e, type Source as f, type SourceInfo as g, type SourceInternal as h };
|
package/dist/utils/style.cjs
CHANGED
|
@@ -98,14 +98,14 @@ function assertTileJSON(tilejson) {
|
|
|
98
98
|
}
|
|
99
99
|
const validateStyle = (
|
|
100
100
|
/** @type {{ (style: unknown): style is StyleSpecification, errors: ValidationError[] }} */
|
|
101
|
-
(style) => {
|
|
101
|
+
((style) => {
|
|
102
102
|
validateStyle.errors = (0, import_maplibre_gl_style_spec.validateStyleMin)(
|
|
103
103
|
/** @type {StyleSpecification} */
|
|
104
104
|
style
|
|
105
105
|
);
|
|
106
106
|
if (validateStyle.errors.length) return false;
|
|
107
107
|
return true;
|
|
108
|
-
}
|
|
108
|
+
})
|
|
109
109
|
);
|
|
110
110
|
function isInlinedSource(source) {
|
|
111
111
|
if (source.type === "geojson") {
|
package/dist/utils/style.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BBox } from './geo.cjs';
|
|
2
|
-
import { I as InlinedSource } from '../types-
|
|
2
|
+
import { I as InlinedSource } from '../types-yLQy3AKR.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';
|
package/dist/utils/style.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BBox } from './geo.js';
|
|
2
|
-
import { I as InlinedSource } from '../types-
|
|
2
|
+
import { I as InlinedSource } from '../types-yLQy3AKR.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';
|
package/dist/utils/style.js
CHANGED
|
@@ -71,14 +71,14 @@ function assertTileJSON(tilejson) {
|
|
|
71
71
|
}
|
|
72
72
|
const validateStyle = (
|
|
73
73
|
/** @type {{ (style: unknown): style is StyleSpecification, errors: ValidationError[] }} */
|
|
74
|
-
(style) => {
|
|
74
|
+
((style) => {
|
|
75
75
|
validateStyle.errors = validateStyleMin(
|
|
76
76
|
/** @type {StyleSpecification} */
|
|
77
77
|
style
|
|
78
78
|
);
|
|
79
79
|
if (validateStyle.errors.length) return false;
|
|
80
80
|
return true;
|
|
81
|
-
}
|
|
81
|
+
})
|
|
82
82
|
);
|
|
83
83
|
function isInlinedSource(source) {
|
|
84
84
|
if (source.type === "geojson") {
|
package/dist/utils/templates.cjs
CHANGED
|
@@ -18,7 +18,9 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var templates_exports = {};
|
|
20
20
|
__export(templates_exports, {
|
|
21
|
+
FONTS_FOLDER: () => FONTS_FOLDER,
|
|
21
22
|
GLYPH_URI: () => GLYPH_URI,
|
|
23
|
+
SOURCES_FOLDER: () => SOURCES_FOLDER,
|
|
22
24
|
STYLE_FILE: () => STYLE_FILE,
|
|
23
25
|
URI_BASE: () => URI_BASE,
|
|
24
26
|
URI_SCHEME: () => URI_SCHEME,
|
|
@@ -99,7 +101,9 @@ function replaceVariables(template, variables) {
|
|
|
99
101
|
}
|
|
100
102
|
// Annotate the CommonJS export names for ESM import in node:
|
|
101
103
|
0 && (module.exports = {
|
|
104
|
+
FONTS_FOLDER,
|
|
102
105
|
GLYPH_URI,
|
|
106
|
+
SOURCES_FOLDER,
|
|
103
107
|
STYLE_FILE,
|
|
104
108
|
URI_BASE,
|
|
105
109
|
URI_SCHEME,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as type_fest from 'type-fest';
|
|
2
|
-
import {
|
|
2
|
+
import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-yLQy3AKR.cjs';
|
|
3
3
|
import '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
import 'geojson';
|
|
5
5
|
import 'stream';
|
|
@@ -73,6 +73,8 @@ declare function replaceVariables(template: string, variables: Record<string, st
|
|
|
73
73
|
declare const URI_SCHEME: "smp";
|
|
74
74
|
declare const URI_BASE: string;
|
|
75
75
|
declare const STYLE_FILE: "style.json";
|
|
76
|
+
declare const SOURCES_FOLDER: "s";
|
|
77
|
+
declare const FONTS_FOLDER: "fonts";
|
|
76
78
|
declare const GLYPH_URI: string;
|
|
77
79
|
|
|
78
|
-
export { GLYPH_URI, STYLE_FILE, URI_BASE, URI_SCHEME, getContentType, getGlyphFilename, getResourceType, getSpriteFilename, getSpriteUri, getTileFilename, getTileUri, replaceVariables };
|
|
80
|
+
export { FONTS_FOLDER, GLYPH_URI, SOURCES_FOLDER, STYLE_FILE, URI_BASE, URI_SCHEME, getContentType, getGlyphFilename, getResourceType, getSpriteFilename, getSpriteUri, getTileFilename, getTileUri, replaceVariables };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as type_fest from 'type-fest';
|
|
2
|
-
import {
|
|
2
|
+
import { d as GlyphRange, T as TileInfo, c as TileFormat } from '../types-yLQy3AKR.js';
|
|
3
3
|
import '@maplibre/maplibre-gl-style-spec';
|
|
4
4
|
import 'geojson';
|
|
5
5
|
import 'stream';
|
|
@@ -73,6 +73,8 @@ declare function replaceVariables(template: string, variables: Record<string, st
|
|
|
73
73
|
declare const URI_SCHEME: "smp";
|
|
74
74
|
declare const URI_BASE: string;
|
|
75
75
|
declare const STYLE_FILE: "style.json";
|
|
76
|
+
declare const SOURCES_FOLDER: "s";
|
|
77
|
+
declare const FONTS_FOLDER: "fonts";
|
|
76
78
|
declare const GLYPH_URI: string;
|
|
77
79
|
|
|
78
|
-
export { GLYPH_URI, STYLE_FILE, URI_BASE, URI_SCHEME, getContentType, getGlyphFilename, getResourceType, getSpriteFilename, getSpriteUri, getTileFilename, getTileUri, replaceVariables };
|
|
80
|
+
export { FONTS_FOLDER, GLYPH_URI, SOURCES_FOLDER, STYLE_FILE, URI_BASE, URI_SCHEME, getContentType, getGlyphFilename, getResourceType, getSpriteFilename, getSpriteUri, getTileFilename, getTileUri, replaceVariables };
|
package/dist/utils/templates.js
CHANGED
package/dist/writer.cjs
CHANGED
|
@@ -295,11 +295,12 @@ class Writer extends import_events.EventEmitter {
|
|
|
295
295
|
* This method must be called to complete the archive.
|
|
296
296
|
* You must wait for your destination write stream to 'finish' before using the output.
|
|
297
297
|
*/
|
|
298
|
-
finish() {
|
|
298
|
+
async finish() {
|
|
299
299
|
this.#prepareStyle();
|
|
300
300
|
const style = JSON.stringify(this.#style);
|
|
301
|
-
this.#append(style, { name: import_templates.STYLE_FILE });
|
|
302
|
-
this.#archive
|
|
301
|
+
await this.#append(style, { name: import_templates.STYLE_FILE });
|
|
302
|
+
sortEntries(this.#archive);
|
|
303
|
+
await this.#archive.finalize();
|
|
303
304
|
}
|
|
304
305
|
/**
|
|
305
306
|
* Mutates the style object to prepare it for writing to the archive.
|
|
@@ -394,6 +395,53 @@ function get2DBBox(bbox2) {
|
|
|
394
395
|
if (bbox2.length === 4) return bbox2;
|
|
395
396
|
return [bbox2[0], bbox2[1], bbox2[3], bbox2[4]];
|
|
396
397
|
}
|
|
398
|
+
function sortEntries(archive) {
|
|
399
|
+
const entries = (
|
|
400
|
+
/** @type {unknown} */
|
|
401
|
+
archive._module?.engine?._entries
|
|
402
|
+
);
|
|
403
|
+
if (!Array.isArray(entries)) {
|
|
404
|
+
throw new Error(
|
|
405
|
+
"Cannot find zip entries: check implementation changes in Archiver"
|
|
406
|
+
);
|
|
407
|
+
}
|
|
408
|
+
const sortedEntries = entries.sort(
|
|
409
|
+
/**
|
|
410
|
+
* @param {unknown} a
|
|
411
|
+
* @param {unknown} b
|
|
412
|
+
*/
|
|
413
|
+
function(a, b) {
|
|
414
|
+
assertValidEntry(a);
|
|
415
|
+
assertValidEntry(b);
|
|
416
|
+
if (a.name === "style.json") return -1;
|
|
417
|
+
if (b.name === "style.json") return 1;
|
|
418
|
+
const foldersA = a.name.split("/");
|
|
419
|
+
const foldersB = b.name.split("/");
|
|
420
|
+
if (foldersA[0] === import_templates.FONTS_FOLDER && foldersA[2] === "0-255.pbf.gz")
|
|
421
|
+
return -1;
|
|
422
|
+
if (foldersB[0] === import_templates.FONTS_FOLDER && foldersB[2] === "0-255.pbf.gz")
|
|
423
|
+
return 1;
|
|
424
|
+
if (foldersA[0] === import_templates.SOURCES_FOLDER && foldersB[0] !== import_templates.SOURCES_FOLDER)
|
|
425
|
+
return -1;
|
|
426
|
+
if (foldersB[0] === import_templates.SOURCES_FOLDER && foldersA[0] !== import_templates.SOURCES_FOLDER)
|
|
427
|
+
return 1;
|
|
428
|
+
if (foldersA[0] === import_templates.SOURCES_FOLDER && foldersB[0] === import_templates.SOURCES_FOLDER) {
|
|
429
|
+
const zoomA = +foldersA[2];
|
|
430
|
+
const zoomB = +foldersB[2];
|
|
431
|
+
return zoomA - zoomB;
|
|
432
|
+
}
|
|
433
|
+
return 0;
|
|
434
|
+
}
|
|
435
|
+
);
|
|
436
|
+
archive._module.engine._entries = sortedEntries;
|
|
437
|
+
}
|
|
438
|
+
function assertValidEntry(maybeEntry) {
|
|
439
|
+
if (!maybeEntry || typeof maybeEntry !== "object" || !("name" in maybeEntry) || typeof maybeEntry.name !== "string") {
|
|
440
|
+
throw new Error(
|
|
441
|
+
"Unexpected zip entry type: check implementation changes in Archiver"
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
397
445
|
// Annotate the CommonJS export names for ESM import in node:
|
|
398
446
|
0 && (module.exports = {
|
|
399
447
|
SUPPORTED_SOURCE_TYPES,
|
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,
|
|
1
|
+
export { G as GlyphInfo, d as GlyphRange, e as SUPPORTED_SOURCE_TYPES, f as Source, g as SourceInfo, h as SourceInternal, c as TileFormat, T as TileInfo, W as Writer, Z as ZipEntry } from './types-yLQy3AKR.cjs';
|
|
2
2
|
import 'readable-stream';
|
|
3
3
|
import 'stream';
|
|
4
4
|
import 'events';
|
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,
|
|
1
|
+
export { G as GlyphInfo, d as GlyphRange, e as SUPPORTED_SOURCE_TYPES, f as Source, g as SourceInfo, h as SourceInternal, c as TileFormat, T as TileInfo, W as Writer, Z as ZipEntry } from './types-yLQy3AKR.js';
|
|
2
2
|
import 'readable-stream';
|
|
3
3
|
import 'stream';
|
|
4
4
|
import 'events';
|