@homepages/concrete 14.0.0 → 14.2.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.
Files changed (30) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/codemods/manifest.json +8 -0
  3. package/dist/cli/build/esbuild.js +42 -3
  4. package/dist/cli/build/record.js +4 -3
  5. package/dist/cli/build/sections.js +13 -6
  6. package/dist/cli/build/template-build.js +19 -9
  7. package/dist/cli/check/stages/fixtures.js +2 -1
  8. package/dist/cli/media/deriver-plugin.js +26 -4
  9. package/dist/css/inline.js +2 -3
  10. package/dist/fixtures/synthesize-cases.js +32 -0
  11. package/dist/packages/external/concrete/package.js +1 -1
  12. package/dist/packages/internal/download-files/dist/capture-origin.js +1 -24
  13. package/dist/packages/internal/download-files/dist/capture-routes.js +1 -5
  14. package/dist/packages/internal/download-files/dist/make.js +0 -1
  15. package/dist/packages/internal/media-resolution/dist/image.js +25 -9
  16. package/dist/packages/internal/media-resolution/dist/list.js +4 -4
  17. package/dist/packages/internal/media-resolution/dist/media.js +2 -2
  18. package/dist/packages/internal/media-resolution/dist/slot.js +2 -2
  19. package/dist/packages/internal/playground/dist/host/resolve.js +19 -17
  20. package/dist/packages/internal/playground/dist/server/playground-server.js +5 -8
  21. package/dist/packages/internal/site-files/dist/site.js +4 -13
  22. package/dist/packages/internal/static-assets-binding/dist/index.js +2 -1
  23. package/dist/packages/internal/static-assets-binding/dist/section-asset-url.js +1 -21
  24. package/dist/packages/internal/template-artifact/dist/index.js +1 -1
  25. package/dist/packages/internal/template-artifact/dist/layout.js +6 -1
  26. package/dist/packages/internal/template-artifact/dist/verify.js +9 -1
  27. package/dist/packages/internal/template-contracts/dist/slot-catalog.js +8 -1
  28. package/dist/rules/registry.js +1 -1
  29. package/guide/reference/rules/INDEX.md +1 -1
  30. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,28 @@
1
1
  # @homepages/concrete
2
2
 
3
+ ## 14.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bc1667e: `concrete check` now synthesizes every display case. For each placed instance whose section declares `variant` cases, it renders a copy of the first fixture once per case that fixture does not already render, with that case switched on as a user would switch it. Marker coverage and the render invariants grade every case, so no fixture has to be on a case just for `check`. Put your fullest property first: `check` does not switch an instance the first fixture hides. A slot that renders only in a case no fixture draws, and loses its marker when empty, is now reported as `render/missing-slot-marker`.
8
+
9
+ ### Patch Changes
10
+
11
+ - ebd29d2: A build's static-assets binding always lists `relative_assets`, and the build's check refuses any stylesheet or script that names an asset by the fixed address `/section-assets/`. No host fills that address in a stylesheet or a script any more, so a build of the earlier form is refused, not served with missing fonts and images.
12
+ - 800518e: The bundled framework-floor module gains a read of a prerelease version, which the development console uses. Nothing a template author runs changed.
13
+
14
+ ## 14.1.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 92ffc26: `concrete build` now writes a font's or an image's address relative to the stylesheet or the island script that names it. A script works the address out from its own URL, so it matches the address the render writes into the section's HTML exactly. Every host now serves a build's stylesheets and scripts with their bytes unchanged. The build's static-assets binding lists the assets they name (`relative_assets`), which is how a host can tell this form from the earlier one. Nothing in a template's source changes: rebuild on this version to pick it up.
19
+
20
+ ### Patch Changes
21
+
22
+ - c671662: The section-asset address module it bundles drops two helpers nothing called. Nothing a consumer sees changed.
23
+ - 4b64e19: Source comments in two modules it bundles no longer name the retired renderers bucket. No code changed.
24
+ - cb45415: A render that waits for media still processing (a published site, a download) now also waits for an image's cut-out at a slot that declares `process.cutout()`. Until now it served the image with its background while the cut-out was still being made. A cut-out that can no longer land does not hold the render. Renders that serve straight away, like the playground's canvas, are unchanged.
25
+
3
26
  ## 14.0.0
4
27
 
5
28
  ### Major Changes
@@ -37,6 +37,14 @@
37
37
  "drop `CONCRETE_TOKEN` and `CONCRETE_API_URL` from the workspace's `.env` and every key file, and after `concrete publish` run `concrete release` to hand the version to HomePages; a script that ran `concrete publish --dry-run` runs `concrete release --dry-run` instead.",
38
38
  "set `CONCRETE_CONSOLE_KEY` to your team's console key (in the workspace's `.env`, the environment, or the file `--env-file` names); `concrete publish` refuses without it."
39
39
  ]
40
+ },
41
+ "14.1.0": {
42
+ "codemods": [],
43
+ "manual": []
44
+ },
45
+ "14.2.0": {
46
+ "codemods": [],
47
+ "manual": []
40
48
  }
41
49
  }
42
50
  }
@@ -39,17 +39,56 @@ function bundledFrameworkPlugin() {
39
39
  }
40
40
  };
41
41
  }
