@tileflow/dev 0.1.0-alpha.4 → 0.1.0-alpha.40

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.
Files changed (45) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +257 -5
  3. package/THIRD_PARTY_NOTICES.md +309 -0
  4. package/dist/artifacts.d.ts +269 -0
  5. package/dist/artifacts.js +98 -0
  6. package/dist/chunk-AQUGMUZW.js +324 -0
  7. package/dist/chunk-AVJMTXW5.js +3147 -0
  8. package/dist/chunk-C4VPHZ3F.js +4062 -0
  9. package/dist/chunk-D4OE4ITL.js +13 -0
  10. package/dist/chunk-FOMTSCOP.js +671 -0
  11. package/dist/chunk-KDFTE4Q5.js +156 -0
  12. package/dist/chunk-ONYQNLNA.js +1108 -0
  13. package/dist/chunk-RTU7TD4M.js +172 -0
  14. package/dist/chunk-XHJBCVBB.js +241 -0
  15. package/dist/config.d.ts +33 -0
  16. package/dist/config.js +27 -0
  17. package/dist/fonts.d.ts +47 -0
  18. package/dist/fonts.js +16 -0
  19. package/dist/icons-BIHpw5Zy.d.ts +417 -0
  20. package/dist/icons.d.ts +3 -0
  21. package/dist/icons.js +41 -0
  22. package/dist/inspect.d.ts +149 -0
  23. package/dist/inspect.js +805 -0
  24. package/dist/inspector-browser.js +16955 -0
  25. package/dist/inspector-observer.js +95 -0
  26. package/dist/preview-assets-ATLLYY72.js +103 -0
  27. package/dist/preview.d.ts +31 -0
  28. package/dist/preview.js +1972 -0
  29. package/dist/server.d.ts +89 -0
  30. package/dist/server.js +3657 -0
  31. package/dist/tilesets.d.ts +89 -0
  32. package/dist/tilesets.js +6 -0
  33. package/dist/validation.d.ts +65 -0
  34. package/dist/validation.js +24 -0
  35. package/package.json +77 -13
  36. package/ui-fonts/hubot-sans-OFL.txt +93 -0
  37. package/ui-fonts/hubot-sans.woff2 +0 -0
  38. package/ui-fonts/inter-OFL.txt +92 -0
  39. package/ui-fonts/inter.woff2 +0 -0
  40. package/ui-fonts/jetbrains-mono-OFL.txt +93 -0
  41. package/ui-fonts/jetbrains-mono.woff2 +0 -0
  42. package/ui-fonts/mona-sans-OFL.txt +93 -0
  43. package/ui-fonts/mona-sans.woff2 +0 -0
  44. package/dist/index.d.ts +0 -54
  45. package/dist/index.js +0 -314
