@tutti-os/app-release-tools 0.0.11 → 0.0.13
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/build-tutti-app-release.mjs +30 -11
- package/package.json +1 -1
|
@@ -176,16 +176,28 @@ function validateManifestReferences(references, sourceLabel) {
|
|
|
176
176
|
if (references === undefined) {
|
|
177
177
|
return;
|
|
178
178
|
}
|
|
179
|
-
if (
|
|
179
|
+
if (
|
|
180
|
+
!references ||
|
|
181
|
+
typeof references !== "object" ||
|
|
182
|
+
Array.isArray(references)
|
|
183
|
+
) {
|
|
180
184
|
throw new Error(`${sourceLabel} references must be an object`);
|
|
181
185
|
}
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
-
`${sourceLabel}.references.searchEndpoint`
|
|
186
|
+
const unsupportedKey = Object.keys(references).find(
|
|
187
|
+
(key) => key !== "listEndpoint"
|
|
185
188
|
);
|
|
186
|
-
if (
|
|
189
|
+
if (unsupportedKey) {
|
|
187
190
|
throw new Error(
|
|
188
|
-
`${sourceLabel}.references
|
|
191
|
+
`${sourceLabel}.references.${unsupportedKey} is unsupported`
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
const listEndpoint = requireNonEmpty(
|
|
195
|
+
references.listEndpoint,
|
|
196
|
+
`${sourceLabel}.references.listEndpoint`
|
|
197
|
+
);
|
|
198
|
+
if (!isRelativeURLPath(listEndpoint)) {
|
|
199
|
+
throw new Error(
|
|
200
|
+
`${sourceLabel}.references.listEndpoint must be a relative URL path without query or fragment`
|
|
189
201
|
);
|
|
190
202
|
}
|
|
191
203
|
}
|
|
@@ -520,14 +532,21 @@ function isRelativeURLPath(value) {
|
|
|
520
532
|
text === "" ||
|
|
521
533
|
!text.startsWith("/") ||
|
|
522
534
|
text.startsWith("//") ||
|
|
523
|
-
text.includes("\0")
|
|
524
|
-
text.includes("?") ||
|
|
525
|
-
text.includes("#") ||
|
|
526
|
-
text.includes("%")
|
|
535
|
+
text.includes("\0")
|
|
527
536
|
) {
|
|
528
537
|
return false;
|
|
529
538
|
}
|
|
530
|
-
|
|
539
|
+
try {
|
|
540
|
+
const parsed = new URL(text, "http://tutti.local");
|
|
541
|
+
return (
|
|
542
|
+
parsed.origin === "http://tutti.local" &&
|
|
543
|
+
parsed.pathname === text &&
|
|
544
|
+
parsed.search === "" &&
|
|
545
|
+
parsed.hash === ""
|
|
546
|
+
);
|
|
547
|
+
} catch {
|
|
548
|
+
return false;
|
|
549
|
+
}
|
|
531
550
|
}
|
|
532
551
|
|
|
533
552
|
function normalizeBaseUrl(value) {
|