@tileflow/dev 0.1.0-alpha.2 → 0.1.0-alpha.21
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/GENERATED_OUTPUT_LICENSE.md +21 -0
- package/LICENSE +201 -0
- package/NOTICE +9 -0
- package/README.md +547 -2
- package/THIRD_PARTY_NOTICES.md +69 -0
- package/TRADEMARKS.md +10 -0
- package/dist/artifacts.d.ts +191 -0
- package/dist/artifacts.js +71 -0
- package/dist/chunk-6MGFMKG3.js +284 -0
- package/dist/chunk-BL3FK4GO.js +170 -0
- package/dist/chunk-CENQR5Q2.js +844 -0
- package/dist/chunk-D4OE4ITL.js +13 -0
- package/dist/chunk-KDFTE4Q5.js +156 -0
- package/dist/chunk-KH7CMHT3.js +2069 -0
- package/dist/chunk-LNCTVFUD.js +236 -0
- package/dist/chunk-MIGBHCXX.js +4222 -0
- package/dist/chunk-MKPSQSMX.js +805 -0
- package/dist/chunk-ONYQNLNA.js +1108 -0
- package/dist/chunk-RSBV4L2Y.js +671 -0
- package/dist/chunk-XTRHREXO.js +1688 -0
- package/dist/config.d.ts +33 -0
- package/dist/config.js +27 -0
- package/dist/fonts.d.ts +47 -0
- package/dist/fonts.js +16 -0
- package/dist/icons.d.ts +136 -0
- package/dist/icons.js +17 -0
- package/dist/index.d.ts +13 -54
- package/dist/index.js +171 -297
- package/dist/inspect.d.ts +149 -0
- package/dist/inspect.js +18 -0
- package/dist/preview-assets-6LYL7GP7.js +145 -0
- package/dist/preview.d.ts +69 -0
- package/dist/preview.js +18 -0
- package/dist/server.d.ts +81 -0
- package/dist/server.js +48 -0
- package/dist/tilesets-C0tGeenP.d.ts +94 -0
- package/dist/tilesets.d.ts +1 -0
- package/dist/tilesets.js +6 -0
- package/dist/validation.d.ts +63 -0
- package/dist/validation.js +24 -0
- package/package.json +80 -7
package/dist/index.js
CHANGED
|
@@ -1,314 +1,188 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
async function writeTileflowBuildArtifacts(options) {
|
|
107
|
-
const cwd = options.cwd ?? process.cwd();
|
|
108
|
-
const outDir = resolve(cwd, options.outDir);
|
|
109
|
-
const stylesDir = resolve(outDir, "styles");
|
|
110
|
-
const artifacts = await createTileflowBuildArtifacts(options);
|
|
111
|
-
await mkdir(stylesDir, { recursive: true });
|
|
112
|
-
for (const [mapName, style] of Object.entries(artifacts.styles)) {
|
|
113
|
-
await writeFile(
|
|
114
|
-
resolve(stylesDir, `${mapName}.json`),
|
|
115
|
-
`${JSON.stringify(style, null, 2)}
|
|
116
|
-
`,
|
|
117
|
-
"utf8"
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
await writeFile(
|
|
121
|
-
resolve(outDir, "manifest.json"),
|
|
122
|
-
`${JSON.stringify(artifacts.manifest, null, 2)}
|
|
123
|
-
`,
|
|
124
|
-
"utf8"
|
|
125
|
-
);
|
|
126
|
-
return artifacts;
|
|
127
|
-
}
|
|
128
|
-
function createTileflowDevRequestHandler(options = {}) {
|
|
129
|
-
const basePath = normalizeTileflowBasePath(options.basePath);
|
|
130
|
-
const configPath = options.config ?? defaultTileflowConfigPath;
|
|
131
|
-
const cwd = options.cwd ?? process.cwd();
|
|
132
|
-
const tileBaseUrl = options.tileBaseUrl ?? defaultTileflowApiUrl;
|
|
133
|
-
return async function handleTileflowDevRequest(request) {
|
|
134
|
-
if (request.method !== "GET" && request.method !== "HEAD") {
|
|
135
|
-
return jsonResponse({ error: "Method not allowed" }, 405);
|
|
136
|
-
}
|
|
137
|
-
const url = new URL(request.url);
|
|
138
|
-
const path = stripTileflowBasePath(url.pathname, basePath);
|
|
139
|
-
if (path === null) {
|
|
140
|
-
return jsonResponse({ error: "Not found" }, 404);
|
|
141
|
-
}
|
|
142
|
-
try {
|
|
143
|
-
if (path === "/" || path === "") {
|
|
144
|
-
const project = await loadValidTileflowConfig(configPath, {
|
|
145
|
-
cwd,
|
|
146
|
-
fresh: true
|
|
147
|
-
});
|
|
148
|
-
return htmlResponse(
|
|
149
|
-
previewHtml(getFirstTileflowMapName(project), basePath)
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
if (path === "/manifest.json") {
|
|
153
|
-
const project = await loadValidTileflowConfig(configPath, {
|
|
154
|
-
cwd,
|
|
155
|
-
fresh: true
|
|
156
|
-
});
|
|
157
|
-
const styleBaseUrl = options.styleBaseUrl ?? `${url.origin}${basePath}`;
|
|
158
|
-
return jsonResponse(
|
|
159
|
-
createManifest(project, {
|
|
160
|
-
styleBaseUrl,
|
|
161
|
-
tileBaseUrl
|
|
162
|
-
})
|
|
163
|
-
);
|
|
164
|
-
}
|
|
165
|
-
if (path === "/style.json") {
|
|
166
|
-
const project = await loadValidTileflowConfig(configPath, {
|
|
167
|
-
cwd,
|
|
168
|
-
fresh: true
|
|
169
|
-
});
|
|
170
|
-
return jsonResponse(
|
|
171
|
-
createStyleFromProject(project, getFirstTileflowMapName(project), {
|
|
172
|
-
tileBaseUrl
|
|
173
|
-
})
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
if (path.startsWith("/styles/")) {
|
|
177
|
-
const project = await loadValidTileflowConfig(configPath, {
|
|
178
|
-
cwd,
|
|
179
|
-
fresh: true
|
|
180
|
-
});
|
|
181
|
-
const mapName = getTileflowStyleMapName(path);
|
|
182
|
-
if (!project.maps[mapName]) {
|
|
183
|
-
return jsonResponse({ error: `Unknown map: ${mapName}` }, 404);
|
|
184
|
-
}
|
|
185
|
-
return jsonResponse(
|
|
186
|
-
createStyleFromProject(project, mapName, {
|
|
187
|
-
tileBaseUrl
|
|
188
|
-
})
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
return jsonResponse({ error: "Not found" }, 404);
|
|
192
|
-
} catch (error) {
|
|
193
|
-
options.onError?.(error);
|
|
194
|
-
return tileflowErrorResponse(error);
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
function normalizeTileflowBasePath(value = "") {
|
|
199
|
-
const trimmed = value.trim().replace(/^\/+|\/+$/g, "");
|
|
200
|
-
return trimmed ? `/${trimmed}` : "";
|
|
201
|
-
}
|
|
202
|
-
function stripTileflowBasePath(pathname, basePath) {
|
|
203
|
-
if (!basePath) {
|
|
204
|
-
return pathname;
|
|
205
|
-
}
|
|
206
|
-
if (pathname === basePath) {
|
|
207
|
-
return "/";
|
|
208
|
-
}
|
|
209
|
-
if (pathname.startsWith(`${basePath}/`)) {
|
|
210
|
-
return pathname.slice(basePath.length);
|
|
211
|
-
}
|
|
212
|
-
return null;
|
|
213
|
-
}
|
|
214
|
-
function tileflowErrorResponse(error) {
|
|
215
|
-
if (error instanceof TileflowValidationError) {
|
|
216
|
-
return jsonResponse(
|
|
217
|
-
{
|
|
218
|
-
error: error.message,
|
|
219
|
-
messages: error.messages
|
|
220
|
-
},
|
|
221
|
-
400
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
const message = error instanceof Error ? error.message : "Unknown error";
|
|
225
|
-
return jsonResponse({ error: message }, 500);
|
|
226
|
-
}
|
|
227
|
-
function jsonResponse(body, status = 200) {
|
|
228
|
-
return new Response(`${JSON.stringify(body, null, 2)}
|
|
229
|
-
`, {
|
|
230
|
-
headers: {
|
|
231
|
-
"Access-Control-Allow-Origin": "*",
|
|
232
|
-
"Cache-Control": "no-store",
|
|
233
|
-
"Content-Type": "application/json; charset=utf-8"
|
|
234
|
-
},
|
|
235
|
-
status
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
function htmlResponse(body, status = 200) {
|
|
239
|
-
return new Response(body, {
|
|
240
|
-
headers: {
|
|
241
|
-
"Access-Control-Allow-Origin": "*",
|
|
242
|
-
"Cache-Control": "no-store",
|
|
243
|
-
"Content-Type": "text/html; charset=utf-8"
|
|
244
|
-
},
|
|
245
|
-
status
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
function previewHtml(mapName, basePath) {
|
|
249
|
-
const styleUrl = `${basePath}/styles/${mapName}.json`;
|
|
250
|
-
return `<!doctype html>
|
|
251
|
-
<html lang="en">
|
|
252
|
-
<head>
|
|
253
|
-
<meta charset="utf-8" />
|
|
254
|
-
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
255
|
-
<title>Tileflow Preview</title>
|
|
256
|
-
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
257
|
-
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
258
|
-
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap" rel="stylesheet" />
|
|
259
|
-
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css" />
|
|
260
|
-
<style>
|
|
261
|
-
html, body, #map { height: 100%; margin: 0; }
|
|
262
|
-
body { font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
|
|
263
|
-
.badge {
|
|
264
|
-
position: fixed;
|
|
265
|
-
left: 16px;
|
|
266
|
-
top: 16px;
|
|
267
|
-
z-index: 1;
|
|
268
|
-
border-radius: 8px;
|
|
269
|
-
background: rgba(246, 247, 243, 0.92);
|
|
270
|
-
border: 1px solid rgba(60, 64, 67, 0.12);
|
|
271
|
-
color: #3C4043;
|
|
272
|
-
padding: 10px 12px;
|
|
273
|
-
box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
|
|
274
|
-
}
|
|
275
|
-
</style>
|
|
276
|
-
</head>
|
|
277
|
-
<body>
|
|
278
|
-
<div class="badge">Tileflow preview</div>
|
|
279
|
-
<div id="map"></div>
|
|
280
|
-
<script type="module">
|
|
281
|
-
import maplibregl from "https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js";
|
|
282
|
-
|
|
283
|
-
const map = new maplibregl.Map({
|
|
284
|
-
container: "map",
|
|
285
|
-
style: "${styleUrl}",
|
|
286
|
-
center: [-3.7038, 40.4168],
|
|
287
|
-
zoom: 12
|
|
288
|
-
});
|
|
289
|
-
|
|
290
|
-
map.addControl(new maplibregl.NavigationControl(), "top-right");
|
|
291
|
-
</script>
|
|
292
|
-
</body>
|
|
293
|
-
</html>`;
|
|
294
|
-
}
|
|
2
|
+
TileflowConfigInspectionError,
|
|
3
|
+
inspectLoadedTileflowConfig,
|
|
4
|
+
inspectTileflowConfig,
|
|
5
|
+
inspectTileflowFeatures,
|
|
6
|
+
sanitizeTileflowInspectableValue
|
|
7
|
+
} from "./chunk-MKPSQSMX.js";
|
|
8
|
+
import {
|
|
9
|
+
createTileflowCommandFailureDocument,
|
|
10
|
+
createTileflowCommandSummary,
|
|
11
|
+
createTileflowStructuredDiagnostics,
|
|
12
|
+
serializeTileflowCommandDocument,
|
|
13
|
+
tileflowCommandDocumentSchemaVersion
|
|
14
|
+
} from "./chunk-LNCTVFUD.js";
|
|
15
|
+
import {
|
|
16
|
+
TileflowPreviewSelectionError,
|
|
17
|
+
normalizeTileflowLandmarkManifest,
|
|
18
|
+
readBoundedTileflowJsonResponse,
|
|
19
|
+
readBoundedTileflowResponse,
|
|
20
|
+
renderTileflowPreviewHtml,
|
|
21
|
+
resolveTileflowPreview
|
|
22
|
+
} from "./chunk-MIGBHCXX.js";
|
|
23
|
+
import {
|
|
24
|
+
createTileflowArtifactStatus,
|
|
25
|
+
createTileflowComparisonRequestHandler,
|
|
26
|
+
createTileflowDevRequestHandler,
|
|
27
|
+
createTileflowNodeRequest,
|
|
28
|
+
getTileflowRequestPath,
|
|
29
|
+
getTileflowStyleInspectionSelection,
|
|
30
|
+
getTileflowStyleSelection,
|
|
31
|
+
isTileflowRequestUrl,
|
|
32
|
+
tileflowComparisonSchemaVersion,
|
|
33
|
+
writeTileflowNodeResponse
|
|
34
|
+
} from "./chunk-KH7CMHT3.js";
|
|
35
|
+
import {
|
|
36
|
+
TileflowHostedManifestOverwriteError,
|
|
37
|
+
TileflowLocalTilesetProductionError,
|
|
38
|
+
assertNoLocalTilesetsForProduction,
|
|
39
|
+
assertTileflowSelfHostedManifestTarget,
|
|
40
|
+
createTileflowArtifactDiagnostics,
|
|
41
|
+
createTileflowArtifactPlan,
|
|
42
|
+
createTileflowArtifactSession,
|
|
43
|
+
createTileflowBuildArtifacts,
|
|
44
|
+
createTileflowBuildProvenance,
|
|
45
|
+
createTileflowManifest,
|
|
46
|
+
createTileflowStyle,
|
|
47
|
+
createTileflowStyles,
|
|
48
|
+
disposeTileflowBuildArtifacts,
|
|
49
|
+
getTileflowArtifactFiles,
|
|
50
|
+
getTileflowWatchPaths,
|
|
51
|
+
isTileflowArtifactInputPath,
|
|
52
|
+
prepareTileflowLocalTilesets,
|
|
53
|
+
refreshTileflowArtifactSession,
|
|
54
|
+
tileflowArtifactInventoryFileName,
|
|
55
|
+
tileflowArtifactPlanSchemaVersion,
|
|
56
|
+
tileflowArtifactSessionSchemaVersion,
|
|
57
|
+
writeTileflowArtifactPlan,
|
|
58
|
+
writeTileflowBuildArtifacts
|
|
59
|
+
} from "./chunk-XTRHREXO.js";
|
|
60
|
+
import {
|
|
61
|
+
inspectTileflowPmtiles,
|
|
62
|
+
inspectTileflowPmtilesForLocalUse
|
|
63
|
+
} from "./chunk-ONYQNLNA.js";
|
|
64
|
+
import {
|
|
65
|
+
TileflowFontCompilationError,
|
|
66
|
+
bindTileflowStyleFontBundle,
|
|
67
|
+
getTileflowAssetBasePath,
|
|
68
|
+
getTileflowAssetFileName,
|
|
69
|
+
getTileflowFontWatchPaths,
|
|
70
|
+
joinTileflowPublicUrl,
|
|
71
|
+
normalizeTileflowBasePath,
|
|
72
|
+
prepareTileflowStyleFonts,
|
|
73
|
+
replaceTileflowStyleFontSources,
|
|
74
|
+
resolveTileflowArtifactPublicUrls
|
|
75
|
+
} from "./chunk-RSBV4L2Y.js";
|
|
76
|
+
import {
|
|
77
|
+
TileflowIconCompilationError,
|
|
78
|
+
compileTileflowIconPackages,
|
|
79
|
+
getTileflowIconWatchPaths,
|
|
80
|
+
iconFileExtensions,
|
|
81
|
+
inspectTileflowIconCatalogs,
|
|
82
|
+
prepareTileflowCatalogIcons
|
|
83
|
+
} from "./chunk-CENQR5Q2.js";
|
|
84
|
+
import "./chunk-BL3FK4GO.js";
|
|
85
|
+
import {
|
|
86
|
+
TileflowStyleValidationError,
|
|
87
|
+
assertValidTileflowStyle,
|
|
88
|
+
sanitizeDiagnosticSecrets,
|
|
89
|
+
validateTileflowStyle
|
|
90
|
+
} from "./chunk-KDFTE4Q5.js";
|
|
91
|
+
import {
|
|
92
|
+
TileflowValidationError,
|
|
93
|
+
assertValidTileflowConfig,
|
|
94
|
+
defaultTileflowApiUrl,
|
|
95
|
+
defaultTileflowConfigPath,
|
|
96
|
+
defaultTileflowManifestPath,
|
|
97
|
+
getFirstTileflowMapName,
|
|
98
|
+
getTileflowMapNames,
|
|
99
|
+
loadTileflowConfig,
|
|
100
|
+
loadTileflowConfigWithInputs,
|
|
101
|
+
loadValidTileflowConfig,
|
|
102
|
+
loadValidTileflowConfigWithInputs
|
|
103
|
+
} from "./chunk-6MGFMKG3.js";
|
|
104
|
+
import "./chunk-D4OE4ITL.js";
|
|
295
105
|
export {
|
|
106
|
+
TileflowConfigInspectionError,
|
|
107
|
+
TileflowFontCompilationError,
|
|
108
|
+
TileflowHostedManifestOverwriteError,
|
|
109
|
+
TileflowIconCompilationError,
|
|
110
|
+
TileflowLocalTilesetProductionError,
|
|
111
|
+
TileflowPreviewSelectionError,
|
|
112
|
+
TileflowStyleValidationError,
|
|
296
113
|
TileflowValidationError,
|
|
297
|
-
|
|
114
|
+
assertNoLocalTilesetsForProduction,
|
|
115
|
+
assertTileflowSelfHostedManifestTarget,
|
|
298
116
|
assertValidTileflowConfig,
|
|
117
|
+
assertValidTileflowStyle,
|
|
118
|
+
bindTileflowStyleFontBundle,
|
|
119
|
+
compileTileflowIconPackages,
|
|
120
|
+
createTileflowArtifactDiagnostics,
|
|
121
|
+
createTileflowArtifactPlan,
|
|
122
|
+
createTileflowArtifactSession,
|
|
123
|
+
createTileflowArtifactStatus,
|
|
299
124
|
createTileflowBuildArtifacts,
|
|
125
|
+
createTileflowBuildProvenance,
|
|
126
|
+
createTileflowCommandFailureDocument,
|
|
127
|
+
createTileflowCommandSummary,
|
|
128
|
+
createTileflowComparisonRequestHandler,
|
|
300
129
|
createTileflowDevRequestHandler,
|
|
301
130
|
createTileflowManifest,
|
|
131
|
+
createTileflowNodeRequest,
|
|
132
|
+
createTileflowStructuredDiagnostics,
|
|
302
133
|
createTileflowStyle,
|
|
134
|
+
createTileflowStyles,
|
|
303
135
|
defaultTileflowApiUrl,
|
|
304
136
|
defaultTileflowConfigPath,
|
|
305
137
|
defaultTileflowManifestPath,
|
|
306
|
-
|
|
138
|
+
disposeTileflowBuildArtifacts,
|
|
307
139
|
getFirstTileflowMapName,
|
|
140
|
+
getTileflowArtifactFiles,
|
|
141
|
+
getTileflowAssetBasePath,
|
|
142
|
+
getTileflowAssetFileName,
|
|
143
|
+
getTileflowFontWatchPaths,
|
|
144
|
+
getTileflowIconWatchPaths,
|
|
308
145
|
getTileflowMapNames,
|
|
309
|
-
|
|
146
|
+
getTileflowRequestPath,
|
|
147
|
+
getTileflowStyleInspectionSelection,
|
|
148
|
+
getTileflowStyleSelection,
|
|
149
|
+
getTileflowWatchPaths,
|
|
150
|
+
iconFileExtensions,
|
|
151
|
+
inspectLoadedTileflowConfig,
|
|
152
|
+
inspectTileflowConfig,
|
|
153
|
+
inspectTileflowFeatures,
|
|
154
|
+
inspectTileflowIconCatalogs,
|
|
155
|
+
inspectTileflowPmtiles,
|
|
156
|
+
inspectTileflowPmtilesForLocalUse,
|
|
157
|
+
isTileflowArtifactInputPath,
|
|
158
|
+
isTileflowRequestUrl,
|
|
159
|
+
joinTileflowPublicUrl,
|
|
310
160
|
loadTileflowConfig,
|
|
161
|
+
loadTileflowConfigWithInputs,
|
|
311
162
|
loadValidTileflowConfig,
|
|
163
|
+
loadValidTileflowConfigWithInputs,
|
|
312
164
|
normalizeTileflowBasePath,
|
|
313
|
-
|
|
165
|
+
normalizeTileflowLandmarkManifest,
|
|
166
|
+
prepareTileflowCatalogIcons,
|
|
167
|
+
prepareTileflowLocalTilesets,
|
|
168
|
+
prepareTileflowStyleFonts,
|
|
169
|
+
readBoundedTileflowJsonResponse,
|
|
170
|
+
readBoundedTileflowResponse,
|
|
171
|
+
refreshTileflowArtifactSession,
|
|
172
|
+
renderTileflowPreviewHtml,
|
|
173
|
+
replaceTileflowStyleFontSources,
|
|
174
|
+
resolveTileflowArtifactPublicUrls,
|
|
175
|
+
resolveTileflowPreview,
|
|
176
|
+
sanitizeDiagnosticSecrets,
|
|
177
|
+
sanitizeTileflowInspectableValue,
|
|
178
|
+
serializeTileflowCommandDocument,
|
|
179
|
+
tileflowArtifactInventoryFileName,
|
|
180
|
+
tileflowArtifactPlanSchemaVersion,
|
|
181
|
+
tileflowArtifactSessionSchemaVersion,
|
|
182
|
+
tileflowCommandDocumentSchemaVersion,
|
|
183
|
+
tileflowComparisonSchemaVersion,
|
|
184
|
+
validateTileflowStyle,
|
|
185
|
+
writeTileflowArtifactPlan,
|
|
186
|
+
writeTileflowBuildArtifacts,
|
|
187
|
+
writeTileflowNodeResponse
|
|
314
188
|
};
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { TileflowThemeAuditDiagnostic, TileflowThemeColorScheme } from '@tileflow/core';
|
|
2
|
+
import { LoadTileflowConfigOptions, LoadedTileflowConfig } from './config.js';
|
|
3
|
+
import { TileflowCommandSummary, TileflowStructuredDiagnostic } from './validation.js';
|
|
4
|
+
import { TileflowPreparedMapAssets, TileflowBuildCatalog } from '@tileflow/core/build';
|
|
5
|
+
|
|
6
|
+
type TileflowFeatureInspectionOptions = {
|
|
7
|
+
apiBaseUrl?: string;
|
|
8
|
+
center: readonly [number, number];
|
|
9
|
+
fetch?: typeof fetch;
|
|
10
|
+
height?: number;
|
|
11
|
+
limit?: number;
|
|
12
|
+
properties?: readonly string[];
|
|
13
|
+
/** Build-owned assets required to compile the selected map exactly. */
|
|
14
|
+
preparedAssets?: TileflowPreparedMapAssets;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
sourceLayers: readonly string[];
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
width?: number;
|
|
19
|
+
zoom: number;
|
|
20
|
+
};
|
|
21
|
+
type TileflowInspectedProperty = boolean | number | string;
|
|
22
|
+
type TileflowInspectedFeature = {
|
|
23
|
+
sourceLayer: string;
|
|
24
|
+
id: number | null;
|
|
25
|
+
geometry: {
|
|
26
|
+
type: string;
|
|
27
|
+
center: [number, number];
|
|
28
|
+
bounds: [number, number, number, number];
|
|
29
|
+
};
|
|
30
|
+
properties: Record<string, TileflowInspectedProperty>;
|
|
31
|
+
};
|
|
32
|
+
type TileflowFeatureInspection = {
|
|
33
|
+
schemaVersion: 1;
|
|
34
|
+
map: string;
|
|
35
|
+
camera: {
|
|
36
|
+
center: [number, number];
|
|
37
|
+
zoom: number;
|
|
38
|
+
viewport: {
|
|
39
|
+
width: number;
|
|
40
|
+
height: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
source: {
|
|
44
|
+
id: string;
|
|
45
|
+
origin: string;
|
|
46
|
+
tileJsonPath: string | null;
|
|
47
|
+
tileOrigins: string[];
|
|
48
|
+
version: string | null;
|
|
49
|
+
};
|
|
50
|
+
sourceLayers: string[];
|
|
51
|
+
properties: string[];
|
|
52
|
+
tileZoom: number;
|
|
53
|
+
tilesRead: number;
|
|
54
|
+
scannedFeatures: number;
|
|
55
|
+
truncated: boolean;
|
|
56
|
+
features: TileflowInspectedFeature[];
|
|
57
|
+
};
|
|
58
|
+
declare function inspectTileflowFeatures(project: TileflowBuildCatalog, mapName: string, input: TileflowFeatureInspectionOptions): Promise<TileflowFeatureInspection>;
|
|
59
|
+
|
|
60
|
+
type TileflowConfigInspectionOptions = LoadTileflowConfigOptions & {
|
|
61
|
+
config?: string;
|
|
62
|
+
map?: string;
|
|
63
|
+
};
|
|
64
|
+
type TileflowMapLineageInspection = {
|
|
65
|
+
depth: number;
|
|
66
|
+
declaredPaths: string[];
|
|
67
|
+
id: string;
|
|
68
|
+
version: number;
|
|
69
|
+
};
|
|
70
|
+
type TileflowMapMergeProvenance = {
|
|
71
|
+
declared: boolean;
|
|
72
|
+
inherited: boolean;
|
|
73
|
+
operation: 'defined' | 'overridden';
|
|
74
|
+
path: string;
|
|
75
|
+
/** Stable root-to-leaf lineage depth; disambiguates repeated map ids. */
|
|
76
|
+
sourceDepth: number;
|
|
77
|
+
sourceMap: string;
|
|
78
|
+
};
|
|
79
|
+
type TileflowResolvedMapInspection = {
|
|
80
|
+
id: string;
|
|
81
|
+
lineage: TileflowMapLineageInspection[];
|
|
82
|
+
provenance: TileflowMapMergeProvenance[];
|
|
83
|
+
resolved: Record<string, unknown>;
|
|
84
|
+
themeContract: TileflowThemeContractInspection;
|
|
85
|
+
};
|
|
86
|
+
type TileflowThemeDifferenceInspection = {
|
|
87
|
+
from: unknown;
|
|
88
|
+
path: string;
|
|
89
|
+
to: unknown;
|
|
90
|
+
};
|
|
91
|
+
type TileflowThemeInspection = {
|
|
92
|
+
colorScheme: TileflowThemeColorScheme;
|
|
93
|
+
differencesFromDefault: TileflowThemeDifferenceInspection[];
|
|
94
|
+
id: string;
|
|
95
|
+
isDefault: boolean;
|
|
96
|
+
lighting: Record<string, unknown>;
|
|
97
|
+
name: string;
|
|
98
|
+
systemFor: TileflowThemeColorScheme[];
|
|
99
|
+
tokens: {
|
|
100
|
+
color: Record<string, string>;
|
|
101
|
+
font: Record<string, string>;
|
|
102
|
+
image: Record<string, string>;
|
|
103
|
+
number: Record<string, number>;
|
|
104
|
+
};
|
|
105
|
+
typography: Record<string, unknown>;
|
|
106
|
+
version: number;
|
|
107
|
+
};
|
|
108
|
+
type TileflowThemeContractInspection = {
|
|
109
|
+
audit: TileflowThemeAuditDiagnostic[];
|
|
110
|
+
defaultTheme: string;
|
|
111
|
+
systemThemes?: {
|
|
112
|
+
dark: string;
|
|
113
|
+
light: string;
|
|
114
|
+
};
|
|
115
|
+
themes: Record<string, TileflowThemeInspection>;
|
|
116
|
+
tokenSchema: {
|
|
117
|
+
color: string[];
|
|
118
|
+
font: string[];
|
|
119
|
+
image: string[];
|
|
120
|
+
number: string[];
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
type TileflowConfigInspection = TileflowCommandSummary & {
|
|
124
|
+
command: 'inspect';
|
|
125
|
+
ok: true;
|
|
126
|
+
maps: TileflowResolvedMapInspection[];
|
|
127
|
+
diagnostics: TileflowStructuredDiagnostic[];
|
|
128
|
+
};
|
|
129
|
+
/** Resolve a config once and expose only deterministic, secret-free authoring information. */
|
|
130
|
+
declare function inspectTileflowConfig(options?: TileflowConfigInspectionOptions): Promise<TileflowConfigInspection>;
|
|
131
|
+
declare function inspectLoadedTileflowConfig(loaded: LoadedTileflowConfig, options: {
|
|
132
|
+
cwd: string;
|
|
133
|
+
map?: string;
|
|
134
|
+
}): TileflowConfigInspection;
|
|
135
|
+
declare class TileflowConfigInspectionError extends Error {
|
|
136
|
+
readonly code: string;
|
|
137
|
+
readonly phase: "config-inspection";
|
|
138
|
+
readonly issues: Array<{
|
|
139
|
+
code: string;
|
|
140
|
+
message: string;
|
|
141
|
+
path: string;
|
|
142
|
+
phase: string;
|
|
143
|
+
}>;
|
|
144
|
+
constructor(code: string, message: string, path: string);
|
|
145
|
+
}
|
|
146
|
+
/** Sanitize a deterministic JSON-like authoring value for machine-facing CLI output. */
|
|
147
|
+
declare function sanitizeTileflowInspectableValue(value: unknown, cwd: string): unknown;
|
|
148
|
+
|
|
149
|
+
export { type TileflowConfigInspection, TileflowConfigInspectionError, type TileflowConfigInspectionOptions, type TileflowFeatureInspection, type TileflowFeatureInspectionOptions, type TileflowInspectedFeature, type TileflowInspectedProperty, type TileflowMapLineageInspection, type TileflowMapMergeProvenance, type TileflowResolvedMapInspection, type TileflowThemeContractInspection, type TileflowThemeDifferenceInspection, type TileflowThemeInspection, inspectLoadedTileflowConfig, inspectTileflowConfig, inspectTileflowFeatures, sanitizeTileflowInspectableValue };
|
package/dist/inspect.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TileflowConfigInspectionError,
|
|
3
|
+
inspectLoadedTileflowConfig,
|
|
4
|
+
inspectTileflowConfig,
|
|
5
|
+
inspectTileflowFeatures,
|
|
6
|
+
sanitizeTileflowInspectableValue
|
|
7
|
+
} from "./chunk-MKPSQSMX.js";
|
|
8
|
+
import "./chunk-LNCTVFUD.js";
|
|
9
|
+
import "./chunk-KDFTE4Q5.js";
|
|
10
|
+
import "./chunk-6MGFMKG3.js";
|
|
11
|
+
import "./chunk-D4OE4ITL.js";
|
|
12
|
+
export {
|
|
13
|
+
TileflowConfigInspectionError,
|
|
14
|
+
inspectLoadedTileflowConfig,
|
|
15
|
+
inspectTileflowConfig,
|
|
16
|
+
inspectTileflowFeatures,
|
|
17
|
+
sanitizeTileflowInspectableValue
|
|
18
|
+
};
|