@@ -0,0 +1,172 @@
1
+ // src/asset-directories.ts
2
+ import { realpath, stat } from "fs/promises";
3
+ import { createRequire } from "module";
4
+ import { dirname, isAbsolute, relative, resolve, sep } from "path";
5
+ import {
6
+ isTileflowLocalDirectory,
7
+ tileflowLocalDirectoryMessage
8
+ } from "@tileflow/core";
9
+ var TileflowAssetDirectoryError = class extends Error {
10
+ code = "ASSET_DIRECTORY_INVALID";
11
+ issues;
12
+ phase = "asset-directory-resolution";
13
+ constructor(kind, issues) {
14
+ super(
15
+ [
16
+ `Invalid Tileflow ${kind} directories`,
17
+ ...issues.map((issue) => `- ${issue.path}: ${issue.message}`)
18
+ ].join("\n")
19
+ );
20
+ this.name = "TileflowAssetDirectoryError";
21
+ this.issues = issues;
22
+ }
23
+ };
24
+ async function resolveTileflowAssetDirectories(directories, options) {
25
+ const issues = [];
26
+ let realCwd;
27
+ let realBaseDirectory;
28
+ try {
29
+ realCwd = await realpath(options.cwd);
30
+ if (!(await stat(realCwd)).isDirectory()) throw new Error("Working tree is not a directory");
31
+ } catch (error) {
32
+ throw new TileflowAssetDirectoryError(options.kind, [
33
+ { message: filesystemMessage(error, "Selected working tree was not found"), path: "cwd" }
34
+ ]);
35
+ }
36
+ try {
37
+ realBaseDirectory = await realpath(options.baseDirectory ?? options.cwd);
38
+ if (!(await stat(realBaseDirectory)).isDirectory()) {
39
+ throw new Error("Config base is not a directory");
40
+ }
41
+ if (!isPathInside(realCwd, realBaseDirectory)) {
42
+ throw new Error("Config base directory escapes the selected working tree");
43
+ }
44
+ } catch (error) {
45
+ throw new TileflowAssetDirectoryError(options.kind, [
46
+ {
47
+ message: filesystemMessage(error, "Config base directory was not found"),
48
+ path: "baseDirectory"
49
+ }
50
+ ]);
51
+ }
52
+ const result = [];
53
+ const seen = /* @__PURE__ */ new Map();
54
+ for (const [index, directory] of directories.entries()) {
55
+ const configPath = `${options.configPath}.${index + (options.ordinalOffset ?? 0)}`;
56
+ let candidate;
57
+ let containmentRoot;
58
+ let packageOwned = false;
59
+ if (typeof directory === "string") {
60
+ if (!isTileflowLocalDirectory(directory)) {
61
+ issues.push({
62
+ message: tileflowLocalDirectoryMessage,
63
+ path: configPath
64
+ });
65
+ continue;
66
+ }
67
+ candidate = resolve(realBaseDirectory, directory);
68
+ containmentRoot = realCwd;
69
+ } else if (isPackageDirectory(directory)) {
70
+ packageOwned = true;
71
+ let packageRoot;
72
+ try {
73
+ validatePackageDirectory(directory);
74
+ const requireFromProject = createRequire(
75
+ resolve(realBaseDirectory, "__tileflow_config__.cjs")
76
+ );
77
+ let packageJson;
78
+ try {
79
+ packageJson = requireFromProject.resolve(`${directory.package}/package.json`);
80
+ } catch {
81
+ packageJson = createRequire(import.meta.url).resolve(`${directory.package}/package.json`);
82
+ }
83
+ packageRoot = dirname(packageJson);
84
+ containmentRoot = await realpath(packageRoot);
85
+ candidate = resolve(containmentRoot, ...directory.path.split("/"));
86
+ } catch (error) {
87
+ issues.push({
88
+ message: error instanceof Error ? error.message : "Package directory could not be resolved",
89
+ path: configPath
90
+ });
91
+ continue;
92
+ }
93
+ } else {
94
+ issues.push({
95
+ message: "Expected a relative directory or imported package-directory descriptor",
96
+ path: configPath
97
+ });
98
+ continue;
99
+ }
100
+ try {
101
+ const realCandidate = await realpath(candidate);
102
+ if (!(await stat(realCandidate)).isDirectory()) {
103
+ throw new Error("Asset source must be a directory");
104
+ }
105
+ if (!isPathInside(containmentRoot, realCandidate)) {
106
+ throw new Error(
107
+ packageOwned ? "Package asset directory escapes its installed package" : "Asset directory escapes the selected working tree"
108
+ );
109
+ }
110
+ if (options.target === "hosted" && !packageOwned && !isPathInside(realCwd, realCandidate)) {
111
+ throw new Error("Hosted asset directories must remain inside the selected working tree");
112
+ }
113
+ const previous = seen.get(realCandidate);
114
+ if (previous) {
115
+ issues.push({ message: `Directory duplicates ${previous}`, path: configPath });
116
+ continue;
117
+ }
118
+ seen.set(realCandidate, configPath);
119
+ result.push({
120
+ authoring: directory,
121
+ configPath,
122
+ containmentRoot,
123
+ packageOwned,
124
+ realPath: realCandidate,
125
+ watch: !packageOwned || isPathInside(realCwd, realCandidate) && !realCandidate.split(/[\\/]/u).includes("node_modules")
126
+ });
127
+ } catch (error) {
128
+ issues.push({
129
+ message: filesystemMessage(error, "Asset directory was not found"),
130
+ path: configPath
131
+ });
132
+ }
133
+ }
134
+ if (issues.length > 0) throw new TileflowAssetDirectoryError(options.kind, issues);
135
+ return result;
136
+ }
137
+ function isPackageDirectory(value) {
138
+ return Boolean(
139
+ value && typeof value === "object" && !Array.isArray(value) && Object.getPrototypeOf(value) === Object.prototype && value.kind === "package-directory"
140
+ );
141
+ }
142
+ function validatePackageDirectory(directory) {
143
+ const keys = Object.keys(directory).sort();
144
+ if (keys.join(",") !== "kind,package,path") {
145
+ throw new Error("Package directory accepts exactly kind, package, and path");
146
+ }
147
+ if (!/^(?:@[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._-]*|[a-z0-9][a-z0-9._-]*)$/u.test(
148
+ directory.package
149
+ )) {
150
+ throw new Error("Package directory has an invalid npm package name");
151
+ }
152
+ if (!directory.path || directory.path.startsWith("/") || directory.path.includes("\\") || directory.path.split("/").some((segment) => !segment || segment === "." || segment === "..")) {
153
+ throw new Error("Package directory path must be a portable package-relative path");
154
+ }
155
+ }
156
+ function isPathInside(root, candidate) {
157
+ const pathFromRoot = relative(root, candidate);
158
+ return pathFromRoot === "" || !isAbsolute(pathFromRoot) && pathFromRoot !== ".." && !pathFromRoot.startsWith(`..${sep}`);
159
+ }
160
+ function filesystemMessage(error, fallback) {
161
+ if (error && typeof error === "object" && "code" in error) {
162
+ const code = String(error.code ?? "");
163
+ if (code === "ENOENT") return fallback;
164
+ if (code === "EACCES" || code === "EPERM") return "Asset directory is not readable";
165
+ }
166
+ return error instanceof Error && error.message ? error.message : fallback;
167
+ }
168
+
169
+ export {
170
+ TileflowAssetDirectoryError,
171
+ resolveTileflowAssetDirectories
172
+ };
@@ -0,0 +1,241 @@
1
+ import {
2
+ sanitizeDiagnosticSecrets
3
+ } from "./chunk-KDFTE4Q5.js";
4
+
5
+ // src/validation.ts
6
+ import { realpathSync } from "fs";
7
+ import { isAbsolute, relative, resolve, sep, win32 } from "path";
8
+ import { compareCodeUnits } from "@tileflow/core";
9
+ import { TileflowNativeCompatibilityError } from "@tileflow/core/native-profile";
10
+ var tileflowCommandDocumentSchemaVersion = 1;
11
+ function createTileflowCommandSummary(input) {
12
+ return {
13
+ schemaVersion: tileflowCommandDocumentSchemaVersion,
14
+ command: normalizeCommandField(input.command, "command"),
15
+ ok: input.ok,
16
+ phase: normalizePhase(input.phase, "command"),
17
+ code: normalizeCode(input.code, input.ok ? "COMMAND_OK" : "COMMAND_FAILED"),
18
+ path: boundText(input.path ?? "", 300),
19
+ severity: input.severity,
20
+ message: boundText(input.message.replace(/[\r\n]+/gu, " ").trim(), 300),
21
+ suggestion: boundText(input.suggestion.replace(/[\r\n]+/gu, " ").trim(), 300)
22
+ };
23
+ }
24
+ function createTileflowStructuredDiagnostics(error, cwd, defaults) {
25
+ if (error instanceof TileflowNativeCompatibilityError) {
26
+ return error.issues.map((issue) => ({ ...issue }));
27
+ }
28
+ const inheritedCode = optionalField(error, "code");
29
+ const inheritedDomain = optionalField(error, "domain") ?? optionalField(error, "owner") ?? optionalNestedField(error, "domain") ?? optionalNestedField(error, "owner");
30
+ const inheritedLevel = optionalField(error, "level") ?? optionalNestedField(error, "level");
31
+ const inheritedMessage = optionalField(error, "message") ?? optionalNestedField(error, "message");
32
+ const inheritedPath = optionalField(error, "path") ?? optionalNestedField(error, "path");
33
+ const inheritedPhase = optionalField(error, "phase") ?? optionalNestedField(error, "phase");
34
+ const inheritedSeverity = optionalField(error, "severity") ?? optionalNestedField(error, "severity");
35
+ const inheritedSuggestion = optionalField(error, "suggestion") ?? optionalNestedField(error, "suggestion");
36
+ const inheritedTarget = optionalField(error, "target") ?? optionalNestedField(error, "target");
37
+ const issues = getIssues(error);
38
+ const candidates = issues.length ? issues : [
39
+ {
40
+ message: inheritedMessage ?? (error instanceof Error ? error.message : "The Tileflow command failed."),
41
+ path: inheritedPath ?? ""
42
+ }
43
+ ];
44
+ const diagnostics = candidates.map((issue) => {
45
+ const phase = normalizePhase(issue.phase ?? inheritedPhase, defaults.phase);
46
+ const code = normalizeCode(issue.code ?? inheritedCode, defaults.code);
47
+ const severity = normalizeSeverity(
48
+ issue.severity ?? issue.level ?? inheritedSeverity ?? inheritedLevel,
49
+ defaults.severity ?? "error"
50
+ );
51
+ const domain = sanitizeDiagnosticContext(issue.domain ?? issue.owner ?? inheritedDomain, cwd);
52
+ const target = sanitizeDiagnosticContext(issue.target ?? inheritedTarget, cwd);
53
+ const suggestion = issue.suggestion ?? inheritedSuggestion;
54
+ return {
55
+ phase,
56
+ code,
57
+ ...domain ? { domain } : {},
58
+ path: boundText(sanitizePath(issue.path ?? inheritedPath ?? "", cwd), 300),
59
+ ...target ? { target } : {},
60
+ severity,
61
+ message: boundText(sanitizeMessage(issue.message, cwd), 300),
62
+ suggestion: suggestion ? boundText(sanitizeMessage(suggestion, cwd), 300) : suggestionForDiagnostic(code, phase)
63
+ };
64
+ });
65
+ diagnostics.sort(compareDiagnostics);
66
+ return diagnostics.filter(
67
+ (diagnostic, index) => index === 0 || JSON.stringify(diagnostic) !== JSON.stringify(diagnostics[index - 1])
68
+ ).slice(0, 32);
69
+ }
70
+ function createTileflowCommandFailureDocument(command, error, cwd, defaults) {
71
+ const diagnostics = createTileflowStructuredDiagnostics(error, cwd, defaults);
72
+ const primary = diagnostics[0] ?? {
73
+ phase: normalizePhase(defaults.phase, "command"),
74
+ code: normalizeCode(defaults.code, "COMMAND_FAILED"),
75
+ path: "",
76
+ severity: defaults.severity ?? "error",
77
+ message: "The Tileflow command failed.",
78
+ suggestion: "Review the command input and run it again."
79
+ };
80
+ return {
81
+ schemaVersion: tileflowCommandDocumentSchemaVersion,
82
+ command: normalizeCommandField(command, "command"),
83
+ ok: false,
84
+ phase: primary.phase,
85
+ code: primary.code,
86
+ ...primary.domain ? { domain: primary.domain } : {},
87
+ path: primary.path,
88
+ ...primary.target ? { target: primary.target } : {},
89
+ severity: primary.severity,
90
+ message: primary.message,
91
+ suggestion: primary.suggestion,
92
+ diagnostics,
93
+ ...primary.renderer ? { renderer: primary.renderer, profile: primary.profile } : {}
94
+ };
95
+ }
96
+ function serializeTileflowCommandDocument(value) {
97
+ return `${JSON.stringify(value, null, 2)}
98
+ `;
99
+ }
100
+ function getIssues(error) {
101
+ if (!error || typeof error !== "object") return [];
102
+ const containers = [];
103
+ for (const key of ["diagnostics", "messages", "issues"]) {
104
+ const value = error[key];
105
+ if (Array.isArray(value)) containers.push(value);
106
+ }
107
+ const details = error.details;
108
+ if (details && typeof details === "object") {
109
+ const diagnostics = details.diagnostics;
110
+ if (Array.isArray(diagnostics)) containers.push(diagnostics);
111
+ }
112
+ return containers.flatMap(
113
+ (container) => container.flatMap((entry) => {
114
+ if (!entry || typeof entry !== "object") return [];
115
+ const candidate = entry;
116
+ if (typeof candidate.message !== "string") return [];
117
+ return [
118
+ {
119
+ ...typeof candidate.code === "string" ? { code: candidate.code } : {},
120
+ ...typeof candidate.domain === "string" ? { domain: candidate.domain } : {},
121
+ ...typeof candidate.level === "string" ? { level: candidate.level } : {},
122
+ message: candidate.message,
123
+ ...typeof candidate.owner === "string" ? { owner: candidate.owner } : {},
124
+ ...typeof candidate.path === "string" ? { path: candidate.path } : {},
125
+ ...typeof candidate.phase === "string" ? { phase: candidate.phase } : {},
126
+ ...typeof candidate.severity === "string" ? { severity: candidate.severity } : {},
127
+ ...typeof candidate.suggestion === "string" ? { suggestion: candidate.suggestion } : {},
128
+ ...typeof candidate.target === "string" ? { target: candidate.target } : {}
129
+ }
130
+ ];
131
+ })
132
+ );
133
+ }
134
+ function sanitizeMessage(value, cwd) {
135
+ let sanitized = value;
136
+ for (const root of localPathAliases(cwd)) sanitized = sanitized.replaceAll(root, ".");
137
+ sanitized = sanitized.replace(/[\r\n]+/gu, " ").trim();
138
+ sanitized = sanitized.replace(/https?:\/\/[^\s'")<>]+/giu, (url) => {
139
+ try {
140
+ return new URL(url.replace(/[),.;]+$/u, "")).origin;
141
+ } catch {
142
+ return "(resource URL)";
143
+ }
144
+ });
145
+ sanitized = sanitized.replace(/(^|[\s'"(])[A-Za-z]:[\\/][^\s'")]+/gu, "$1(external path)");
146
+ sanitized = sanitized.replace(/(^|[\s'"(])(?:\\\\|\/\/)[^\s'")]+/gu, "$1(external path)");
147
+ sanitized = sanitized.replace(/(^|[\s'"(])\/[^\s'")]+/gu, "$1(external path)");
148
+ return sanitizeDiagnosticSecrets(sanitized);
149
+ }
150
+ function sanitizePath(value, cwd) {
151
+ if (!value) return "";
152
+ if (win32.isAbsolute(value) && !isAbsolute(value)) return "(external)";
153
+ if (!isAbsolute(value)) return sanitizeDiagnosticSecrets(value.replaceAll("\\", "/"));
154
+ const local = relative(canonicalPath(cwd), canonicalPath(value)).replaceAll(sep, "/");
155
+ return local.startsWith("../") || local === ".." ? "(external)" : local || ".";
156
+ }
157
+ function sanitizeDiagnosticContext(value, cwd) {
158
+ if (!value) return void 0;
159
+ const sanitized = boundText(sanitizeMessage(value, cwd), 300);
160
+ return sanitized || void 0;
161
+ }
162
+ function localPathAliases(path) {
163
+ return [.../* @__PURE__ */ new Set([resolve(path), canonicalPath(path)])].sort(
164
+ (left, right) => right.length - left.length
165
+ );
166
+ }
167
+ function canonicalPath(path) {
168
+ try {
169
+ return realpathSync.native(resolve(path));
170
+ } catch {
171
+ return resolve(path);
172
+ }
173
+ }
174
+ function suggestionForDiagnostic(code, phase) {
175
+ if (code === "INVALID_TARGET" || phase === "command-validation") {
176
+ return "Use a documented command option and run the command again.";
177
+ }
178
+ if (phase === "config-load") {
179
+ return "Check the config path and its installed imports, then run the command again.";
180
+ }
181
+ if (phase === "config-validation" || code === "CONFIG_INVALID") {
182
+ return "Edit the reported config path to match the Tileflow config reference, then validate again.";
183
+ }
184
+ if (phase.includes("icon") || code.includes("ICON")) {
185
+ return "Fix the reported icon input and run validation again.";
186
+ }
187
+ if (phase.includes("font") || code.includes("FONT") || code.includes("GLYPH")) {
188
+ return "Fix the reported font or glyph input and run validation again.";
189
+ }
190
+ if (phase === "style-validation" || code === "STYLE_INVALID") {
191
+ return "Adjust the reported semantic map value and run validation again.";
192
+ }
193
+ if (phase === "hosted-validation" || code === "HOSTED_INCOMPATIBLE") {
194
+ return "Use a supported Hosted input or validate with the local target.";
195
+ }
196
+ if (phase === "config-inspection") {
197
+ return "Resolve the reported config diagnostic before inspecting the map again.";
198
+ }
199
+ return "Review the reported path and run the command again.";
200
+ }
201
+ function compareDiagnostics(left, right) {
202
+ return diagnosticSeverityRank(left.severity) - diagnosticSeverityRank(right.severity) || compareCodeUnits(left.path, right.path) || compareCodeUnits(left.domain ?? "", right.domain ?? "") || compareCodeUnits(left.target ?? "", right.target ?? "") || compareCodeUnits(left.phase, right.phase) || compareCodeUnits(left.code, right.code) || compareCodeUnits(left.message, right.message) || compareCodeUnits(left.suggestion, right.suggestion);
203
+ }
204
+ function diagnosticSeverityRank(severity) {
205
+ return severity === "error" ? 0 : severity === "warning" ? 1 : 2;
206
+ }
207
+ function normalizeSeverity(value, fallback) {
208
+ return value === "error" || value === "info" || value === "warning" ? value : fallback;
209
+ }
210
+ function normalizeCode(value, fallback) {
211
+ const normalized = sanitizeDiagnosticSecrets(value ?? fallback).toUpperCase().replace(/[^A-Z0-9_]/gu, "_").slice(0, 64);
212
+ return normalized || fallback;
213
+ }
214
+ function normalizePhase(value, fallback) {
215
+ const normalized = sanitizeDiagnosticSecrets(value ?? fallback).toLowerCase().replace(/[^a-z0-9-]/gu, "-").slice(0, 64);
216
+ return normalized || fallback;
217
+ }
218
+ function normalizeCommandField(value, fallback) {
219
+ const normalized = sanitizeDiagnosticSecrets(value).toLowerCase().replace(/[^a-z0-9 ._-]/gu, "").trim().slice(0, 64);
220
+ return normalized || fallback;
221
+ }
222
+ function optionalField(value, key) {
223
+ if (!value || typeof value !== "object") return void 0;
224
+ const field = value[key];
225
+ return typeof field === "string" && field.trim() ? field : void 0;
226
+ }
227
+ function optionalNestedField(value, key) {
228
+ if (!value || typeof value !== "object") return void 0;
229
+ return optionalField(value.details, key);
230
+ }
231
+ function boundText(value, limit) {
232
+ return value.length <= limit ? value : `${value.slice(0, limit - 1)}\u2026`;
233
+ }
234
+
235
+ export {
236
+ tileflowCommandDocumentSchemaVersion,
237
+ createTileflowCommandSummary,
238
+ createTileflowStructuredDiagnostics,
239
+ createTileflowCommandFailureDocument,
240
+ serializeTileflowCommandDocument
241
+ };
@@ -0,0 +1,33 @@
1
+ import { TileflowMap, ValidationMessage } from '@tileflow/core';
2
+ import { TileflowBuildCatalog } from '@tileflow/core/build';
3
+
4
+ declare const defaultTileflowApiUrl = "https://api.tileflow.dev";
5
+ declare const defaultTileflowConfigPath = "tileflow.config.ts";
6
+ declare const defaultTileflowManifestPath = "public/tileflow/manifest.json";
7
+ type LoadTileflowConfigOptions = {
8
+ cwd?: string;
9
+ fresh?: boolean;
10
+ };
11
+ type LoadedTileflowConfig = {
12
+ /** Tooling-only authoring definitions retained for resolved-config provenance. Never serialize. */
13
+ authoringMaps: Record<string, TileflowMap>;
14
+ /** Absolute executable config path. Asset directories resolve from its parent directory. */
15
+ configFile: string;
16
+ inputFiles: string[];
17
+ project: TileflowBuildCatalog;
18
+ };
19
+ declare class TileflowValidationError extends Error {
20
+ readonly code: "CONFIG_INVALID";
21
+ readonly messages: ValidationMessage[];
22
+ readonly phase: "config-validation";
23
+ constructor(messages: ValidationMessage[]);
24
+ }
25
+ declare function loadTileflowConfig(configPath?: string, options?: LoadTileflowConfigOptions): Promise<TileflowBuildCatalog>;
26
+ declare function loadTileflowConfigWithInputs(configPath?: string, options?: LoadTileflowConfigOptions): Promise<LoadedTileflowConfig>;
27
+ declare function loadValidTileflowConfig(configPath?: string, options?: LoadTileflowConfigOptions): Promise<TileflowBuildCatalog>;
28
+ declare function loadValidTileflowConfigWithInputs(configPath?: string, options?: LoadTileflowConfigOptions): Promise<LoadedTileflowConfig>;
29
+ declare function assertValidTileflowConfig(project: TileflowBuildCatalog): void;
30
+ declare function getTileflowMapNames(project: TileflowBuildCatalog): string[];
31
+ declare function getFirstTileflowMapName(project: TileflowBuildCatalog): string;
32
+
33
+ export { type LoadTileflowConfigOptions, type LoadedTileflowConfig, TileflowValidationError, assertValidTileflowConfig, defaultTileflowApiUrl, defaultTileflowConfigPath, defaultTileflowManifestPath, getFirstTileflowMapName, getTileflowMapNames, loadTileflowConfig, loadTileflowConfigWithInputs, loadValidTileflowConfig, loadValidTileflowConfigWithInputs };
package/dist/config.js ADDED
@@ -0,0 +1,27 @@
1
+ import {
2
+ TileflowValidationError,
3
+ assertValidTileflowConfig,
4
+ defaultTileflowApiUrl,
5
+ defaultTileflowConfigPath,
6
+ defaultTileflowManifestPath,
7
+ getFirstTileflowMapName,
8
+ getTileflowMapNames,
9
+ loadTileflowConfig,
10
+ loadTileflowConfigWithInputs,
11
+ loadValidTileflowConfig,
12
+ loadValidTileflowConfigWithInputs
13
+ } from "./chunk-AQUGMUZW.js";
14
+ import "./chunk-D4OE4ITL.js";
15
+ export {
16
+ TileflowValidationError,
17
+ assertValidTileflowConfig,
18
+ defaultTileflowApiUrl,
19
+ defaultTileflowConfigPath,
20
+ defaultTileflowManifestPath,
21
+ getFirstTileflowMapName,
22
+ getTileflowMapNames,
23
+ loadTileflowConfig,
24
+ loadTileflowConfigWithInputs,
25
+ loadValidTileflowConfig,
26
+ loadValidTileflowConfigWithInputs
27
+ };
@@ -0,0 +1,47 @@
1
+ import { TileflowFontBundleManifest, MapLibreStyle } from '@tileflow/core';
2
+ import { TileflowEffectiveFontSourceIdentity, TileflowBuildStyles, TileflowBuildCatalog } from '@tileflow/core/build';
3
+ import { T as TileflowBuildAsset } from './icons-BIHpw5Zy.js';
4
+
5
+ type TileflowFontCompilationTarget = 'hosted' | 'local';
6
+ type TileflowFontCompilationIssue = {
7
+ message: string;
8
+ path: string;
9
+ };
10
+ declare class TileflowFontCompilationError extends Error {
11
+ readonly code: "FONT_INVALID";
12
+ readonly issues: readonly TileflowFontCompilationIssue[];
13
+ readonly phase: "font-compilation";
14
+ constructor(issues: readonly TileflowFontCompilationIssue[]);
15
+ }
16
+ type PreparedTileflowStyleFonts = {
17
+ assets: TileflowBuildAsset[];
18
+ bundles: Record<string, CompiledTileflowFontBundle>;
19
+ sourceIdentities: Record<string, TileflowEffectiveFontSourceIdentity[]>;
20
+ styles: TileflowBuildStyles;
21
+ watchPaths: string[];
22
+ };
23
+ type CompiledTileflowFontBundle = {
24
+ contentHash: string;
25
+ files: TileflowBuildAsset[];
26
+ manifest: TileflowFontBundleManifest;
27
+ };
28
+ type PrepareTileflowStyleFontsOptions = {
29
+ assetBaseUrl: string;
30
+ baseDirectory?: string;
31
+ cwd: string;
32
+ target: TileflowFontCompilationTarget;
33
+ };
34
+ /** Resolve only mutable local font directories so failed builds can still be watched. */
35
+ declare function getTileflowFontWatchPaths(project: TileflowBuildCatalog, cwd: string, baseDirectory?: string): Promise<string[]>;
36
+ /**
37
+ * Prepare every map's ordered local font provider.
38
+ *
39
+ * OpenType full names are the canonical IDs consumed by `text-font`. Directories are applied from
40
+ * left to right, so a later directory replaces an earlier face only when that exact ID matches.
41
+ */
42
+ declare function prepareTileflowStyleFonts(project: TileflowBuildCatalog, inputStyles: Readonly<Record<string, Readonly<Record<string, MapLibreStyle>>>>, options: PrepareTileflowStyleFontsOptions): Promise<PreparedTileflowStyleFonts>;
43
+ /** Replace provisional local/preflight URLs with one exact Hosted bundle base URL. */
44
+ declare function bindTileflowStyleFontBundle(style: MapLibreStyle, bundle: CompiledTileflowFontBundle, publicBaseUrl: string): MapLibreStyle;
45
+ declare function replaceTileflowStyleFontSources(style: MapLibreStyle, replace: (source: string) => string): MapLibreStyle;
46
+
47
+ export { type CompiledTileflowFontBundle, type PrepareTileflowStyleFontsOptions, type PreparedTileflowStyleFonts, TileflowFontCompilationError, type TileflowFontCompilationIssue, type TileflowFontCompilationTarget, bindTileflowStyleFontBundle, getTileflowFontWatchPaths, prepareTileflowStyleFonts, replaceTileflowStyleFontSources };
package/dist/fonts.js ADDED
@@ -0,0 +1,16 @@
1
+ import {
2
+ TileflowFontCompilationError,
3
+ bindTileflowStyleFontBundle,
4
+ getTileflowFontWatchPaths,
5
+ prepareTileflowStyleFonts,
6
+ replaceTileflowStyleFontSources
7
+ } from "./chunk-FOMTSCOP.js";
8
+ import "./chunk-RTU7TD4M.js";
9
+ import "./chunk-D4OE4ITL.js";
10
+ export {
11
+ TileflowFontCompilationError,
12
+ bindTileflowStyleFontBundle,
13
+ getTileflowFontWatchPaths,
14
+ prepareTileflowStyleFonts,
15
+ replaceTileflowStyleFontSources
16
+ };