@woodsportal/hubspot-kit 1.0.41-dev.2 → 1.0.41-dev.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1176,20 +1176,36 @@ async function checkCdnMirrorPublic(ctx) {
1176
1176
  severity: "error"
1177
1177
  };
1178
1178
  }
1179
- const head = await fetch(appUrl, { method: "HEAD" });
1180
- if (!head.ok) {
1179
+ const appHead = await fetch(appUrl, { method: "HEAD" });
1180
+ if (!appHead.ok) {
1181
1181
  return {
1182
1182
  name: "cdn-mirror-public",
1183
1183
  ok: false,
1184
- message: `jsDelivr app chunk not reachable (HTTP ${head.status}) \u2014 HubSpot preview will be blank`,
1184
+ message: `jsDelivr app chunk not reachable (HTTP ${appHead.status}) \u2014 HubSpot preview will be blank`,
1185
1185
  remediation: "Run wp deploy (publish CDN + upload module) after making the mirror repo public",
1186
1186
  severity: "error"
1187
1187
  };
1188
1188
  }
1189
+ const lazyChunks = (manifest.scripts ?? []).filter(
1190
+ (entry) => typeof entry.url === "string" && (entry.file?.startsWith("chunks/") || entry.url.includes("/chunks/"))
1191
+ );
1192
+ for (const chunk of lazyChunks) {
1193
+ const chunkHead = await fetch(chunk.url, { method: "HEAD" });
1194
+ if (!chunkHead.ok) {
1195
+ return {
1196
+ name: "cdn-mirror-public",
1197
+ ok: false,
1198
+ message: `jsDelivr lazy chunk not reachable: ${chunk.file ?? chunk.url} (HTTP ${chunkHead.status})`,
1199
+ remediation: "Run wp deploy to republish dist/cdn (including chunks/) and wait 5\u201315 min for jsDelivr propagation",
1200
+ severity: "error"
1201
+ };
1202
+ }
1203
+ }
1204
+ const lazyChunkNote = lazyChunks.length > 0 ? ` and ${lazyChunks.length} lazy chunk(s) are reachable` : "";
1189
1205
  return {
1190
1206
  name: "cdn-mirror-public",
1191
1207
  ok: true,
1192
- message: `CDN mirror ${github} is public and jsDelivr app chunk is reachable`,
1208
+ message: `CDN mirror ${github} is public and jsDelivr app chunk${lazyChunkNote}`,
1193
1209
  severity: "error"
1194
1210
  };
1195
1211
  } catch {