@homepages/concrete 13.0.1 → 14.1.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/CHANGELOG.md +46 -0
- package/README.md +4 -5
- package/codemods/manifest.json +11 -0
- package/dist/artifact/playground/client/assets/index-DZbV6Ucf.js +1338 -0
- package/dist/artifact/playground/client/index.html +1 -1
- package/dist/artifact/playground/host.mjs +22 -22
- package/dist/cli/build/esbuild.js +42 -3
- package/dist/cli/build/manifest.js +1 -1
- package/dist/cli/build/record.js +5 -4
- package/dist/cli/build/sections.js +13 -6
- package/dist/cli/build/template-build.js +19 -9
- package/dist/cli/check/load-workspace.js +3 -6
- package/dist/cli/commands.js +63 -15
- package/dist/cli/media/deriver-plugin.js +36 -5
- package/dist/cli/publish/artifact.js +18 -40
- package/dist/cli/publish/fixtures.js +1 -1
- package/dist/cli/publish/index.js +90 -115
- package/dist/cli/publish/report.js +36 -56
- package/dist/cli/publish/send.js +142 -0
- package/dist/cli/publish/target.js +33 -31
- package/dist/cli/publish/verdict.js +65 -0
- package/dist/cli/release/client.js +69 -0
- package/dist/cli/release/index.js +143 -0
- package/dist/cli/release/report.js +73 -0
- package/dist/cli/upgrade/fixture-modules.js +3 -5
- package/dist/cli.js +1 -0
- package/dist/css/graph.js +29 -40
- package/dist/css/inline.js +2 -3
- package/dist/fixtures/media-plugin.js +7 -25
- package/dist/fixtures/package-stylesheets.js +12 -48
- package/dist/packages/external/concrete/package.js +1 -1
- package/dist/packages/internal/download-files/dist/capture-origin.js +5 -5
- package/dist/packages/internal/media-resolution/dist/image.js +43 -4
- package/dist/packages/internal/media-resolution/dist/list.js +4 -4
- package/dist/packages/internal/media-resolution/dist/media.js +2 -2
- package/dist/packages/internal/media-resolution/dist/slot.js +2 -2
- package/dist/packages/internal/playground/dist/fixture-formats.js +5 -1
- package/dist/packages/internal/playground/dist/host/built.js +4 -12
- package/dist/packages/internal/playground/dist/host/catalog-fixture.js +0 -1
- package/dist/packages/internal/playground/dist/host/download.js +1 -8
- package/dist/packages/internal/playground/dist/host/fixture-addresses.js +3 -4
- package/dist/packages/internal/playground/dist/host/program.js +1 -2
- package/dist/packages/internal/playground/dist/host/serve.js +4 -30
- package/dist/packages/internal/playground/dist/host/stored-fixtures.js +2 -9
- package/dist/packages/internal/playground/dist/layout.js +5 -5
- package/dist/packages/internal/playground/dist/send-wire.js +9 -0
- package/dist/packages/internal/playground/dist/server/changes.js +0 -1
- package/dist/packages/internal/playground/dist/server/listen.js +2 -19
- package/dist/packages/internal/playground/dist/server/playground-server.js +2 -3
- package/dist/packages/internal/property-facts/dist/registry-facts.js +0 -7
- package/dist/packages/internal/site-files/dist/site.js +4 -6
- package/dist/packages/internal/static-assets-binding/dist/index.js +2 -1
- package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +16 -4
- package/dist/packages/internal/template-artifact/dist/framework-floor.js +33 -0
- package/dist/packages/internal/template-artifact/dist/index.js +3 -3
- package/dist/packages/internal/template-artifact/dist/layout.js +7 -39
- package/dist/packages/internal/template-artifact/dist/manifest.js +1 -1
- package/dist/packages/internal/template-artifact/dist/verify.js +14 -57
- package/dist/packages/internal/template-contracts/dist/slot-catalog.js +8 -1
- package/dist/packages/internal/template-contracts/dist/tour-value.d.ts +1 -1
- package/dist/packages/internal/template-contracts/dist/video-value.d.ts +1 -1
- package/dist/template/logic-build.js +38 -19
- package/guide/reference/cli/INDEX.md +5 -4
- package/guide/reference/cli/build.md +1 -1
- package/guide/reference/cli/check.md +1 -1
- package/guide/reference/cli/dev.md +1 -1
- package/guide/reference/cli/install.md +1 -1
- package/guide/reference/cli/property-add.md +1 -1
- package/guide/reference/cli/property-list.md +1 -1
- package/guide/reference/cli/publish.md +17 -16
- package/guide/reference/cli/release.md +57 -0
- package/guide/reference/cli/upgrade.md +1 -1
- package/guide/reference/rules/INDEX.md +1 -1
- package/package.json +6 -4
- package/dist/artifact/playground/client/assets/index-Bmvcss4B.js +0 -1338
- package/dist/cli/publish/captures.js +0 -61
- package/dist/cli/publish/client.js +0 -118
- package/dist/cli/publish/pack.js +0 -77
- package/dist/cli/publish/playground.js +0 -27
- package/dist/cli/publish/wire.js +0 -23
|
@@ -74,15 +74,15 @@ async function serveRequest(input, documents, req, res) {
|
|
|
74
74
|
const contentType = route.contentType ?? stored.contentType ?? DEFAULT_CONTENT_TYPE;
|
|
75
75
|
const disposition = route.from === "media" && route.contentDisposition !== void 0 ? { "content-disposition": route.contentDisposition } : {};
|
|
76
76
|
if (isFilledText(route) && route.from === "build") {
|
|
77
|
-
let
|
|
77
|
+
let raw;
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
raw = await readBytes(stored.body);
|
|
80
80
|
} catch (err) {
|
|
81
81
|
input.onError?.(`capture origin could not read ${route.path}`, err);
|
|
82
82
|
res.writeHead(404).end();
|
|
83
83
|
return;
|
|
84
84
|
}
|
|
85
|
-
const body =
|
|
85
|
+
const body = fillBuildFile(route.filename, raw, input.bases.build).bytes;
|
|
86
86
|
res.writeHead(200, {
|
|
87
87
|
"content-type": contentType,
|
|
88
88
|
"content-length": body.byteLength
|
|
@@ -107,10 +107,10 @@ async function serveRequest(input, documents, req, res) {
|
|
|
107
107
|
res.destroy();
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
async function
|
|
110
|
+
async function readBytes(body) {
|
|
111
111
|
const chunks = [];
|
|
112
112
|
for await (const chunk of body) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
113
|
-
return Buffer.concat(chunks)
|
|
113
|
+
return Buffer.concat(chunks);
|
|
114
114
|
}
|
|
115
115
|
function closeServer(server) {
|
|
116
116
|
return new Promise((resolve, reject) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { processBindingsOf, processOf } from "../../template-contracts/dist/slot-catalog.js";
|
|
1
2
|
import { contentMediaIdOf, cropsPart } from "../../template-contracts/dist/registry-facts.js";
|
|
2
3
|
import { cropKeyOwner } from "./crop-key.js";
|
|
3
4
|
import { readLadder } from "./store.js";
|
|
@@ -78,10 +79,46 @@ function slotServedKey(v, mask, at) {
|
|
|
78
79
|
};
|
|
79
80
|
return (mask === null ? null : own(mask === "white" ? "mask_white" : "mask_black")) ?? own("cutout") ?? (mask === null ? slotCutKey(v, at) : null);
|
|
80
81
|
}
|
|
82
|
+
function sameCrop(a, b) {
|
|
83
|
+
if (a === null || b === null) return a === b;
|
|
84
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
85
|
+
}
|
|
86
|
+
function madeAt(rendition, crop) {
|
|
87
|
+
const over = rendition !== null && typeof rendition === "object" ? rendition.over : void 0;
|
|
88
|
+
return over !== null && typeof over === "object" && sameCrop(storedCrop(over.crop), crop);
|
|
89
|
+
}
|
|
90
|
+
function carriesCutAt(framing, photoId, crop) {
|
|
91
|
+
const renditions = framing.renditions && typeof framing.renditions === "object" ? framing.renditions : {};
|
|
92
|
+
const key = renditionKey(renditions.crop);
|
|
93
|
+
return key !== null && cropKeyOwner(key) === photoId && madeAt(renditions.crop, crop);
|
|
94
|
+
}
|
|
95
|
+
function declaresCutout(declaration) {
|
|
96
|
+
return processOf(processBindingsOf(declaration?.process), "cutout") !== void 0;
|
|
97
|
+
}
|
|
98
|
+
function noteOwedCutout(v, photoId, record, at, store) {
|
|
99
|
+
if (store.notePending === void 0 || record?.kind !== "image" || record.key === null) return;
|
|
100
|
+
const renditions = v.renditions && typeof v.renditions === "object" ? v.renditions : {};
|
|
101
|
+
const key = renditionKey(renditions.cutout);
|
|
102
|
+
if (!(key !== null && key.startsWith(`processed/cutout/${photoId}/`) && madeAt(renditions.cutout, framingCrop(v, at)))) store.notePending({
|
|
103
|
+
kind: "cutout",
|
|
104
|
+
id: photoId
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function noteOwedCuts(v, photoId, record, at, mask, store) {
|
|
108
|
+
if (store.notePending === void 0 || mask !== null || record?.kind !== "image") return;
|
|
109
|
+
const owes = (framing, crop) => cropsPart(crop) && !carriesCutAt(framing, photoId, crop);
|
|
110
|
+
const cutout = renditionKey((v.renditions && typeof v.renditions === "object" ? v.renditions : {}).cutout);
|
|
111
|
+
const desktop = cutout === null || !cutout.startsWith(`processed/cutout/${photoId}/`) ? owes(v, framingCrop(v, at)) : false;
|
|
112
|
+
const mobile = v.mobile && typeof v.mobile === "object" ? v.mobile : at === void 0 ? null : {};
|
|
113
|
+
if (desktop || mobile !== null && owes(mobile, framingCrop(mobile, at, "mobile"))) store.notePending({
|
|
114
|
+
kind: "cut",
|
|
115
|
+
id: photoId
|
|
116
|
+
});
|
|
117
|
+
}
|
|
81
118
|
function readMediaId(v) {
|
|
82
119
|
return contentMediaIdOf(v) ?? "";
|
|
83
120
|
}
|
|
84
|
-
async function resolveImageValue(value, records, store, aspects) {
|
|
121
|
+
async function resolveImageValue(value, records, store, aspects, cutsOut = false) {
|
|
85
122
|
if (value === null) return {
|
|
86
123
|
value: null,
|
|
87
124
|
desktopKey: null,
|
|
@@ -101,6 +138,8 @@ async function resolveImageValue(value, records, store, aspects) {
|
|
|
101
138
|
aspects,
|
|
102
139
|
imageAspect: imageAspectOf(record, ar)
|
|
103
140
|
};
|
|
141
|
+
if (photoId) noteOwedCuts(v, photoId, record, at, mask, store);
|
|
142
|
+
if (photoId && cutsOut) noteOwedCutout(v, photoId, record, at, store);
|
|
104
143
|
const mobileKey = photoId ? mobileCutKey(v, at) : null;
|
|
105
144
|
const mobile = mobileKey ? await mobileCropUrl(mobileKey, store) : null;
|
|
106
145
|
const alt = typeof v.alt === "string" ? v.alt : "";
|
|
@@ -162,11 +201,11 @@ async function attachResponsive(entries, store) {
|
|
|
162
201
|
}
|
|
163
202
|
}
|
|
164
203
|
}
|
|
165
|
-
async function resolveImageSlot(value, records, store, aspects) {
|
|
166
|
-
const entry = await resolveImageValue(value, records, store, aspects);
|
|
204
|
+
async function resolveImageSlot(value, records, store, aspects, cutsOut = false) {
|
|
205
|
+
const entry = await resolveImageValue(value, records, store, aspects, cutsOut);
|
|
167
206
|
await attachResponsive([entry], store);
|
|
168
207
|
return entry.value;
|
|
169
208
|
}
|
|
170
209
|
|
|
171
210
|
//#endregion
|
|
172
|
-
export { attachResponsive, emptyImage, mobileCutKey, resolveImageMedia, resolveImageSlot, resolveImageValue, servedKeyOf, slotCutKey };
|
|
211
|
+
export { attachResponsive, declaresCutout, emptyImage, mobileCutKey, resolveImageMedia, resolveImageSlot, resolveImageValue, servedKeyOf, slotCutKey };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveDocumentSlot } from "./document.js";
|
|
2
2
|
import { slotCropAspects } from "../../template-contracts/dist/content-pick.js";
|
|
3
|
-
import { attachResponsive, emptyImage, resolveImageValue } from "./image.js";
|
|
3
|
+
import { attachResponsive, declaresCutout, emptyImage, resolveImageValue } from "./image.js";
|
|
4
4
|
import { resolveTourSlot } from "./tour.js";
|
|
5
5
|
import { resolveVideoSlot } from "./video.js";
|
|
6
6
|
import { resolveMediaSlot } from "./media.js";
|
|
@@ -36,7 +36,7 @@ async function resolvePrimitiveItems(members, primitive, ctx, element) {
|
|
|
36
36
|
switch (primitive) {
|
|
37
37
|
case "image": {
|
|
38
38
|
const entries = [];
|
|
39
|
-
for (const member of members) entries.push(await resolveImageValue(member, ctx.records, ctx.store, slotCropAspects(element?.crop)));
|
|
39
|
+
for (const member of members) entries.push(await resolveImageValue(member, ctx.records, ctx.store, slotCropAspects(element?.crop), declaresCutout(element)));
|
|
40
40
|
await attachResponsive(entries, ctx.store);
|
|
41
41
|
return entries.map((entry) => entry.value ?? emptyImage());
|
|
42
42
|
}
|
|
@@ -84,7 +84,7 @@ async function resolveField(value, field, ctx, batch) {
|
|
|
84
84
|
if (itemContentOf(field) !== null) return resolveNestedList(value, field, ctx, batch);
|
|
85
85
|
switch (primitiveOf(field.type)) {
|
|
86
86
|
case "image": {
|
|
87
|
-
const entry = await resolveImageValue(value, ctx.records, ctx.store, slotCropAspects(field.crop));
|
|
87
|
+
const entry = await resolveImageValue(value, ctx.records, ctx.store, slotCropAspects(field.crop), declaresCutout(field));
|
|
88
88
|
batch.push(entry);
|
|
89
89
|
return entry.value;
|
|
90
90
|
}
|
|
@@ -103,7 +103,7 @@ async function resolveNestedList(value, field, ctx, batch) {
|
|
|
103
103
|
if (content.kind === "record") return resolveRecordRows(value, content.fields, ctx, batch);
|
|
104
104
|
if (content.primitive !== "image") return resolvePrimitiveItems(value, content.primitive, ctx, field.element);
|
|
105
105
|
const entries = [];
|
|
106
|
-
for (const member of value) entries.push(await resolveImageValue(member, ctx.records, ctx.store, slotCropAspects(field.element?.crop)));
|
|
106
|
+
for (const member of value) entries.push(await resolveImageValue(member, ctx.records, ctx.store, slotCropAspects(field.element?.crop), declaresCutout(field.element)));
|
|
107
107
|
batch.push(...entries);
|
|
108
108
|
return entries.map((entry) => entry.value ?? emptyImage());
|
|
109
109
|
}
|
|
@@ -2,7 +2,7 @@ import { declaredKinds } from "../../template-contracts/dist/slot-catalog.js";
|
|
|
2
2
|
import { contentMediaIdOf } from "../../template-contracts/dist/registry-facts.js";
|
|
3
3
|
import { resolveDocumentSlot } from "./document.js";
|
|
4
4
|
import { slotCropAspects } from "../../template-contracts/dist/content-pick.js";
|
|
5
|
-
import { resolveImageSlot } from "./image.js";
|
|
5
|
+
import { declaresCutout, resolveImageSlot } from "./image.js";
|
|
6
6
|
import { resolveTourSlot } from "./tour.js";
|
|
7
7
|
import { resolveVideoSlot } from "./video.js";
|
|
8
8
|
|
|
@@ -26,7 +26,7 @@ async function resolveMediaSlot(value, declaration, records, store) {
|
|
|
26
26
|
const reference = { media: mediaId };
|
|
27
27
|
switch (record.kind) {
|
|
28
28
|
case "image": {
|
|
29
|
-
const image = await resolveImageSlot(value, records, store, slotCropAspects(declaration.crop));
|
|
29
|
+
const image = await resolveImageSlot(value, records, store, slotCropAspects(declaration.crop), declaresCutout(declaration));
|
|
30
30
|
return image === null ? null : {
|
|
31
31
|
...image,
|
|
32
32
|
kind: "image"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveDocumentSlot } from "./document.js";
|
|
2
2
|
import { slotCropAspects } from "../../template-contracts/dist/content-pick.js";
|
|
3
|
-
import { resolveImageSlot } from "./image.js";
|
|
3
|
+
import { declaresCutout, resolveImageSlot } from "./image.js";
|
|
4
4
|
import { resolveTourSlot } from "./tour.js";
|
|
5
5
|
import { resolveVideoSlot } from "./video.js";
|
|
6
6
|
import { resolveMediaSlot } from "./media.js";
|
|
@@ -11,7 +11,7 @@ async function resolveSlotValue(value, slot, ctx) {
|
|
|
11
11
|
if (slot === void 0) return value;
|
|
12
12
|
if (itemContentOf(slot) !== null) return resolveListSlot(value, slot, ctx);
|
|
13
13
|
switch (slot.type) {
|
|
14
|
-
case "image": return resolveImageSlot(value, ctx.records, ctx.store, slotCropAspects(slot.crop));
|
|
14
|
+
case "image": return resolveImageSlot(value, ctx.records, ctx.store, slotCropAspects(slot.crop), declaresCutout(slot));
|
|
15
15
|
case "video": return resolveVideoSlot(value, ctx.records, ctx.store);
|
|
16
16
|
case "tour": return resolveTourSlot(value, ctx.records, ctx.store);
|
|
17
17
|
case "document": return resolveDocumentSlot(value, ctx.records, ctx.store);
|
|
@@ -3,7 +3,11 @@ import { listNamesProperties } from "./fixture-conversions/list-names-properties
|
|
|
3
3
|
|
|
4
4
|
//#region ../../internal/playground/dist/fixture-formats.js
|
|
5
5
|
const FIXTURES_ROOT = `${FIXTURES_DIR}/`;
|
|
6
|
+
const FIRST_FIXTURE_FORMAT = 1;
|
|
6
7
|
const FIXTURE_CONVERSIONS = [listNamesProperties];
|
|
8
|
+
function fixtureFormat(conversions = FIXTURE_CONVERSIONS) {
|
|
9
|
+
return 1 + conversions.length;
|
|
10
|
+
}
|
|
7
11
|
async function runFixtureConversion(conversion, files) {
|
|
8
12
|
const converted = await conversion.convert(files);
|
|
9
13
|
const seen = /* @__PURE__ */ new Set();
|
|
@@ -17,4 +21,4 @@ async function runFixtureConversion(conversion, files) {
|
|
|
17
21
|
}
|
|
18
22
|
|
|
19
23
|
//#endregion
|
|
20
|
-
export { FIXTURE_CONVERSIONS, runFixtureConversion };
|
|
24
|
+
export { FIXTURE_CONVERSIONS, fixtureFormat, runFixtureConversion };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SECTION_FILES, builtTreePath, sectionPath } from "../../../template-artifact/dist/layout.js";
|
|
2
|
+
import { CANVAS_ISLAND_HOST } from "../layout.js";
|
|
2
3
|
import { readBuild as readBuild$1 } from "../../../template-artifact/dist/build.js";
|
|
3
4
|
import { ROUTES } from "../wire.js";
|
|
4
5
|
|
|
@@ -99,7 +100,7 @@ function builtIslands(env, binding, buildBase) {
|
|
|
99
100
|
const importMap = Object.fromEntries(Object.entries(vendor).map(([specifier, ref]) => [specifier, url(ref.filename)]));
|
|
100
101
|
return {
|
|
101
102
|
map,
|
|
102
|
-
canvasHost: env.url(
|
|
103
|
+
canvasHost: env.url(CANVAS_ISLAND_HOST),
|
|
103
104
|
importMap,
|
|
104
105
|
documentLoader: {
|
|
105
106
|
kind: "bundles",
|
|
@@ -110,14 +111,6 @@ function builtIslands(env, binding, buildBase) {
|
|
|
110
111
|
}
|
|
111
112
|
};
|
|
112
113
|
}
|
|
113
|
-
function shippedHalf(env) {
|
|
114
|
-
const { captures } = env;
|
|
115
|
-
if (captures === void 0) return {};
|
|
116
|
-
return {
|
|
117
|
-
captured: () => captures.fixtures(),
|
|
118
|
-
shipped: (path) => captures.read(path)
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
114
|
function builtEnv(env) {
|
|
122
115
|
let read = null;
|
|
123
116
|
let held = null;
|
|
@@ -167,8 +160,7 @@ function builtEnv(env) {
|
|
|
167
160
|
template: async () => (await current()).template,
|
|
168
161
|
islands: async (buildBase) => builtIslands(env, (await current()).binding, buildBase),
|
|
169
162
|
computes: async (key) => computesAt(await current(), key),
|
|
170
|
-
binding: async () => (await current()).binding
|
|
171
|
-
...shippedHalf(env)
|
|
163
|
+
binding: async () => (await current()).binding
|
|
172
164
|
},
|
|
173
165
|
site: {
|
|
174
166
|
binding: async () => (await current()).binding,
|
|
@@ -33,7 +33,6 @@ function catalogFixture(plan, property, fixture) {
|
|
|
33
33
|
return {
|
|
34
34
|
name: fixture.id,
|
|
35
35
|
doc: docFingerprint(fixture.instances),
|
|
36
|
-
...fixture.capturable === false ? { capturable: false } : {},
|
|
37
36
|
...pagesOff.length > 0 ? { pagesOff } : {},
|
|
38
37
|
addresses: fixtureAddresses(plan, property, fixture)
|
|
39
38
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { addressComplete, addressView, normalizeAddressValue } from "../../../template-contracts/dist/address-value.js";
|
|
2
|
-
import { CAPTURE_FILES } from "../../../template-artifact/dist/layout.js";
|
|
3
2
|
|
|
4
3
|
//#region ../../internal/playground/dist/host/download.js
|
|
5
4
|
const PAGE_IMAGE = ".png";
|
|
@@ -18,12 +17,6 @@ function propertyAddressOf(facts) {
|
|
|
18
17
|
function attachmentDisposition(name) {
|
|
19
18
|
return `attachment; filename*=UTF-8''${encodeURIComponent(name)}`;
|
|
20
19
|
}
|
|
21
|
-
function shippedDownloadPath(input) {
|
|
22
|
-
const at = `${input.fixture}/${input.format}/`;
|
|
23
|
-
if (input.file.contentType === "application/pdf") return `${at}${CAPTURE_FILES.document}`;
|
|
24
|
-
if (input.file.contentType === "application/zip") return `${at}${CAPTURE_FILES.bundle}`;
|
|
25
|
-
return `${at}${input.file.page ?? ""}${PAGE_IMAGE}`;
|
|
26
|
-
}
|
|
27
20
|
function correctedDownloadLocation(url, named, owner) {
|
|
28
21
|
const from = `/properties/${encodeURIComponent(named)}/content/`;
|
|
29
22
|
const at = url.pathname.lastIndexOf(from);
|
|
@@ -31,4 +24,4 @@ function correctedDownloadLocation(url, named, owner) {
|
|
|
31
24
|
}
|
|
32
25
|
|
|
33
26
|
//#endregion
|
|
34
|
-
export { attachmentDisposition, correctedDownloadLocation, parseDownloadPath, propertyAddressOf
|
|
27
|
+
export { attachmentDisposition, correctedDownloadLocation, parseDownloadPath, propertyAddressOf };
|
|
@@ -30,20 +30,19 @@ function fixtureAddresses(plan, property, fixture) {
|
|
|
30
30
|
format: format.id,
|
|
31
31
|
href: ROUTES.canvas(property, fixture.id, c.id, format.id)
|
|
32
32
|
})));
|
|
33
|
-
if (!
|
|
34
|
-
const pageImages = plan.downloads === "made" || template.output === "image";
|
|
33
|
+
if (!plan.downloads || pages.length === 0) return { canvas };
|
|
35
34
|
return {
|
|
36
35
|
canvas,
|
|
37
36
|
download: template.formats.map((format) => ({
|
|
38
37
|
format: format.id,
|
|
39
38
|
href: ROUTES.download(property, fixture.id, { format: format.id }),
|
|
40
|
-
pages:
|
|
39
|
+
pages: pages.map((page) => ({
|
|
41
40
|
page: page.id,
|
|
42
41
|
href: ROUTES.download(property, fixture.id, {
|
|
43
42
|
format: format.id,
|
|
44
43
|
page: page.id
|
|
45
44
|
})
|
|
46
|
-
}))
|
|
45
|
+
}))
|
|
47
46
|
}))
|
|
48
47
|
};
|
|
49
48
|
}
|
|
@@ -15,7 +15,7 @@ import { rowImageUploadSave } from "./row-images.js";
|
|
|
15
15
|
import { fixtureMedia, fixtureOwnedMedia, laidValues, propertyContacts, propertyMediaItems, propertyMediaLists, settledComputed, slotProvenance } from "./slots.js";
|
|
16
16
|
import { parseSaveRequest, saveDocuments } from "./save.js";
|
|
17
17
|
import { linkSave, parseLibraryRequest, removeSave, uploadSave } from "./media-saves.js";
|
|
18
|
-
import {
|
|
18
|
+
import { propertyAddressOf } from "./download.js";
|
|
19
19
|
import { OUTPUT_FOLDERS, ROUTES, parseOutputPath } from "../wire.js";
|
|
20
20
|
import { fixtureOperation, parseFixtureOperation } from "./fixture-operations.js";
|
|
21
21
|
import { downloadFilename, downloadStem } from "../../../download-files/dist/names.js";
|
|
@@ -324,7 +324,7 @@ function serveHost(mount, mountedAt = "/") {
|
|
|
324
324
|
function addressPlan(template) {
|
|
325
325
|
return {
|
|
326
326
|
template,
|
|
327
|
-
downloads: template.output
|
|
327
|
+
downloads: template.output !== "website" && downloads === true
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
330
|
async function catalog() {
|
|
@@ -393,7 +393,7 @@ function serveHost(mount, mountedAt = "/") {
|
|
|
393
393
|
},
|
|
394
394
|
properties: markedProperties(listed.properties.map((property) => catalogProperty(addressPlan(template), listed, property)), jobs === void 0 ? [] : await jobs.list(), (operation) => jobs?.mark(operation)),
|
|
395
395
|
capabilities: {
|
|
396
|
-
download: addressPlan(template).downloads
|
|
396
|
+
download: addressPlan(template).downloads,
|
|
397
397
|
save: saves !== void 0,
|
|
398
398
|
upload: saves !== void 0
|
|
399
399
|
},
|
|
@@ -882,32 +882,6 @@ function serveHost(mount, mountedAt = "/") {
|
|
|
882
882
|
file: asked.file
|
|
883
883
|
};
|
|
884
884
|
}
|
|
885
|
-
async function shippedDownload(at, url) {
|
|
886
|
-
const named = parseDownloadPath(at.rest);
|
|
887
|
-
if (named === null) throw new HostRefusal(404, `There is no download at ${url.pathname}.`);
|
|
888
|
-
const asked = await askedDownload({
|
|
889
|
-
property: at.property,
|
|
890
|
-
fixture: at.fixture,
|
|
891
|
-
format: url.searchParams.get("format"),
|
|
892
|
-
page: named.page
|
|
893
|
-
});
|
|
894
|
-
if (asked.subject.property !== at.property) return new Response(null, {
|
|
895
|
-
status: 308,
|
|
896
|
-
headers: { location: correctedDownloadLocation(url, at.property, asked.subject.property) }
|
|
897
|
-
});
|
|
898
|
-
if (reader.shipped === void 0) throw new HostRefusal(501, "This playground makes no downloads.");
|
|
899
|
-
const path = shippedDownloadPath({
|
|
900
|
-
fixture: asked.fixture.id,
|
|
901
|
-
format: asked.format.id,
|
|
902
|
-
file: asked.file
|
|
903
|
-
});
|
|
904
|
-
const bytes = await reader.shipped(path);
|
|
905
|
-
if (bytes === null) throw new HostRefusal(404, `This publish shipped no ${path.slice(path.indexOf("/") + 1)} for the fixture "${asked.fixture.id}", or a save since has changed it.`);
|
|
906
|
-
return new Response(new Uint8Array(bytes), { headers: {
|
|
907
|
-
"content-type": asked.file.contentType,
|
|
908
|
-
"content-disposition": attachmentDisposition(asked.file.name)
|
|
909
|
-
} });
|
|
910
|
-
}
|
|
911
885
|
async function route(request, url, path) {
|
|
912
886
|
if (path === ROUTES.jobs || path.startsWith(`${ROUTES.jobs}/`)) return jobRoute(request, url, path);
|
|
913
887
|
if (path === "api/probe") return probe(request, url);
|
|
@@ -926,7 +900,7 @@ function serveHost(mount, mountedAt = "/") {
|
|
|
926
900
|
if (path === "api/requirements") return jsonResponse(await requirements(url));
|
|
927
901
|
if (path === "api/facts") return jsonResponse(await facts(url));
|
|
928
902
|
const site = parseOutputPath(path);
|
|
929
|
-
if (site?.output === OUTPUT_FOLDERS.download && site.rest[0] !== ASSETS)
|
|
903
|
+
if (site?.output === OUTPUT_FOLDERS.download && site.rest[0] !== ASSETS) throw new HostRefusal(501, "This playground makes no downloads.");
|
|
930
904
|
if (site?.output === OUTPUT_FOLDERS.site) return siteFile(request, url, site);
|
|
931
905
|
return null;
|
|
932
906
|
}
|
|
@@ -83,7 +83,7 @@ function fixtureReads(env, view, sizes) {
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
function storedFixtures(input) {
|
|
86
|
-
const { env, built
|
|
86
|
+
const { env, built } = input;
|
|
87
87
|
let cached = null;
|
|
88
88
|
const load = async (view) => {
|
|
89
89
|
const build = await built.readAt(view);
|
|
@@ -101,14 +101,7 @@ function storedFixtures(input) {
|
|
|
101
101
|
listedIn: LISTED_IN,
|
|
102
102
|
placements
|
|
103
103
|
});
|
|
104
|
-
const
|
|
105
|
-
const fixtures = loaded.fixtures.map((fixture) => {
|
|
106
|
-
const hosted = hostFixtureOf(fixture, (url) => sizes.get(url));
|
|
107
|
-
return captured === void 0 ? hosted : {
|
|
108
|
-
...hosted,
|
|
109
|
-
capturable: captured.has(fixture.id)
|
|
110
|
-
};
|
|
111
|
-
});
|
|
104
|
+
const fixtures = loaded.fixtures.map((fixture) => hostFixtureOf(fixture, (url) => sizes.get(url)));
|
|
112
105
|
return {
|
|
113
106
|
properties: loaded.properties.map((property) => hostPropertyOf(property, (url) => sizes.get(url))),
|
|
114
107
|
fixtures,
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { PLAYGROUND_CLIENT_DIR, PLAYGROUND_DIR } from "../../template-artifact/dist/layout.js";
|
|
2
|
-
import "../../template-artifact/dist/index.js";
|
|
3
1
|
import { resolve } from "node:path";
|
|
4
2
|
|
|
5
3
|
//#region ../../internal/playground/dist/layout.js
|
|
4
|
+
const CLIENT_DIR = "client";
|
|
5
|
+
const CANVAS_ISLAND_HOST = "island-canvas-host.mjs";
|
|
6
6
|
function playgroundDistDir(packageRoot) {
|
|
7
|
-
return resolve(packageRoot, "dist", "artifact",
|
|
7
|
+
return resolve(packageRoot, "dist", "artifact", "playground");
|
|
8
8
|
}
|
|
9
9
|
function playgroundClientDir(playgroundDir) {
|
|
10
|
-
return resolve(playgroundDir,
|
|
10
|
+
return resolve(playgroundDir, CLIENT_DIR);
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
//#endregion
|
|
14
|
-
export { playgroundClientDir, playgroundDistDir };
|
|
14
|
+
export { CANVAS_ISLAND_HOST, playgroundClientDir, playgroundDistDir };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region ../../internal/playground/dist/send-wire.js
|
|
2
|
+
const CONSOLE_KEY_HEADER = "console-key";
|
|
3
|
+
const SEND_ROUTE = "/api/sends";
|
|
4
|
+
const CONTENT_ROUTE = "/api/contents/";
|
|
5
|
+
const VERDICT_ROUTE = "/api/verdicts";
|
|
6
|
+
const RELEASE_ROUTE = "/api/releases";
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
export { CONSOLE_KEY_HEADER, CONTENT_ROUTE, RELEASE_ROUTE, SEND_ROUTE, VERDICT_ROUTE };
|
|
@@ -1,23 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "node:net";
|
|
2
2
|
|
|
3
3
|
//#region ../../internal/playground/dist/server/listen.js
|
|
4
|
-
function probe(port) {
|
|
5
|
-
return new Promise((resolveProbe) => {
|
|
6
|
-
const server = createServer();
|
|
7
|
-
server.once("error", () => resolveProbe(null));
|
|
8
|
-
server.listen(port, () => {
|
|
9
|
-
const address = server.address();
|
|
10
|
-
server.close(() => resolveProbe(typeof address === "object" && address !== null ? address.port : null));
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
async function freeDevPort() {
|
|
15
|
-
for (let attempt = 0; attempt < 20; attempt += 1) {
|
|
16
|
-
const port = await probe(0);
|
|
17
|
-
if (port !== null) return port;
|
|
18
|
-
}
|
|
19
|
-
throw new Error("no free port for the dev server");
|
|
20
|
-
}
|
|
21
4
|
function listenRefusal(err, what) {
|
|
22
5
|
if (err.code === "EADDRINUSE") return /* @__PURE__ */ new Error(`${what} is already in use — pick another with --port <n>`);
|
|
23
6
|
if (err.code === "EACCES") return /* @__PURE__ */ new Error(`${what} is reserved or not permitted on this machine — pick another with --port <n>`);
|
|
@@ -35,4 +18,4 @@ function listenOn(server, port, what) {
|
|
|
35
18
|
}
|
|
36
19
|
|
|
37
20
|
//#endregion
|
|
38
|
-
export {
|
|
21
|
+
export { listenOn, listenRefusal };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TEMPLATE_FILES, browserFiles, builtTreePath, templatePath } from "../../../template-artifact/dist/layout.js";
|
|
2
|
-
import {
|
|
2
|
+
import { fillBuildFile } from "../../../static-assets-binding/dist/section-asset-url.js";
|
|
3
3
|
import { playgroundClientDir } from "../layout.js";
|
|
4
4
|
import { parseDownloadPath } from "../host/download.js";
|
|
5
5
|
import { OUTPUT_FOLDERS, ROUTES, parseOutputPath } from "../wire.js";
|
|
@@ -320,8 +320,7 @@ async function sendBuiltFile(ctx, filename, res, buildBase = `${ctx.base}${BUILD
|
|
|
320
320
|
return;
|
|
321
321
|
}
|
|
322
322
|
res.setHeader("cache-control", "no-cache");
|
|
323
|
-
|
|
324
|
-
sendBytes(res, contentTypeFor(at), bytes);
|
|
323
|
+
sendBytes(res, contentTypeFor(at), fillBuildFile(filename, read.bytes, buildBase).bytes);
|
|
325
324
|
}
|
|
326
325
|
async function sendFixtureMedia(ctx, req, url, res) {
|
|
327
326
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
@@ -178,13 +178,6 @@ const MediaReferenceSchema = z.object({
|
|
|
178
178
|
crop: CropSchema.nullable().optional(),
|
|
179
179
|
renditions: placeRenditions.partial().strict().optional()
|
|
180
180
|
}).strict();
|
|
181
|
-
const StoredHomeValueSchema = z.object({
|
|
182
|
-
id: z.string(),
|
|
183
|
-
file: z.string(),
|
|
184
|
-
crop: CropSchema.nullable(),
|
|
185
|
-
name: z.string().nullable(),
|
|
186
|
-
renditions: placeRenditions.partial().strict()
|
|
187
|
-
}).strict();
|
|
188
181
|
const REGISTRIES = {
|
|
189
182
|
property: propertyFacts,
|
|
190
183
|
library: libraryFacts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { assetContentType } from "../../template-artifact/dist/asset-mime.js";
|
|
2
2
|
import { assetPath, boundFiles } from "../../template-artifact/dist/layout.js";
|
|
3
|
-
import {
|
|
3
|
+
import { fillBuildFile } from "../../static-assets-binding/dist/section-asset-url.js";
|
|
4
4
|
import { pageTitle, siteHead } from "./head.js";
|
|
5
5
|
import { renderPage } from "../../page-shell/dist/index.js";
|
|
6
6
|
|
|
@@ -94,7 +94,7 @@ async function buildCopy(input, buildBase, buildDir) {
|
|
|
94
94
|
if (binding.analytics === null) throw new Error("The binding is an image or a document template's (it names no visit beacon): a site is made from a website's build.");
|
|
95
95
|
if (Object.keys(binding.islands).length > 0 && (binding.island_runtime === null || binding.react_vendor === null || binding.react_vendor_core === null)) throw new Error("The binding has islands but names no island runtime, React vendor or vendor core.");
|
|
96
96
|
const pathOf = new Map(boundFiles(binding).map((file) => [file.filename, file.path]));
|
|
97
|
-
const named = new Set(input.pages.flatMap((page) => page.buildFiles));
|
|
97
|
+
const named = /* @__PURE__ */ new Set([...input.pages.flatMap((page) => page.buildFiles), ...binding.relative_assets ?? []]);
|
|
98
98
|
const bound = await Promise.all(siteBoundEntries(binding, input.analytics).map(async ({ ref, contentType }) => {
|
|
99
99
|
const raw = await input.readBuildFile(pathOf.get(ref.filename));
|
|
100
100
|
return {
|
|
@@ -118,11 +118,9 @@ async function buildCopy(input, buildBase, buildDir) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
function fillBuildBytes(filename, raw, buildBase, named) {
|
|
121
|
-
|
|
122
|
-
const filled = fillBuildFileText(filename, new TextDecoder().decode(raw), buildBase);
|
|
123
|
-
if (filled.files.length === 0) return raw;
|
|
121
|
+
const filled = fillBuildFile(filename, raw, buildBase);
|
|
124
122
|
for (const file of filled.files) named.add(file);
|
|
125
|
-
return
|
|
123
|
+
return filled.bytes;
|
|
126
124
|
}
|
|
127
125
|
async function shareImage(input, cover) {
|
|
128
126
|
const bytes = await input.cutShareImage(await cover.read(), {
|
|
@@ -25,7 +25,8 @@ const StaticAssetsBindingSchema = z.object({
|
|
|
25
25
|
svg: StaticAssetRefSchema.nullable(),
|
|
26
26
|
png: z.record(z.string(), StaticAssetRefSchema),
|
|
27
27
|
apple_touch: StaticAssetRefSchema
|
|
28
|
-
})
|
|
28
|
+
}),
|
|
29
|
+
relative_assets: z.array(z.string().min(1)).optional()
|
|
29
30
|
}).strict();
|
|
30
31
|
|
|
31
32
|
//#endregion
|
|
@@ -30,9 +30,6 @@ const SCRIPT_RE = /\.(mjs|js)$/i;
|
|
|
30
30
|
function carriesFixedAddresses(filename) {
|
|
31
31
|
return STYLESHEET_RE.test(filename) || SCRIPT_RE.test(filename);
|
|
32
32
|
}
|
|
33
|
-
function fillBuildFile(filename, text, buildBase) {
|
|
34
|
-
return fillBuildFileText(filename, text, buildBase).text;
|
|
35
|
-
}
|
|
36
33
|
function fillBuildFileText(filename, text, buildBase) {
|
|
37
34
|
if (STYLESHEET_RE.test(filename)) return fillSectionAssetRefs(text, { kind: "stylesheet" });
|
|
38
35
|
if (SCRIPT_RE.test(filename)) return fillSectionAssetRefs(text, {
|
|
@@ -44,6 +41,21 @@ function fillBuildFileText(filename, text, buildBase) {
|
|
|
44
41
|
files: []
|
|
45
42
|
};
|
|
46
43
|
}
|
|
44
|
+
function fillBuildFile(filename, bytes, buildBase) {
|
|
45
|
+
if (!carriesFixedAddresses(filename)) return {
|
|
46
|
+
bytes,
|
|
47
|
+
files: []
|
|
48
|
+
};
|
|
49
|
+
const filled = fillBuildFileText(filename, new TextDecoder().decode(bytes), buildBase);
|
|
50
|
+
if (filled.files.length === 0) return {
|
|
51
|
+
bytes,
|
|
52
|
+
files: []
|
|
53
|
+
};
|
|
54
|
+
return {
|
|
55
|
+
bytes: new TextEncoder().encode(filled.text),
|
|
56
|
+
files: filled.files
|
|
57
|
+
};
|
|
58
|
+
}
|
|
47
59
|
|
|
48
60
|
//#endregion
|
|
49
|
-
export { SECTION_ASSET_PREFIX, carriesFixedAddresses, fillBuildFile,
|
|
61
|
+
export { SECTION_ASSET_PREFIX, carriesFixedAddresses, fillBuildFile, fillSectionAssetRefs, sectionAssetPrefix };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region ../../internal/template-artifact/dist/framework-floor.js
|
|
2
|
+
const SEMVER = /^(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
3
|
+
function compareVersions(a, b) {
|
|
4
|
+
const x = SEMVER.exec(a);
|
|
5
|
+
const y = SEMVER.exec(b);
|
|
6
|
+
if (x === null || y === null) return null;
|
|
7
|
+
for (let i = 1; i <= 3; i++) {
|
|
8
|
+
const d = Number(x[i]) - Number(y[i]);
|
|
9
|
+
if (d !== 0) return d;
|
|
10
|
+
}
|
|
11
|
+
const pa = x[4];
|
|
12
|
+
const pb = y[4];
|
|
13
|
+
if (pa === void 0 || pb === void 0) return pa === pb ? 0 : pa === void 0 ? 1 : -1;
|
|
14
|
+
const ia = pa.split(".");
|
|
15
|
+
const ib = pb.split(".");
|
|
16
|
+
for (let i = 0; i < Math.max(ia.length, ib.length); i++) {
|
|
17
|
+
const sa = ia[i];
|
|
18
|
+
const sb = ib[i];
|
|
19
|
+
if (sa === void 0) return -1;
|
|
20
|
+
if (sb === void 0) return 1;
|
|
21
|
+
const na = /^\d+$/.test(sa);
|
|
22
|
+
const nb = /^\d+$/.test(sb);
|
|
23
|
+
if (na && nb) {
|
|
24
|
+
const d = Number(sa) - Number(sb);
|
|
25
|
+
if (d !== 0) return d;
|
|
26
|
+
} else if (na !== nb) return na ? -1 : 1;
|
|
27
|
+
else if (sa !== sb) return sa < sb ? -1 : 1;
|
|
28
|
+
}
|
|
29
|
+
return 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
//#endregion
|
|
33
|
+
export { compareVersions };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ASSETS_DIR,
|
|
1
|
+
import { ASSETS_DIR, ASSET_URL_PREFIX, FIXTURES_DIR, FIXTURE_DOCUMENT_EXTENSION, MANIFEST_FILE, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, assetPath, boundFiles, browserFileClashes, isFixtureDocument, isFixtureFilePath, isSectionKey, isStoredPath, isTemplateKey, islandPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath } from "./layout.js";
|
|
2
2
|
import { sha256Hex } from "./sha256.js";
|
|
3
3
|
import { listingDigest, sectionContentHash, sourceDigest, templateContentHash } from "./hash.js";
|
|
4
4
|
import { ArtifactManifest, ArtifactScope, ArtifactSection, readArtifactSchema } from "./manifest.js";
|
|
5
|
-
import {
|
|
5
|
+
import { verifyBuild } from "./verify.js";
|
|
6
6
|
|
|
7
|
-
export { ArtifactManifest,
|
|
7
|
+
export { ArtifactManifest, FIXTURES_DIR, MANIFEST_FILE, SECTION_FILES, TEMPLATE_DIR, TEMPLATE_FILES, assetPath, browserFileClashes, isFixtureFilePath, isSectionKey, isTemplateKey, islandPath, listingDigest, publishedSectionKey, sectionDir, sectionPath, sourceDigest, staticPath, templatePath, verifyBuild };
|