42
- function workspaceLoaders(root) {
42
+ function workspaceLoaders(root, addresses) {
43
43
  return {
44
44
  loader: {
45
45
  ".css": "empty",
46
46
  ...MEDIA_LOADERS
47
47
  },
48
- publicPath: ASSET_PUBLIC_PATH,
48
+ publicPath: addresses === "fixed" ? ASSET_PUBLIC_PATH : "",
49
49
  assetNames: ASSET_NAMES,
50
50
  outdir: join(root, ".concrete", "cache", "build")
51
51
  };
52
52
  }
53
+ const RELATIVE_ASSET_NAMESPACE = "concrete-relative-asset";
54
+ const RELATIVE_ASSET_INNER = Symbol("concrete-relative-asset:inner");
55
+ const ASSET_IMPORT_KINDS = /* @__PURE__ */ new Set([
56
+ "import-statement",
57
+ "require-call",
58
+ "dynamic-import"
59
+ ]);
60
+ const MEDIA_FILTER = new RegExp(`\\.(?:${Object.keys(MEDIA_LOADERS).map((ext) => [...ext.slice(1)].map((c) => `[${c.toLowerCase()}${c.toUpperCase()}]`).join("")).join("|")})$`);
61
+ function relativeAssetPlugin() {
62
+ return {
63
+ name: RELATIVE_ASSET_NAMESPACE,
64
+ setup(build) {
65
+ build.onResolve({ filter: MEDIA_FILTER }, async (args) => {
66
+ if (args.pluginData === RELATIVE_ASSET_INNER || !ASSET_IMPORT_KINDS.has(args.kind)) return null;
67
+ const resolved = await build.resolve(args.path, {
68
+ importer: args.importer,
69
+ namespace: args.namespace,
70
+ resolveDir: args.resolveDir,
71
+ kind: args.kind,
72
+ pluginData: RELATIVE_ASSET_INNER
73
+ });
74
+ if (resolved.errors.length > 0 || resolved.path === "" || resolved.external === true) return null;
75
+ return {
76
+ path: resolved.path,
77
+ namespace: RELATIVE_ASSET_NAMESPACE
78
+ };
79
+ });
80
+ build.onLoad({
81
+ filter: /.*/,
82
+ namespace: RELATIVE_ASSET_NAMESPACE
83
+ }, (args) => ({
84
+ contents: `import file from ${JSON.stringify(args.path)};\nexport default new URL(file, import.meta.url).pathname;`,
85
+ loader: "js",
86
+ resolveDir: dirname(args.path),
87
+ pluginData: RELATIVE_ASSET_INNER
88
+ }));
89
+ }
90
+ };
91
+ }
53
92
  function emittedAssets(outputs) {
54
93
  const byName = /* @__PURE__ */ new Map();
55
94
  for (const file of outputs) {
@@ -83,4 +122,4 @@ async function runPass(what, pass) {
83
122
  }
84
123
 
85
124
  //#endregion
86
- export { ASSET_NAMES, ASSET_PUBLIC_PATH, assetContentType, bundledFrameworkPlugin, emittedAssets, javascriptOutput, runPass, workspaceLoaders };
125
+ export { ASSET_NAMES, ASSET_PUBLIC_PATH, RELATIVE_ASSET_NAMESPACE, assetContentType, bundledFrameworkPlugin, emittedAssets, javascriptOutput, relativeAssetPlugin, runPass, workspaceLoaders };
@@ -10,13 +10,14 @@ const LEGACY_BUILD_RECORD_FILE = "build.json";
10
10
  function buildRecordPath(out) {
11
11
  return join(dirname(out), `${basename(out)}.json`);
12
12
  }
13
- const BUILD_RECORD_SCHEMA = 2;
13
+ const BUILD_RECORD_SCHEMA = 3;
14
14
  const IslandRecord = z.object({
15
15
  island_key: z.string(),
16
16
  filename: z.string(),
17
17
  content_hash: z.string(),
18
18
  file: z.string(),
19
- frameless: z.boolean()
19
+ frameless: z.boolean(),
20
+ assets: z.array(z.string())
20
21
  });
21
22
  const SourceRecord = z.object({
22
23
  file: z.string(),
@@ -37,7 +38,7 @@ const SectionRecord = z.object({
37
38
  files: z.array(z.string())
38
39
  });
39
40
  const BuildRecord = z.object({
40
- build_schema: z.literal(2),
41
+ build_schema: z.literal(3),
41
42
  framework_version: z.string(),
42
43
  key: z.string(),
43
44
  template: z.object({ content_hash: z.string() }),
@@ -1,5 +1,5 @@
1
1
  import { isWorkspaceFile, toPosix, workspacePath } from "../../platform/paths.js";
2
- import { bundledFrameworkPlugin, emittedAssets, javascriptOutput, runPass, workspaceLoaders } from "./esbuild.js";
2
+ import { bundledFrameworkPlugin, emittedAssets, javascriptOutput, relativeAssetPlugin, runPass, workspaceLoaders } from "./esbuild.js";
3
3
  import { ISLAND_REACT_EXTERNALS } from "../../packages/internal/static-assets-binding/dist/index.js";
4
4
  import { declaresNoServerFrame, stubClientModule, wrapClientModule } from "../../islands/wrap.js";
5
5
  import { mediaCacheDir } from "../media/cache.js";
@@ -95,7 +95,7 @@ async function rendererPass(input, deriver, found, stubFrameless) {
95
95
  "react/jsx-runtime"
96
96
  ],
97
97
  absWorkingDir: root,
98
- ...workspaceLoaders(root),
98
+ ...workspaceLoaders(root, "fixed"),
99
99
  plugins: [
100
100
  bundledFrameworkPlugin(),
101
101
  serverIslandsPlugin(root, key, found, stubFrameless),
@@ -166,7 +166,11 @@ async function buildSection(input) {
166
166
  collect(rendererDeriver, rendered.outputFiles, rendered.metafile);
167
167
  const islands = [];
168
168
  for (const [islandKey, file] of [...found].sort(([a], [b]) => a < b ? -1 : 1)) {
169
- const deriver = createMediaDeriver(deriverOptions);
169
+ const deriver = createMediaDeriver({
170
+ ...deriverOptions,
171
+ addresses: "relative"
172
+ });
173
+ let named = [];
170
174
  const bytes = await runPass(`The island chunk ${islandKey}`, async () => {
171
175
  const result = await build({
172
176
  entryPoints: [file],
@@ -179,16 +183,18 @@ async function buildSection(input) {
179
183
  jsx: "automatic",
180
184
  external: [...ISLAND_REACT_EXTERNALS],
181
185
  absWorkingDir: root,
182
- ...workspaceLoaders(root),
186
+ ...workspaceLoaders(root, "relative"),
183
187
  plugins: [
184
188
  bundledFrameworkPlugin(),
185
189
  nestedIslandsPlugin(root, key, file),
186
- deriver.plugin
190
+ deriver.plugin,
191
+ relativeAssetPlugin()
187
192
  ],
188
193
  metafile: true,
189
194
  logLevel: "silent"
190
195
  });
191
196
  collect(deriver, result.outputFiles, result.metafile);
197
+ named = [.../* @__PURE__ */ new Set([...emittedAssets(result.outputFiles).map((asset) => asset.filename), ...deriver.named])].sort();
192
198
  return javascriptOutput(result.outputFiles, `island ${islandKey}`);
193
199
  });
194
200
  const contentHash = sha256(bytes);
@@ -199,7 +205,8 @@ async function buildSection(input) {
199
205
  contentHash,
200
206
  bytes,
201
207
  file,
202
- frameless
208
+ frameless,
209
+ assets: named
203
210
  });
204
211
  }
205
212
  return {
@@ -120,7 +120,8 @@ async function produceSection(root, out, task, site, context) {
120
120
  contentHash: island.content_hash,
121
121
  bytes: islandBytes[index],
122
122
  file: island.file,
123
- frameless: island.frameless
123
+ frameless: island.frameless,
124
+ assets: island.assets
124
125
  }));
125
126
  return {
126
127
  logic: {
@@ -194,7 +195,8 @@ async function produceSection(root, out, task, site, context) {
194
195
  filename: island.filename,
195
196
  content_hash: island.contentHash,
196
197
  file: island.file,
197
- frameless: island.frameless
198
+ frameless: island.frameless,
199
+ assets: [...island.assets]
198
200
  })),
199
201
  sources: [...built.sources],
200
202
  masters: Object.fromEntries(byKey(built.masters)),
@@ -447,6 +449,7 @@ async function assemble(root, out, workspace, composition, css, results, shared)
447
449
  const sectionRecords = [];
448
450
  const islands = {};
449
451
  const masters = [];
452
+ const relativeAssets = /* @__PURE__ */ new Set();
450
453
  for (const result of [...results].sort((a, b) => a.build.key < b.build.key ? -1 : a.build.key > b.build.key ? 1 : 0)) {
451
454
  const { build, record } = result;
452
455
  if (!isSectionKey(build.key)) throw new LayoutRefusal({
@@ -479,10 +482,13 @@ async function assemble(root, out, workspace, composition, css, results, shared)
479
482
  output.keep(path, sha);
480
483
  }
481
484
  }
482
- for (const island of bundles.islands) islands[island.islandKey] = {
483
- filename: island.filename,
484
- content_hash: island.contentHash
485
- };
485
+ for (const island of bundles.islands) {
486
+ islands[island.islandKey] = {
487
+ filename: island.filename,
488
+ content_hash: island.contentHash
489
+ };
490
+ for (const asset of island.assets) relativeAssets.add(asset);
491
+ }
486
492
  masters.push(...bundles.masters);
487
493
  const contentHash = output.digestUnder(sectionDir(build.key));
488
494
  sectionRecords.push({
@@ -512,7 +518,10 @@ async function assemble(root, out, workspace, composition, css, results, shared)
512
518
  output.put(templatePath(TEMPLATE_FILES.composition), json(compositionColumn));
513
519
  output.put(templatePath(TEMPLATE_FILES.preview), json(manifest.preview ?? null));
514
520
  output.put(templatePath(TEMPLATE_FILES.stylesheet), css.bytes);
515
- for (const asset of css.assets) output.asset(asset);
521
+ for (const asset of css.assets) {
522
+ output.asset(asset);
523
+ relativeAssets.add(asset.filename);
524
+ }
516
525
  const { icons } = shared;
517
526
  if (icons === null) throw new LayoutRefusal({
518
527
  rule: "workspace/template-invalid",
@@ -541,7 +550,8 @@ async function assemble(root, out, workspace, composition, css, results, shared)
541
550
  react_vendor_core: vendor === null ? null : putStatic(vendor.core),
542
551
  analytics: shared.analytics === null ? null : putStatic(shared.analytics),
543
552
  masters: Object.fromEntries(byKey(masters)),
544
- icons: icons.icons
553
+ icons: icons.icons,
554
+ relative_assets: [...relativeAssets].sort()
545
555
  };
546
556
  output.put(templatePath(TEMPLATE_FILES.staticAssets), json(binding));
547
557
  const clashes = browserFileClashes(binding, output.hashes.keys());
@@ -574,7 +584,7 @@ async function assemble(root, out, workspace, composition, css, results, shared)
574
584
  message: `The build would not write the same files on Windows and macOS:\n` + unportable.map((found) => ` ${found.paths.join(" and ")}: ${found.reason}`).join("\n") + "\nRename the source files these names come from."
575
585
  });
576
586
  const record = {
577
- build_schema: 2,
587
+ build_schema: 3,
578
588
  framework_version: CONCRETE_CLI_VERSION,
579
589
  key: template.key,
580
590
  template: { content_hash: templateHash },
@@ -1,6 +1,7 @@
1
1
  import { uniquePlacements } from "../../../packages/internal/playground/dist/host/resolve.js";
2
2
  import { TEMPLATE_FILE } from "../load-workspace.js";
3
3
  import { findFixturesReachableFromBundle } from "../../../fixtures/bundle-rule.js";
4
+ import { synthesizeCaseFixtures } from "../../../fixtures/synthesize-cases.js";
4
5
  import { synthesizeEmptyFixtures } from "../../../fixtures/synthesize-empties.js";
5
6
  import { loadWorkspaceFixtures } from "../../workspace-fixtures.js";
6
7
  import { join } from "node:path";
@@ -37,7 +38,7 @@ async function fixturesStage(ctx) {
37
38
  fixtureFiles: loaded.files
38
39
  }));
39
40
  const first = resolved[0];
40
- ctx.corpus = [...resolved.map((fixture) => ({ fixture })), ...first === void 0 ? [] : emptiesOf(first, composition)];
41
+ ctx.corpus = [...resolved.map((fixture) => ({ fixture })), ...first === void 0 ? [] : [...emptiesOf(first, composition), ...synthesizeCaseFixtures(first, composition.placements).map((fixture) => ({ fixture }))]];
41
42
  ctx.assets = loaded.assets;
42
43
  if (loaded.list !== null) ctx.fixtureFiles = {
43
44
  list: loaded.list,
@@ -1,4 +1,5 @@
1
1
  import { isFileSpecifier } from "../../platform/paths.js";
2
+ import { ASSET_PUBLIC_PATH, RELATIVE_ASSET_NAMESPACE } from "../build/esbuild.js";
2
3
  import { DERIVABLE_EXTENSIONS, cachedAuthorImage, deriveAuthorImage, masterOnlyDerivation } from "./derive.js";
3
4
  import { existsSync } from "node:fs";
4
5
  import { extname, resolve } from "node:path";
@@ -14,13 +15,14 @@ function createMediaDeriver(opts = {}) {
14
15
  const passthrough = /* @__PURE__ */ new Set();
15
16
  const pending = /* @__PURE__ */ new Set();
16
17
  const sources = /* @__PURE__ */ new Map();
18
+ const named = /* @__PURE__ */ new Set();
17
19
  return {
18
20
  plugin: {
19
21
  name: NAMESPACE,
20
22
  setup(build) {
21
23
  build.onResolve({ filter: RASTER_FILTER }, async (args) => {
22
24
  if (args.pluginData === RESOLVING) return null;
23
- if (args.kind !== "import-statement") return null;
25
+ if (args.kind !== "import-statement" || args.namespace === "concrete-relative-asset") return null;
24
26
  if (!DERIVABLE_EXTENSIONS.has(extname(args.path).toLowerCase())) return null;
25
27
  if (isFileSpecifier(args.path)) {
26
28
  const written = resolve(args.resolveDir, args.path);
@@ -73,8 +75,9 @@ function createMediaDeriver(opts = {}) {
73
75
  masterBytes: masterBytes.byteLength,
74
76
  derivatives: derivation.derivatives
75
77
  });
78
+ for (const address of imageAddresses(derivation.image)) named.add(address.slice(FIXED_PREFIX.length));
76
79
  return {
77
- contents: `export default ${JSON.stringify(derivation.image)};`,
80
+ contents: authorImageModule(derivation.image, opts.addresses ?? "fixed"),
78
81
  loader: "js",
79
82
  watchFiles: [args.path]
80
83
  };
@@ -85,9 +88,28 @@ function createMediaDeriver(opts = {}) {
85
88
  masters,
86
89
  passthrough,
87
90
  pending,
88
- sources
91
+ sources,
92
+ named
89
93
  };
90
94
  }
95
+ const FIXED_PREFIX = `${ASSET_PUBLIC_PATH}/`;
96
+ function imageAddresses(image) {
97
+ const candidates = (image.responsive?.sources ?? []).flatMap((source) => source.srcset.split(", ").map((candidate) => candidate.split(" ")[0]));
98
+ return [image.url, ...candidates];
99
+ }
100
+ function relativeAddress(address) {
101
+ if (!address.startsWith(FIXED_PREFIX)) throw new Error(`derive: an image address outside ${FIXED_PREFIX}: ${address}`);
102
+ return `d+${JSON.stringify(address.slice(FIXED_PREFIX.length))}`;
103
+ }
104
+ function authorImageModule(image, addresses) {
105
+ if (addresses === "fixed") return `export default ${JSON.stringify(image)};`;
106
+ const srcset = (list) => list.split(", ").map((candidate) => {
107
+ const space = candidate.indexOf(" ");
108
+ return space < 0 ? relativeAddress(candidate) : `${relativeAddress(candidate.slice(0, space))}+${JSON.stringify(candidate.slice(space))}`;
109
+ }).join(`+", "+`);
110
+ const responsive = image.responsive === null ? "null" : `{sources:[${image.responsive.sources.map((source) => `{type:${JSON.stringify(source.type)},srcset:${srcset(source.srcset)}}`).join(",")}],width:${String(image.responsive.width)},height:${String(image.responsive.height)}}`;
111
+ return [`const d = new URL("./", import.meta.url).pathname;`, `export default {url:${relativeAddress(image.url)},responsive:${responsive},width:${String(image.width)},height:${String(image.height)}};`].join("\n");
112
+ }
91
113
 
92
114
  //#endregion
93
- export { createMediaDeriver };
115
+ export { authorImageModule, createMediaDeriver };
@@ -4,7 +4,6 @@ import { basename, extname, join } from "node:path";
4
4
  import { build } from "esbuild";
5
5
 
6
6
  //#region src/css/inline.ts
7
- const ASSET_PUBLIC_PATH = "/section-assets";
8
7
  const ASSET_NAMES = "[name]-[hash]";
9
8
  function importRulePlugin() {
10
9
  return {
@@ -66,7 +65,7 @@ async function inlineCssGraph(root, files) {
66
65
  metafile: true,
67
66
  outdir: "out",
68
67
  loader: Object.fromEntries(Object.keys(ASSET_MIME).map((ext) => [ext, "file"])),
69
- publicPath: ASSET_PUBLIC_PATH,
68
+ publicPath: "",
70
69
  assetNames: ASSET_NAMES,
71
70
  legalComments: "none",
72
71
  plugins: [importRulePlugin()],
@@ -95,4 +94,4 @@ async function inlineCssGraph(root, files) {
95
94
  }
96
95
 
97
96
  //#endregion
98
- export { ASSET_PUBLIC_PATH, inlineCssGraph };
97
+ export { inlineCssGraph };
@@ -0,0 +1,32 @@
1
+ import { instanceInCase, uniquePlacements } from "../packages/internal/playground/dist/host/resolve.js";
2
+
3
+ //#region src/fixtures/synthesize-cases.ts
4
+ function synthesizeCaseFixtures(resolved, placements) {
5
+ const settled = resolved.settled;
6
+ if (settled === void 0) return [];
7
+ const out = [];
8
+ const base = { ...resolved };
9
+ delete base.settled;
10
+ for (const placement of uniquePlacements(placements)) {
11
+ const instance = settled.find((i) => i.instance_id === placement.instance);
12
+ if (instance === void 0) continue;
13
+ for (const variant of placement.section.display.variant?.cases ?? []) {
14
+ if (variant === instance.variant) continue;
15
+ const switched = instanceInCase({
16
+ ...instance,
17
+ variant
18
+ }, placement.section);
19
+ out.push({
20
+ ...base,
21
+ id: `${resolved.id}/case/${placement.instance}/${variant}`,
22
+ label: `${resolved.label}: ${placement.instance} in case ${variant}`,
23
+ synthesized: true,
24
+ contentDoc: { instances: resolved.contentDoc.instances.map((i) => i.instance_id === placement.instance ? switched : i) }
25
+ });
26
+ }
27
+ }
28
+ return out;
29
+ }
30
+
31
+ //#endregion
32
+ export { synthesizeCaseFixtures };
@@ -1,5 +1,5 @@
1
1
  //#region package.json
2
- var version = "14.0.0";
2
+ var version = "14.2.0";
3
3
 
4
4
  //#endregion
5
5
  export { version };
@@ -1,5 +1,4 @@
1
- import { fillBuildFile } from "../../static-assets-binding/dist/section-asset-url.js";
2
- import { isFilledText } from "./capture-routes.js";
1
+ import "./capture-routes.js";
3
2
  import { createServer } from "node:http";
4
3
  import { pipeline } from "node:stream/promises";
5
4
 
@@ -73,23 +72,6 @@ async function serveRequest(input, documents, req, res) {
73
72
  });
74
73
  const contentType = route.contentType ?? stored.contentType ?? DEFAULT_CONTENT_TYPE;
75
74
  const disposition = route.from === "media" && route.contentDisposition !== void 0 ? { "content-disposition": route.contentDisposition } : {};
76
- if (isFilledText(route) && route.from === "build") {
77
- let text;
78
- try {
79
- text = await readText(stored.body);
80
- } catch (err) {
81
- input.onError?.(`capture origin could not read ${route.path}`, err);
82
- res.writeHead(404).end();
83
- return;
84
- }
85
- const body = Buffer.from(fillBuildFile(route.filename, text, input.bases.build), "utf8");
86
- res.writeHead(200, {
87
- "content-type": contentType,
88
- "content-length": body.byteLength
89
- });
90
- res.end(req.method === "HEAD" ? void 0 : body);
91
- return;
92
- }
93
75
  res.writeHead(200, {
94
76
  "content-type": contentType,
95
77
  ...stored.contentLength === void 0 ? {} : { "content-length": stored.contentLength },
@@ -107,11 +89,6 @@ async function serveRequest(input, documents, req, res) {
107
89
  res.destroy();
108
90
  }
109
91
  }
110
- async function readText(body) {
111
- const chunks = [];
112
- for await (const chunk of body) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
113
- return Buffer.concat(chunks).toString("utf8");
114
- }
115
92
  function closeServer(server) {
116
93
  return new Promise((resolve, reject) => {
117
94
  server.closeAllConnections();
@@ -1,6 +1,5 @@
1
1
  import { assetContentType } from "../../template-artifact/dist/asset-mime.js";
2
2
  import { assetPath, browserFiles } from "../../template-artifact/dist/layout.js";
3
- import { carriesFixedAddresses } from "../../static-assets-binding/dist/section-asset-url.js";
4
3
  import { imageDocumentHtml, printDocumentHtml } from "./capture-shell.js";
5
4
 
6
5
  //#region ../../internal/download-files/dist/capture-routes.js
@@ -131,9 +130,6 @@ function captureRoutes(input) {
131
130
  return buildFile(pathname.slice(build.length));
132
131
  } };
133
132
  }
134
- function isFilledText(route) {
135
- return route.from === "build" && carriesFixedAddresses(route.filename);
136
- }
137
133
 
138
134
  //#endregion
139
- export { captureDocuments, captureRoutes, isFilledText, pageDocumentPath, printDocumentPath };
135
+ export { captureDocuments, captureRoutes, pageDocumentPath, printDocumentPath };
@@ -51,7 +51,6 @@ async function shoot(input, format, shotAs, pages) {
51
51
  media: input.media,
52
52
  bases: input.bases
53
53
  }),
54
- bases: input.bases,
55
54
  reads: input.reads,
56
55
  onError: (message, err) => log.error({ err }, message),
57
56
  onAbsentBuildFile: (path) => masters.recordAbsent(path),
@@ -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";
@@ -82,13 +83,27 @@ function sameCrop(a, b) {
82
83
  if (a === null || b === null) return a === b;
83
84
  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
84
85
  }
85
- function carriesCutAt(framing, photoId, crop) {
86
- const cut = (framing.renditions && typeof framing.renditions === "object" ? framing.renditions : {}).crop;
87
- const key = renditionKey(cut);
88
- if (key === null || cropKeyOwner(key) !== photoId) return false;
89
- const over = cut.over;
86
+ function madeAt(rendition, crop) {
87
+ const over = rendition !== null && typeof rendition === "object" ? rendition.over : void 0;
90
88
  return over !== null && typeof over === "object" && sameCrop(storedCrop(over.crop), crop);
91
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
+ }
92
107
  function noteOwedCuts(v, photoId, record, at, mask, store) {
93
108
  if (store.notePending === void 0 || mask !== null || record?.kind !== "image") return;
94
109
  const owes = (framing, crop) => cropsPart(crop) && !carriesCutAt(framing, photoId, crop);
@@ -103,7 +118,7 @@ function noteOwedCuts(v, photoId, record, at, mask, store) {
103
118
  function readMediaId(v) {
104
119
  return contentMediaIdOf(v) ?? "";
105
120
  }
106
- async function resolveImageValue(value, records, store, aspects) {
121
+ async function resolveImageValue(value, records, store, aspects, cutsOut = false) {
107
122
  if (value === null) return {
108
123
  value: null,
109
124
  desktopKey: null,
@@ -124,6 +139,7 @@ async function resolveImageValue(value, records, store, aspects) {
124
139
  imageAspect: imageAspectOf(record, ar)
125
140
  };
126
141
  if (photoId) noteOwedCuts(v, photoId, record, at, mask, store);
142
+ if (photoId && cutsOut) noteOwedCutout(v, photoId, record, at, store);
127
143
  const mobileKey = photoId ? mobileCutKey(v, at) : null;
128
144
  const mobile = mobileKey ? await mobileCropUrl(mobileKey, store) : null;
129
145
  const alt = typeof v.alt === "string" ? v.alt : "";
@@ -185,11 +201,11 @@ async function attachResponsive(entries, store) {
185
201
  }
186
202
  }
187
203
  }
188
- async function resolveImageSlot(value, records, store, aspects) {
189
- 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);
190
206
  await attachResponsive([entry], store);
191
207
  return entry.value;
192
208
  }
193
209
 
194
210
  //#endregion
195
- 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);
@@ -16,6 +16,22 @@ import { isEmptyValue, slotProvenance } from "./provenance.js";
16
16
  import { blankForField } from "./rows.js";
17
17
 
18
18
  //#region ../../internal/playground/dist/host/resolve.js
19
+ function instanceInCase(instance, section) {
20
+ const slots = {};
21
+ for (const [id, def] of Object.entries(section.slots)) {
22
+ const cases = def.variant?.cases;
23
+ if (cases !== void 0 && (instance.variant === void 0 || !cases.includes(instance.variant))) continue;
24
+ slots[id] = instance.slots[id];
25
+ }
26
+ return {
27
+ instance_id: instance.instance_id,
28
+ section_key: section.key,
29
+ enabled: instance.enabled,
30
+ ...instance.variant === void 0 ? {} : { variant: instance.variant },
31
+ slots,
32
+ ...instance.slot_overrides === void 0 ? {} : { slot_overrides: instance.slot_overrides }
33
+ };
34
+ }
19
35
  function assertAuthored(fixture) {
20
36
  if (fixture.settled === void 0) throw new Error(`Fixture "${fixture.id}" is synthesized: it carries no settled doc, and no playground serves it.`);
21
37
  }
@@ -137,23 +153,9 @@ function resolveStated(input) {
137
153
  const provenance = {};
138
154
  settled.forEach((instance, index) => {
139
155
  const { placement, values } = filled[index];
140
- const schemaSlots = placement.section.slots;
141
- const slots = {};
142
156
  const provenanceOf = {};
143
- for (const [id, def] of Object.entries(schemaSlots)) {
144
- provenanceOf[id] = slotProvenance(def, id, values[id], instance.slots[id], facts, instance.slot_overrides);
145
- const cases = def.variant?.cases;
146
- if (cases !== void 0 && (instance.variant === void 0 || !cases.includes(instance.variant))) continue;
147
- slots[id] = instance.slots[id];
148
- }
149
- instances.push({
150
- instance_id: instance.instance_id,
151
- section_key: placement.section.key,
152
- enabled: instance.enabled,
153
- ...instance.variant === void 0 ? {} : { variant: instance.variant },
154
- slots,
155
- ...instance.slot_overrides === void 0 ? {} : { slot_overrides: instance.slot_overrides }
156
- });
157
+ for (const [id, def] of Object.entries(placement.section.slots)) provenanceOf[id] = slotProvenance(def, id, values[id], instance.slots[id], facts, instance.slot_overrides);
158
+ instances.push(instanceInCase(instance, placement.section));
157
159
  provenance[instance.instance_id] = provenanceOf;
158
160
  });
159
161
  return {
@@ -550,4 +552,4 @@ function catalogRef(def, id, what, ctx) {
550
552
  }
551
553
 
552
554
  //#endregion
553
- export { assertAuthored, catalogRef, croppedPick, emptyValueFor, fixtureSectionOf, isEmptyValue, resolveStated, settleOverPlacements, uniquePlacements };
555
+ export { assertAuthored, catalogRef, croppedPick, emptyValueFor, fixtureSectionOf, instanceInCase, isEmptyValue, resolveStated, settleOverPlacements, uniquePlacements };
@@ -1,5 +1,4 @@
1
1
  import { TEMPLATE_FILES, browserFiles, builtTreePath, templatePath } from "../../../template-artifact/dist/layout.js";
2
- import { carriesFixedAddresses, fillBuildFile } from "../../../static-assets-binding/dist/section-asset-url.js";
3
2
  import { playgroundClientDir } from "../layout.js";
4
3
  import { parseDownloadPath } from "../host/download.js";
5
4
  import { OUTPUT_FOLDERS, ROUTES, parseOutputPath } from "../wire.js";
@@ -264,10 +263,10 @@ async function handle(req, res, ctx) {
264
263
  if (await sendClientAsset(ctx, path, res)) return;
265
264
  sendText(res, 404, "not found");
266
265
  }
267
- async function sendTemplateFile(ctx, req, url, res, buildBase = `${ctx.base}${BUILD_MOUNT}`) {
266
+ async function sendTemplateFile(ctx, req, url, res) {
268
267
  const path = `/${url.pathname.slice(ctx.base.length)}`;
269
268
  if (url.pathname.startsWith(ctx.base) && path.startsWith(`/${BUILD_MOUNT}`)) {
270
- await sendBuiltFile(ctx, decodeURIComponent(path.slice(BUILD_MOUNT.length + 1)), res, buildBase);
269
+ await sendBuiltFile(ctx, decodeURIComponent(path.slice(BUILD_MOUNT.length + 1)), res);
271
270
  return true;
272
271
  }
273
272
  if (url.pathname.startsWith(`${ctx.fixtureMediaPath}/`)) {
@@ -279,8 +278,7 @@ async function sendTemplateFile(ctx, req, url, res, buildBase = `${ctx.base}${BU
279
278
  async function sendContentFile(ctx, req, url, res) {
280
279
  if (req.method !== "GET" && req.method !== "HEAD") throw new RequestError(405, `${url.pathname} only reads.`);
281
280
  const file = await ctx.host.contentFile(url.pathname);
282
- const buildBase = `${ctx.base}${url.pathname.slice(ctx.base.length).split("/").slice(0, 6).join("/")}/`;
283
- if (file === null || !await sendTemplateFile(ctx, req, new URL(file.url, url), res, buildBase)) sendText(res, 404, "not found");
281
+ if (file === null || !await sendTemplateFile(ctx, req, new URL(file.url, url), res)) sendText(res, 404, "not found");
284
282
  }
285
283
  async function sendVerdict(ctx, req, res) {
286
284
  if (req.method !== "POST") throw new RequestError(405, "POST to ask for the build's verdict.");
@@ -311,7 +309,7 @@ async function sendClientAsset(ctx, path, res) {
311
309
  sendBytes(res, contentTypeFor(file), await readFile(file));
312
310
  return true;
313
311
  }
314
- async function sendBuiltFile(ctx, filename, res, buildBase = `${ctx.base}${BUILD_MOUNT}`) {
312
+ async function sendBuiltFile(ctx, filename, res) {
315
313
  const view = await ctx.files.current();
316
314
  const at = await browserFilePath(ctx, view, filename).catch(() => null);
317
315
  const read = at === null ? null : await view.readBytes(builtTreePath(at)).catch(() => null);
@@ -320,8 +318,7 @@ async function sendBuiltFile(ctx, filename, res, buildBase = `${ctx.base}${BUILD
320
318
  return;
321
319
  }
322
320
  res.setHeader("cache-control", "no-cache");
323
- const bytes = carriesFixedAddresses(filename) ? new TextEncoder().encode(fillBuildFile(filename, new TextDecoder().decode(read.bytes), buildBase)) : read.bytes;
324
- sendBytes(res, contentTypeFor(at), bytes);
321
+ sendBytes(res, contentTypeFor(at), read.bytes);
325
322
  }
326
323
  async function sendFixtureMedia(ctx, req, url, res) {
327
324
  if (req.method !== "GET" && req.method !== "HEAD") {
@@ -1,6 +1,5 @@
1
1
  import { assetContentType } from "../../template-artifact/dist/asset-mime.js";
2
2
  import { assetPath, boundFiles } from "../../template-artifact/dist/layout.js";
3
- import { carriesFixedAddresses, fillBuildFileText } from "../../static-assets-binding/dist/section-asset-url.js";
4
3
  import { pageTitle, siteHead } from "./head.js";
5
4
  import { renderPage } from "../../page-shell/dist/index.js";
6
5
 
@@ -28,7 +27,7 @@ async function siteFiles(input) {
28
27
  if (!input.siteUrl.endsWith("/")) throw new Error(`A site's address ends with "/", not "${input.siteUrl}".`);
29
28
  const buildDir = buildBase.slice(contentBase.length);
30
29
  const head = siteHead(input.head);
31
- const copy = await buildCopy(input, buildBase, buildDir);
30
+ const copy = await buildCopy(input, buildDir);
32
31
  const share = input.cover === null ? null : await shareImage(input, input.cover);
33
32
  const icoBytes = copy.byFilename.get(input.binding.icons.ico.filename);
34
33
  if (icoBytes === void 0) throw new Error(`the build's root icon ${input.binding.icons.ico.filename} was not copied`);
@@ -89,19 +88,18 @@ function siteBoundEntries(binding, analytics) {
89
88
  icon(apple_touch)
90
89
  ];
91
90
  }
92
- async function buildCopy(input, buildBase, buildDir) {
91
+ async function buildCopy(input, buildDir) {
93
92
  const { binding } = input;
94
93
  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
94
  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
95
  const pathOf = new Map(boundFiles(binding).map((file) => [file.filename, file.path]));
97
- const named = new Set(input.pages.flatMap((page) => page.buildFiles));
96
+ const named = /* @__PURE__ */ new Set([...input.pages.flatMap((page) => page.buildFiles), ...binding.relative_assets]);
98
97
  const bound = await Promise.all(siteBoundEntries(binding, input.analytics).map(async ({ ref, contentType }) => {
99
- const raw = await input.readBuildFile(pathOf.get(ref.filename));
100
98
  return {
101
99
  path: `${buildDir}${ref.filename}`,
102
100
  contentType,
103
101
  immutable: true,
104
- bytes: fillBuildBytes(ref.filename, raw, buildBase, named)
102
+ bytes: await input.readBuildFile(pathOf.get(ref.filename))
105
103
  };
106
104
  }));
107
105
  const copied = new Set(bound.map((file) => file.path.slice(buildDir.length)));
@@ -117,13 +115,6 @@ async function buildCopy(input, buildBase, buildDir) {
117
115
  byFilename: new Map(files.map((file) => [file.path.slice(buildDir.length), file.bytes]))
118
116
  };
119
117
  }
120
- function fillBuildBytes(filename, raw, buildBase, named) {
121
- if (!carriesFixedAddresses(filename)) return raw;
122
- const filled = fillBuildFileText(filename, new TextDecoder().decode(raw), buildBase);
123
- if (filled.files.length === 0) return raw;
124
- for (const file of filled.files) named.add(file);
125
- return new TextEncoder().encode(filled.text);
126
- }
127
118
  async function shareImage(input, cover) {
128
119
  const bytes = await input.cutShareImage(await cover.read(), {
129
120
  width: SHARE_IMAGE.width,
@@ -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))
29
30
  }).strict();
30
31
 
31
32
  //#endregion
@@ -11,7 +11,6 @@ function sectionAssetPrefix(profile) {
11
11
  switch (profile.kind) {
12
12
  case "canonical": return SECTION_ASSET_PREFIX;
13
13
  case "underBuildBase": return checkBuildBase(profile.buildBase);
14
- case "stylesheet": return "";
15
14
  }
16
15
  }
17
16
  function fillSectionAssetRefs(text, profile) {
@@ -25,25 +24,6 @@ function fillSectionAssetRefs(text, profile) {
25
24
  files: [...files]
26
25
  };
27
26
  }
28
- const STYLESHEET_RE = /\.css$/i;
29
- const SCRIPT_RE = /\.(mjs|js)$/i;
30
- function carriesFixedAddresses(filename) {
31
- return STYLESHEET_RE.test(filename) || SCRIPT_RE.test(filename);
32
- }
33
- function fillBuildFile(filename, text, buildBase) {
34
- return fillBuildFileText(filename, text, buildBase).text;
35
- }
36
- function fillBuildFileText(filename, text, buildBase) {
37
- if (STYLESHEET_RE.test(filename)) return fillSectionAssetRefs(text, { kind: "stylesheet" });
38
- if (SCRIPT_RE.test(filename)) return fillSectionAssetRefs(text, {
39
- kind: "underBuildBase",
40
- buildBase
41
- });
42
- return {
43
- text,
44
- files: []
45
- };
46
- }
47
27
 
48
28
  //#endregion
49
- export { SECTION_ASSET_PREFIX, carriesFixedAddresses, fillBuildFile, fillBuildFileText, fillSectionAssetRefs, sectionAssetPrefix };
29
+ export { SECTION_ASSET_PREFIX, fillSectionAssetRefs, sectionAssetPrefix };
@@ -1,4 +1,4 @@
1
- import { ASSETS_DIR, 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";
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";
@@ -23,6 +23,7 @@ function isFixtureDocument(path) {
23
23
  function isStoredPath(path) {
24
24
  return path.startsWith(`${ASSETS_DIR}/`);
25
25
  }
26
+ const ASSET_URL_PREFIX = "/section-assets/";
26
27
  const SECTION_FILES = {
27
28
  schema: "schema.json",
28
29
  fillSpec: "fill-spec.json",
@@ -92,6 +93,10 @@ function boundFiles(binding) {
92
93
  path: assetPath(filename),
93
94
  filename
94
95
  });
96
+ for (const filename of binding.relative_assets) out.push({
97
+ path: assetPath(filename),
98
+ filename
99
+ });
95
100
  const { ico, svg, png, apple_touch } = binding.icons;
96
101
  ref(assetPath(ico.filename), ico);
97
102
  if (svg !== null) ref(assetPath(svg.filename), svg);
@@ -123,4 +128,4 @@ function browserFileClashes(binding, paths) {
123
128
  }
124
129
 
125
130
  //#endregion
126
- export { ASSETS_DIR, BUILD_DIR, FIXTURES_DIR, FIXTURE_DOCUMENT_EXTENSION, MANIFEST_FILE, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, assetPath, boundFiles, browserFileClashes, browserFiles, builtPathOf, builtTreePath, isBuiltTreePath, isFixtureDocument, isFixtureFilePath, isSectionKey, isStoredPath, isTemplateKey, islandPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath };
131
+ export { ASSETS_DIR, ASSET_URL_PREFIX, BUILD_DIR, FIXTURES_DIR, FIXTURE_DOCUMENT_EXTENSION, MANIFEST_FILE, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, assetPath, boundFiles, browserFileClashes, browserFiles, builtPathOf, builtTreePath, isBuiltTreePath, isFixtureDocument, isFixtureFilePath, isSectionKey, isStoredPath, isTemplateKey, islandPath, publishedSectionKey, sectionDir, sectionOfIslandKey, sectionPath, staticPath, templatePath };
@@ -1,4 +1,4 @@
1
- import { ASSETS_DIR, MANIFEST_FILE, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, boundFiles, browserFileClashes, isStoredPath, sectionPath, templatePath } from "./layout.js";
1
+ import { ASSETS_DIR, ASSET_URL_PREFIX, MANIFEST_FILE, SECTIONS_DIR, SECTION_FILES, SECTION_ISLANDS_DIR, STATIC_DIR, TEMPLATE_DIR, TEMPLATE_FILES, boundFiles, browserFileClashes, isStoredPath, sectionPath, templatePath } from "./layout.js";
2
2
  import { sha256Hex } from "./sha256.js";
3
3
  import { sectionContentHash, templateContentHash } from "./hash.js";
4
4
  import { ArtifactManifest, readArtifactSchema } from "./manifest.js";
@@ -9,6 +9,7 @@ const SECTION_FILE_NAMES = new Set(Object.values(SECTION_FILES));
9
9
  const TEMPLATE_FILE_NAMES = new Set(Object.values(TEMPLATE_FILES));
10
10
  const ISLAND_CHUNK = new RegExp(`^${SECTION_ISLANDS_DIR}/[A-Za-z0-9._-]+\\.mjs$`);
11
11
  const FLAT_FILE = /^[A-Za-z0-9._-]+$/;
12
+ const BUILD_TEXT = /\.(?:css|mjs|js)$/;
12
13
  function readJson(files, path, problems) {
13
14
  const bytes = files.get(path);
14
15
  if (bytes === void 0) {
@@ -208,6 +209,13 @@ function verifyBuild(files, stored = /* @__PURE__ */ new Map()) {
208
209
  path: clash.paths[1],
209
210
  message: `is a browser file named ${clash.filename}, as ${clash.paths.filter((p) => p !== clash.paths[1]).join(" and ")} is: a build's browser files have one name each`
210
211
  });
212
+ for (const file of bound) {
213
+ const bytes = files.get(file.path);
214
+ if (bytes !== void 0 && BUILD_TEXT.test(file.path) && new TextDecoder().decode(bytes).includes("/section-assets/")) problems.push({
215
+ path: file.path,
216
+ message: `names an asset by the fixed address ${ASSET_URL_PREFIX}, which no stylesheet or script of a build may`
217
+ });
218
+ }
211
219
  for (const path of files.keys()) {
212
220
  const parts = path.split("/");
213
221
  const isChunk = parts.length === 5 && parts[0] === "sections" && parts[3] === "islands";
@@ -152,6 +152,13 @@ function processBindingOf(entry) {
152
152
  const { kind, verb } = entry;
153
153
  return kind === "process" && isProcessVerb(verb) ? entry : null;
154
154
  }
155
+ function processBindingsOf(process) {
156
+ if (!Array.isArray(process)) return [];
157
+ return process.map(processBindingOf).filter((binding) => binding !== null);
158
+ }
159
+ function processOf(bindings, verb) {
160
+ return bindings.find((binding) => binding.kind === "process" && binding.verb === verb);
161
+ }
155
162
  function processOptionsProblem(binding) {
156
163
  const entry = PROCESS_CATALOG[binding.verb];
157
164
  const takes = Object.keys(entry.options);
@@ -408,4 +415,4 @@ const PASSTHROUGH_TOUR_PROVIDERS = /* @__PURE__ */ new Set([
408
415
  ]);
409
416
 
410
417
  //#endregion
411
- export { CONTENT_SLOT_TYPES, DISPLAY_ENTRIES, HOLDER_PROCESS_VERBS, LINK_KINDS, LINK_PROVIDERS, LIST_SLOT_TYPES, MEDIA_KINDS, OBJECT_BINDING_OWN_KEYS, PROCESS_CATALOG, PROCESS_VERBS, REF_SLOT_TYPES, SLOT_TYPES, VISIBILITY_CASES, acceptsLink, declaredKinds, isEmailValue, isIsoDateValue, isLinkAccepts, isListSlotType, isMediaKind, isMediaType, isPhoneValue, isProcessVerb, kindOfLink, kindOfMime, matchLinkProvider, mediaDeclarationProblem, processBindingOf, processOptionsProblem, tourEmbedUrl, videoEmbedUrl };
418
+ export { CONTENT_SLOT_TYPES, DISPLAY_ENTRIES, HOLDER_PROCESS_VERBS, LINK_KINDS, LINK_PROVIDERS, LIST_SLOT_TYPES, MEDIA_KINDS, OBJECT_BINDING_OWN_KEYS, PROCESS_CATALOG, PROCESS_VERBS, REF_SLOT_TYPES, SLOT_TYPES, VISIBILITY_CASES, acceptsLink, declaredKinds, isEmailValue, isIsoDateValue, isLinkAccepts, isListSlotType, isMediaKind, isMediaType, isPhoneValue, isProcessVerb, kindOfLink, kindOfMime, matchLinkProvider, mediaDeclarationProblem, processBindingOf, processBindingsOf, processOf, processOptionsProblem, tourEmbedUrl, videoEmbedUrl };
@@ -44,7 +44,7 @@ const CHECK_STAGES = [
44
44
  },
45
45
  {
46
46
  id: "render",
47
- summary: "Every placed instance renders over every fixture and synthesized empty: deterministic, free of defects, and fully marked for the editor."
47
+ summary: "Every placed instance renders over every fixture, synthesized empty and synthesized display case: deterministic, free of defects, and fully marked for the editor."
48
48
  },
49
49
  {
50
50
  id: "bundles",
@@ -171,7 +171,7 @@ Every placed section's schema and fill spec satisfy the contract assertions publ
171
171
 
172
172
  ## render
173
173
 
174
- Every placed instance renders over every fixture and synthesized empty: deterministic, free of defects, and fully marked for the editor.
174
+ Every placed instance renders over every fixture, synthesized empty and synthesized display case: deterministic, free of defects, and fully marked for the editor.
175
175
 
176
176
  | Rule | Venue | What it requires |
177
177
  |---|---|---|
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homepages/concrete",
3
- "version": "14.0.0",
3
+ "version": "14.2.0",
4
4
  "description": "Concrete, the HomePages template framework: the authoring API, the contract primitives, the styles, the lint preset and the `concrete` command in one package that owns its whole toolchain.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",