@tokenoftrust/storefront-runner 5.0.0 → 5.0.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokenoftrust/storefront-runner",
3
- "version": "5.0.0",
3
+ "version": "5.0.1",
4
4
  "license": "SEE LICENSE IN LICENSE",
5
5
  "description": "World-shareable storefront runner: multi-tenant renderer on Astro/Cloudflare. No control plane.",
6
6
  "packageManager": "pnpm@11.9.0",
@@ -48,12 +48,26 @@ export function imageCensusByType(input: {
48
48
  }): ImageTypeCounts {
49
49
  if (!Array.isArray(input.tenantOrigins)) throw new TypeError("tenantOrigins is required");
50
50
  const out = {} as ImageTypeCounts;
51
- for (const type of IMAGE_TYPES) {
52
- const group = input.artifacts.filter((artifact) => imageTypeOf(artifact.path) === type);
53
- const skipped = (input.skipped ?? []).filter((path) => imageTypeOf(path) === type).length;
54
- const census = scanImageDependencies(group, { tenantId: input.tenantId, tenantOrigins: input.tenantOrigins }).census;
55
- out[type] = { files: group.length + skipped, references: census.references + skipped,
56
- uncaptured: census.captureRequired + census.securityErrors + census.deferred + skipped };
51
+ for (const type of IMAGE_TYPES) out[type] = { files: 0, references: 0, uncaptured: 0 };
52
+ for (const artifact of input.artifacts) out[imageTypeOf(artifact.path)].files += 1;
53
+ for (const path of input.skipped ?? []) {
54
+ const row = out[imageTypeOf(path)];
55
+ row.files += 1;
56
+ row.references += 1;
57
+ row.uncaptured += 1;
58
+ }
59
+ // One scan of the whole set. A custom property declared in one type and used in another is
60
+ // resolved only when both files are visible; scanning each type alone defers that use.
61
+ const scanned = scanImageDependencies(input.artifacts, { tenantId: input.tenantId, tenantOrigins: input.tenantOrigins });
62
+ const indexed = input.artifacts.filter((artifact) => !isDurableAssetsDeclarationPath(artifact.path));
63
+ for (const dependency of scanned.dependencies) {
64
+ const path = indexed[dependency.artifactIndex]?.path;
65
+ if (path == null) continue;
66
+ const row = out[imageTypeOf(path)];
67
+ row.references += 1;
68
+ if (dependency.disposition === "capture-required" || dependency.disposition === "security-error" || dependency.disposition === "deferred") {
69
+ row.uncaptured += 1;
70
+ }
57
71
  }
58
72
  return out;
59
73
  }