@geekmidas/manifest 10.0.0-alpha.167 → 10.0.0-alpha.168
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/dist/index.cjs +53 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -15
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +52 -15
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +52 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -33,13 +33,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
33
33
|
* this.
|
|
34
34
|
*/
|
|
35
35
|
const DEFAULT_POSTGRES_VERSION = 18;
|
|
36
|
+
/** Whether a declaration is built into a public bundle — a site or an app. */
|
|
37
|
+
function isPublicDeclaration(declaration) {
|
|
38
|
+
return declaration.kind === "site" || declaration.kind === "mobile-app";
|
|
39
|
+
}
|
|
36
40
|
/** A site's subdomain that means every subdomain — see `SiteDeclaration`. */
|
|
37
41
|
const WILDCARD_SUBDOMAIN = "*";
|
|
38
42
|
/**
|
|
39
43
|
* Whether a declaration is a site answering on every subdomain.
|
|
40
44
|
*/
|
|
41
45
|
function isWildcardSite(declaration) {
|
|
42
|
-
return declaration?.kind === "site" && declaration.subdomain === "*";
|
|
46
|
+
return declaration?.kind === "site" && "subdomain" in declaration && declaration.subdomain === "*";
|
|
43
47
|
}
|
|
44
48
|
/**
|
|
45
49
|
* What a `Telemetry` node provides to each process with an edge to it.
|
|
@@ -1008,6 +1012,47 @@ const PUBLIC_PREFIX = {
|
|
|
1008
1012
|
expo: "EXPO_PUBLIC_"
|
|
1009
1013
|
};
|
|
1010
1014
|
/**
|
|
1015
|
+
* Every public value a site's or a mobile app's edges reach — the one walk of
|
|
1016
|
+
* its edges that every target makes, so what a bundle inlines cannot differ
|
|
1017
|
+
* between `gkm dev`, a compose build and the AWS target.
|
|
1018
|
+
*
|
|
1019
|
+
* Each edge's `PUBLIC` roles, and, because a bucket and the file server over
|
|
1020
|
+
* it are one construct to a page:
|
|
1021
|
+
*
|
|
1022
|
+
* - an edge to a bucket (a full-stack site's `.dependsOn([assets.server])`)
|
|
1023
|
+
* also reaches each file server over it — its objects are shown from there;
|
|
1024
|
+
* - an edge to a file server also reaches its bucket's public values — where
|
|
1025
|
+
* the bucket signs the links to its private objects.
|
|
1026
|
+
*
|
|
1027
|
+
* A bucket's connection is never one: `PUBLIC.objects` does not list it.
|
|
1028
|
+
*/
|
|
1029
|
+
function publicValues(declaration, manifest) {
|
|
1030
|
+
const values = /* @__PURE__ */ new Map();
|
|
1031
|
+
const reach = (id) => {
|
|
1032
|
+
const target = manifest[id];
|
|
1033
|
+
if (!target) return;
|
|
1034
|
+
for (const role of PUBLIC[target.kind] ?? []) {
|
|
1035
|
+
const key = providedKeyFor(id, target.kind, role);
|
|
1036
|
+
values.set(key, {
|
|
1037
|
+
id,
|
|
1038
|
+
kind: target.kind,
|
|
1039
|
+
role,
|
|
1040
|
+
key
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
};
|
|
1044
|
+
for (const edge of declaration.dependencies) {
|
|
1045
|
+
const target = manifest[edge.target];
|
|
1046
|
+
if (!target) continue;
|
|
1047
|
+
reach(edge.target);
|
|
1048
|
+
if (target.kind === "objects") {
|
|
1049
|
+
for (const [id, other] of Object.entries(manifest)) if (other.kind === "file-server" && other.of === edge.target) reach(id);
|
|
1050
|
+
}
|
|
1051
|
+
if (target.kind === "file-server") reach(target.of);
|
|
1052
|
+
}
|
|
1053
|
+
return [...values.values()];
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1011
1056
|
* The keys a site's bundle needs, mapped to the key each value comes from —
|
|
1012
1057
|
* `{ VITE_API_URL: 'API_URL' }` — its edges' public values, and a site's own
|
|
1013
1058
|
* address (`{ VITE_WEB_URL: 'WEB_URL' }`).
|
|
@@ -1030,31 +1075,14 @@ function publicEnvFor(declaration, manifest) {
|
|
|
1030
1075
|
const prefix = PUBLIC_PREFIX[declaration.variant];
|
|
1031
1076
|
const keys = {};
|
|
1032
1077
|
if (declaration.kind === "site") {
|
|
1033
|
-
const own =
|
|
1078
|
+
const own = providedKeyFor(declaration.id, "site", "url");
|
|
1034
1079
|
keys[`${prefix}${own}`] = own;
|
|
1035
1080
|
}
|
|
1036
1081
|
if (isWildcardSite(declaration)) for (const role of ["domain", "protectedSubdomains"]) {
|
|
1037
|
-
const key =
|
|
1082
|
+
const key = providedKeyFor(declaration.id, "site", role);
|
|
1038
1083
|
keys[`${prefix}${key}`] = key;
|
|
1039
1084
|
}
|
|
1040
|
-
const
|
|
1041
|
-
for (const role of PUBLIC[target.kind] ?? []) {
|
|
1042
|
-
const key = providedKeyFor(id, target.kind, role);
|
|
1043
|
-
keys[`${prefix}${key}`] = key;
|
|
1044
|
-
}
|
|
1045
|
-
};
|
|
1046
|
-
for (const edge of declaration.dependencies) {
|
|
1047
|
-
const target = manifest[edge.target];
|
|
1048
|
-
if (!target) continue;
|
|
1049
|
-
inline(edge.target, target);
|
|
1050
|
-
if (target.kind === "objects") {
|
|
1051
|
-
for (const [id, other] of Object.entries(manifest)) if (other.kind === "file-server" && other.of === edge.target) inline(id, other);
|
|
1052
|
-
}
|
|
1053
|
-
if (target.kind === "file-server") {
|
|
1054
|
-
const bucket = manifest[target.of];
|
|
1055
|
-
if (bucket) inline(target.of, bucket);
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1085
|
+
for (const { key } of publicValues(declaration, manifest)) keys[`${prefix}${key}`] = key;
|
|
1058
1086
|
return keys;
|
|
1059
1087
|
}
|
|
1060
1088
|
/**
|
|
@@ -1069,25 +1097,11 @@ const IMAGE_ORIGINS_KEY = "GKM_IMAGE_ORIGINS";
|
|
|
1069
1097
|
/**
|
|
1070
1098
|
* The keys whose values are the origins a site's pages load files from: each
|
|
1071
1099
|
* file server it reaches, and where each bucket it reaches signs its links —
|
|
1072
|
-
* by either edge,
|
|
1100
|
+
* by either edge, read off {@link publicValues}. Sorted, so the
|
|
1073
1101
|
* value composed from them does not churn.
|
|
1074
1102
|
*/
|
|
1075
1103
|
function imageOriginSources(declaration, manifest) {
|
|
1076
|
-
|
|
1077
|
-
const bucket = (id) => sources.add(providedKeyFor(id, "objects", "signedOrigin"));
|
|
1078
|
-
const server = (id) => sources.add(providedKeyFor(id, "file-server", "url"));
|
|
1079
|
-
for (const edge of declaration.dependencies) {
|
|
1080
|
-
const target = manifest[edge.target];
|
|
1081
|
-
if (target?.kind === "objects") {
|
|
1082
|
-
bucket(edge.target);
|
|
1083
|
-
for (const [id, other] of Object.entries(manifest)) if (other.kind === "file-server" && other.of === edge.target) server(id);
|
|
1084
|
-
}
|
|
1085
|
-
if (target?.kind === "file-server") {
|
|
1086
|
-
server(edge.target);
|
|
1087
|
-
if (manifest[target.of]?.kind === "objects") bucket(target.of);
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
return [...sources].sort();
|
|
1104
|
+
return publicValues(declaration, manifest).filter(({ kind, role }) => kind === "file-server" && role === "url" || kind === "objects" && role === "signedOrigin").map(({ key }) => key).sort();
|
|
1091
1105
|
}
|
|
1092
1106
|
/**
|
|
1093
1107
|
* {@link IMAGE_ORIGINS_KEY}'s value: the origin of each source that resolved,
|
|
@@ -1569,6 +1583,7 @@ exports.imageOriginSources = imageOriginSources;
|
|
|
1569
1583
|
exports.imageOrigins = imageOrigins;
|
|
1570
1584
|
exports.inboxRecipient = inboxRecipient;
|
|
1571
1585
|
exports.isDerived = isDerived;
|
|
1586
|
+
exports.isPublicDeclaration = isPublicDeclaration;
|
|
1572
1587
|
exports.isWebOrigin = isWebOrigin;
|
|
1573
1588
|
exports.isWildcardSite = isWildcardSite;
|
|
1574
1589
|
exports.kebabCase = kebabCase;
|
|
@@ -1577,10 +1592,10 @@ exports.migrationFolder = migrationFolder;
|
|
|
1577
1592
|
exports.migrationTargets = migrationTargets;
|
|
1578
1593
|
exports.mobileOrigins = mobileOrigins;
|
|
1579
1594
|
exports.parseApiGatewayWebSocketUrl = parseApiGatewayWebSocketUrl;
|
|
1580
|
-
exports.provideKey = provideKey;
|
|
1581
1595
|
exports.providedKeyFor = providedKeyFor;
|
|
1582
1596
|
exports.provisionOrder = provisionOrder;
|
|
1583
1597
|
exports.publicEnvFor = publicEnvFor;
|
|
1598
|
+
exports.publicValues = publicValues;
|
|
1584
1599
|
exports.receiptRecipients = receiptRecipients;
|
|
1585
1600
|
exports.schemeBase = schemeBase;
|
|
1586
1601
|
exports.scopedName = scopedName;
|