chiitiler 1.23.5 → 1.23.7
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 +22 -3
- package/dist/cli.js +3 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/render/warmup.d.ts +4 -4
- package/dist/render/warmup.js +4 -4
- package/package.json +13 -13
package/README.md
CHANGED
|
@@ -62,6 +62,10 @@ You're done. That same endpoint works as an XYZ tile source for Leaflet, MapLibr
|
|
|
62
62
|
- **[Allmaps Latest](https://bsky.app/profile/latest.allmaps.org)** — Bluesky bot
|
|
63
63
|
- **[Kumoy](https://www.kumoy.io/)** - used for thumbnail image of designed maps
|
|
64
64
|
|
|
65
|
+
## Presentations
|
|
66
|
+
|
|
67
|
+
- [FOSS4G Hiroshima 2026 — Presentation slides](https://drive.google.com/file/d/122JW5gJbrxnUVCVsSlcQMb22StPTnZQV/view?usp=sharing)
|
|
68
|
+
|
|
65
69
|
## HTTP API
|
|
66
70
|
|
|
67
71
|
| Method | Endpoint | Description |
|
|
@@ -108,6 +112,21 @@ const png = await getRenderedTileBuffer({
|
|
|
108
112
|
|
|
109
113
|
Available renderers: `getRenderedTileBuffer`, `getRenderedClipBuffer`, `getRenderedCameraBuffer`, and their `*Stream` variants (`Sharp` instances for further piping).
|
|
110
114
|
|
|
115
|
+
For library use, explicitly call `prewarm(cache)` once per rendering process
|
|
116
|
+
during application startup, before accepting requests:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
import { prewarm, ChiitilerCache } from 'chiitiler';
|
|
120
|
+
|
|
121
|
+
const cache = ChiitilerCache.noneCache();
|
|
122
|
+
await prewarm(cache);
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
The promise resolves after a minimal tile has been rendered and PNG-encoded.
|
|
126
|
+
It rejects if warmup fails; the application decides whether to continue startup.
|
|
127
|
+
Library imports do not automatically run prewarm, and `CHIITILER_PREWARM` only
|
|
128
|
+
controls the CLI server. Style-specific tiles, glyphs, and sprites are not preloaded.
|
|
129
|
+
|
|
111
130
|
Types are re-exported as well, so you can annotate call sites without depending on
|
|
112
131
|
`@maplibre/maplibre-gl-style-spec` resolution in your own tree:
|
|
113
132
|
|
|
@@ -139,10 +158,10 @@ All options can be set via CLI flag or environment variable.
|
|
|
139
158
|
| `--port <n>` | `CHIITILER_PORT` | `3000` |
|
|
140
159
|
| `--debug` | `CHIITILER_DEBUG` | `false` |
|
|
141
160
|
| `--user-agent <ua>` | `CHIITILER_USER_AGENT` | (none) |
|
|
142
|
-
|
|
|
161
|
+
| — | `CHIITILER_PREWARM` | `true` |
|
|
143
162
|
| — | `CHIITILER_PROCESSES` | `1` (set `0` for all CPUs) |
|
|
144
163
|
|
|
145
|
-
|
|
164
|
+
Prewarm is enabled by default: one tile is rendered at startup **before** the server starts listening, moving shared renderer initialization work into startup. Either `--no-prewarm` or `CHIITILER_PREWARM=false` disables it. Style-specific tiles, glyphs, and sprites are not preloaded.
|
|
146
165
|
|
|
147
166
|
### Cache
|
|
148
167
|
|
|
@@ -181,7 +200,7 @@ npm install
|
|
|
181
200
|
npm run dev # tsx watch mode
|
|
182
201
|
npm run test:unit # vitest
|
|
183
202
|
npm run test:integration # end-to-end
|
|
184
|
-
npm run test:benchmark # see BENCHMARK.md
|
|
203
|
+
npm run test:benchmark # see bench/BENCHMARK.md
|
|
185
204
|
npm run build # bundle to build/main.cjs
|
|
186
205
|
```
|
|
187
206
|
|
package/dist/cli.js
CHANGED
|
@@ -73,8 +73,8 @@ function parsePort(port) {
|
|
|
73
73
|
return 3000;
|
|
74
74
|
}
|
|
75
75
|
function parsePrewarm(prewarmFlag) {
|
|
76
|
-
//
|
|
77
|
-
return prewarmFlag
|
|
76
|
+
// Commander defaults a negated option to true; either opt-out disables warmup.
|
|
77
|
+
return prewarmFlag !== false && process.env.CHIITILER_PREWARM !== 'false';
|
|
78
78
|
}
|
|
79
79
|
function parseDebug(debug) {
|
|
80
80
|
// command-line option
|
|
@@ -106,7 +106,7 @@ export function createProgram() {
|
|
|
106
106
|
.option('--gcs-api-endpoint <api-endpoint>', 'gcs api endpoint', '')
|
|
107
107
|
.option('-p, --port <port>', 'port number')
|
|
108
108
|
.option('--user-agent <user-agent>', 'User-Agent header for outbound HTTP requests')
|
|
109
|
-
.option('--prewarm', '
|
|
109
|
+
.option('--no-prewarm', 'disable startup renderer warmup (enabled by default)')
|
|
110
110
|
.option('-D, --debug', 'debug mode')
|
|
111
111
|
.action(async (options) => {
|
|
112
112
|
// env fallback (CHIITILER_USER_AGENT) is handled in userAgent.ts
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare function getRenderedTileBuffer(options: GetRenderedTileOptions):
|
|
|
7
7
|
export { getRenderedTile as getRenderedTileStream };
|
|
8
8
|
export * as ChiitilerCache from './cache/index.js';
|
|
9
9
|
export { setUserAgent } from './source/userAgent.js';
|
|
10
|
+
export { prewarm } from './render/warmup.js';
|
|
10
11
|
export type { GetRenderedClipOptions, GetRenderedTileOptions, GetRenderedCameraOptions, SupportedFormat, } from './render/index.js';
|
|
11
12
|
export type { Cache } from './cache/index.js';
|
|
12
13
|
export type { StyleSpecification } from '@maplibre/maplibre-gl-style-spec';
|
package/dist/index.js
CHANGED
|
@@ -16,3 +16,4 @@ export async function getRenderedTileBuffer(options) {
|
|
|
16
16
|
export { getRenderedTile as getRenderedTileStream };
|
|
17
17
|
export * as ChiitilerCache from './cache/index.js';
|
|
18
18
|
export { setUserAgent } from './source/userAgent.js';
|
|
19
|
+
export { prewarm } from './render/warmup.js';
|
package/dist/render/warmup.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Cache } from '../cache/index.js';
|
|
2
2
|
/**
|
|
3
|
-
* Render
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Render and PNG-encode a minimal tile to warm shared renderer initialization.
|
|
4
|
+
* Await once per rendering process during application startup, before accepting
|
|
5
|
+
* requests. This does not preload style-specific tiles, glyphs, or sprites.
|
|
6
|
+
* Resolves after encoding finishes; rejects if rendering or encoding fails.
|
|
7
7
|
*/
|
|
8
8
|
declare function prewarm(cache: Cache): Promise<void>;
|
|
9
9
|
export { prewarm };
|
package/dist/render/warmup.js
CHANGED
|
@@ -13,10 +13,10 @@ const MINIMAL_STYLE = {
|
|
|
13
13
|
],
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* Render
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Render and PNG-encode a minimal tile to warm shared renderer initialization.
|
|
17
|
+
* Await once per rendering process during application startup, before accepting
|
|
18
|
+
* requests. This does not preload style-specific tiles, glyphs, or sprites.
|
|
19
|
+
* Resolves after encoding finishes; rejects if rendering or encoding fails.
|
|
20
20
|
*/
|
|
21
21
|
async function prewarm(cache) {
|
|
22
22
|
const sharp = await getRenderedTile({
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "chiitiler",
|
|
4
|
-
"version": "1.23.
|
|
4
|
+
"version": "1.23.7",
|
|
5
5
|
"description": "Tiny map rendering server for MapLibre Style Spec",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -24,31 +24,31 @@
|
|
|
24
24
|
"url": "https://github.com/Kanahiro/chiitiler"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@tsconfig/node24": "^24.0.
|
|
27
|
+
"@tsconfig/node24": "^24.0.5",
|
|
28
28
|
"@types/autocannon": "^7.12.7",
|
|
29
|
-
"@types/node": "^25.6
|
|
29
|
+
"@types/node": "^25.9.6",
|
|
30
30
|
"@vitest/coverage-v8": "^4.1.4",
|
|
31
31
|
"autocannon": "^8.0.0",
|
|
32
|
-
"esbuild": "^0.28.
|
|
32
|
+
"esbuild": "^0.28.2",
|
|
33
33
|
"image-size": "^2.0.2",
|
|
34
|
-
"tsx": "^4.
|
|
34
|
+
"tsx": "^4.23.13",
|
|
35
35
|
"typescript": "^6.0.3",
|
|
36
36
|
"vitest": "^4.1.4"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@aws-sdk/client-s3": "^3.
|
|
40
|
-
"@google-cloud/storage": "^7.
|
|
41
|
-
"@hono/node-server": "^2.
|
|
39
|
+
"@aws-sdk/client-s3": "^3.1131.0",
|
|
40
|
+
"@google-cloud/storage": "^7.22.0",
|
|
41
|
+
"@hono/node-server": "^2.1.1",
|
|
42
42
|
"@mapbox/tilebelt": "^2.0.3",
|
|
43
43
|
"@maplibre/maplibre-gl-native": "^6.4.1",
|
|
44
44
|
"@maplibre/maplibre-gl-style-spec": "^26.4.2",
|
|
45
45
|
"commander": "^14.0.3",
|
|
46
46
|
"file-system-cache": "^2.4.7",
|
|
47
47
|
"higuruma": "^0.1.6",
|
|
48
|
-
"hono": "^4.
|
|
49
|
-
"lightning-pool": "^4.
|
|
50
|
-
"lru-cache": "^11.
|
|
51
|
-
"pmtiles": "^4.
|
|
52
|
-
"sharp": "^0.35.
|
|
48
|
+
"hono": "^4.13.7",
|
|
49
|
+
"lightning-pool": "^4.14.0",
|
|
50
|
+
"lru-cache": "^11.5.2",
|
|
51
|
+
"pmtiles": "^4.5.0",
|
|
52
|
+
"sharp": "^0.35.4"
|
|
53
53
|
}
|
|
54
54
|
}
|