@maplibre-yaml/core 0.2.2 → 0.3.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/LICENSE.md +21 -0
- package/README.md +44 -16
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +197 -73
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +1 -9
- package/dist/index.js +207 -94
- package/dist/index.js.map +1 -1
- package/dist/{map-renderer-SjO3KQmx.d.ts → map-renderer-4FF3EmBO.d.ts} +130 -3
- package/dist/register.browser.js +6029 -7035
- package/dist/register.browser.js.map +1 -1
- package/dist/register.d.ts +1 -1
- package/dist/register.js +197 -73
- package/dist/register.js.map +1 -1
- package/dist/schemas/index.js +24 -2
- package/dist/schemas/index.js.map +1 -1
- package/package.json +17 -12
- package/register.js +8 -0
package/dist/schemas/index.js
CHANGED
|
@@ -102,8 +102,30 @@ var GeoJSONSourceSchema = z.object({
|
|
|
102
102
|
generateId: z.boolean().optional(),
|
|
103
103
|
promoteId: z.union([z.string(), z.record(z.string())]).optional(),
|
|
104
104
|
attribution: z.string().optional()
|
|
105
|
-
}).passthrough().
|
|
106
|
-
|
|
105
|
+
}).passthrough().superRefine((d, ctx) => {
|
|
106
|
+
if (!d.url && !d.data && !d.prefetchedData) {
|
|
107
|
+
ctx.addIssue({
|
|
108
|
+
code: z.ZodIssueCode.custom,
|
|
109
|
+
message: 'GeoJSON source requires at least one of: url, data, or prefetchedData. Use "url" to fetch from an endpoint, "data" for inline GeoJSON, or "prefetchedData" for build-time fetched data.'
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (typeof d.data === "string" && /^(\.\.?|\/?src)\//.test(d.data)) {
|
|
114
|
+
ctx.addIssue({
|
|
115
|
+
code: z.ZodIssueCode.custom,
|
|
116
|
+
path: ["data"],
|
|
117
|
+
// Recommends `data: "/data/..."` rather than `url:` because the
|
|
118
|
+
// `url:` field is schema-validated with z.string().url(), which
|
|
119
|
+
// requires a fully-qualified URL (`https://...`) and rejects
|
|
120
|
+
// root-relative paths. MapLibre treats a string in `data:` as a
|
|
121
|
+
// URL and fetches it correctly. Until url: relaxes to accept
|
|
122
|
+
// root-relative paths (see follow-up), `data: "/path"` is the
|
|
123
|
+
// working pattern for files served from public/.
|
|
124
|
+
message: `GeoJSON source.data must be an inline GeoJSON object or a URL. "${d.data}" is a local source-directory path that won't resolve at runtime. Move the file to public/ and reference the public-served URL:
|
|
125
|
+
data: "/data/<filename>.geojson"
|
|
126
|
+
(\`url:\` requires a fully-qualified https:// URL and won't accept root-relative paths; use \`data:\` for runtime URLs to public assets.)`
|
|
127
|
+
});
|
|
128
|
+
}
|
|
107
129
|
});
|
|
108
130
|
var VectorSourceSchema = z.object({
|
|
109
131
|
type: z.literal("vector").describe("Source type"),
|