@bagelink/blox 1.17.3 → 1.17.6
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/{shard-runner-DyS4jIdb.cjs → shard-runner-DXjScXLk.cjs} +2 -2
- package/dist/{shard-runner-CdmoIS63.js → shard-runner-f05p1VMY.js} +2 -2
- package/dist/ssg/cli.cjs +2 -2
- package/dist/ssg/cli.mjs +2 -2
- package/dist/ssg/index.cjs +1 -1
- package/dist/ssg/index.mjs +2 -2
- package/dist/ssg/seo.d.ts.map +1 -1
- package/dist/ssg/validate-output.d.ts +6 -0
- package/dist/ssg/validate-output.d.ts.map +1 -1
- package/dist/{validate-output-C-EqAsnA.cjs → validate-output-C94Qpxw3.cjs} +47 -1
- package/dist/{validate-output-D2bGF0xH.js → validate-output-CuX33CnX.js} +47 -1
- package/dist/vite-plugin.cjs +1 -1
- package/dist/vite-plugin.d.ts +1 -1
- package/dist/vite-plugin.d.ts.map +1 -1
- package/dist/vite-plugin.mjs +1 -1
- package/package.json +1 -1
|
@@ -26,7 +26,7 @@ const node_child_process = require("node:child_process");
|
|
|
26
26
|
const os = require("node:os");
|
|
27
27
|
const path = require("node:path");
|
|
28
28
|
const process = require("node:process");
|
|
29
|
-
const llmArtifacts = require("./validate-output-
|
|
29
|
+
const llmArtifacts = require("./validate-output-C94Qpxw3.cjs");
|
|
30
30
|
const AUTO_SHARD_CAP = Number(process.env.BLOX_SSG_SHARD_CAP) || 6;
|
|
31
31
|
const PREFETCH_BUDGET = Number(process.env.BLOX_SSG_PREFETCH_BUDGET) || 24;
|
|
32
32
|
const SEQUENTIAL_SHARDS = process.env.BLOX_SSG_SEQUENTIAL === "1";
|
|
@@ -166,7 +166,7 @@ async function runSharded(opts) {
|
|
|
166
166
|
}
|
|
167
167
|
if (process.env.BLOX_SSG_LLM !== "0") {
|
|
168
168
|
try {
|
|
169
|
-
const { mergeLlmParts } = await Promise.resolve().then(() => require("./validate-output-
|
|
169
|
+
const { mergeLlmParts } = await Promise.resolve().then(() => require("./validate-output-C94Qpxw3.cjs")).then((n) => n.llmArtifacts);
|
|
170
170
|
const mergeWebsite = website;
|
|
171
171
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
172
172
|
const { pages } = await mergeLlmParts({
|
|
@@ -2,7 +2,7 @@ import { spawn } from "node:child_process";
|
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import process from "node:process";
|
|
5
|
-
import { f as fetchCmsSiteData, g as generateSitemapArtifacts } from "./validate-output-
|
|
5
|
+
import { f as fetchCmsSiteData, g as generateSitemapArtifacts } from "./validate-output-CuX33CnX.js";
|
|
6
6
|
const AUTO_SHARD_CAP = Number(process.env.BLOX_SSG_SHARD_CAP) || 6;
|
|
7
7
|
const PREFETCH_BUDGET = Number(process.env.BLOX_SSG_PREFETCH_BUDGET) || 24;
|
|
8
8
|
const SEQUENTIAL_SHARDS = process.env.BLOX_SSG_SEQUENTIAL === "1";
|
|
@@ -142,7 +142,7 @@ async function runSharded(opts) {
|
|
|
142
142
|
}
|
|
143
143
|
if (process.env.BLOX_SSG_LLM !== "0") {
|
|
144
144
|
try {
|
|
145
|
-
const { mergeLlmParts } = await import("./validate-output-
|
|
145
|
+
const { mergeLlmParts } = await import("./validate-output-CuX33CnX.js").then((n) => n.C);
|
|
146
146
|
const mergeWebsite = website;
|
|
147
147
|
const partFiles = Array.from({ length: total }, (_, i) => path.join(llmPartsDir, `part.${i}.json`));
|
|
148
148
|
const { pages } = await mergeLlmParts({
|
package/dist/ssg/cli.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const process = require("node:process");
|
|
4
4
|
const fs = require("node:fs/promises");
|
|
5
5
|
const ssg_buildGrant = require("./build-grant.cjs");
|
|
6
|
-
const llmArtifacts = require("../validate-output-
|
|
6
|
+
const llmArtifacts = require("../validate-output-C94Qpxw3.cjs");
|
|
7
7
|
function installFetchTimeout() {
|
|
8
8
|
const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
|
|
9
9
|
const original = globalThis.fetch;
|
|
@@ -147,7 +147,7 @@ Environment:
|
|
|
147
147
|
if (shardsOpt !== null || routesCmd) {
|
|
148
148
|
const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
|
|
149
149
|
const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
|
|
150
|
-
const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-
|
|
150
|
+
const { runSharded } = await Promise.resolve().then(() => require("../shard-runner-DXjScXLk.cjs"));
|
|
151
151
|
const code = await runSharded({
|
|
152
152
|
shards: shardsOpt ?? "auto",
|
|
153
153
|
mode,
|
package/dist/ssg/cli.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import process from "node:process";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
4
|
import { resolveBloxBuildGrant } from "./build-grant.mjs";
|
|
5
|
-
import { v as validateSsgOutput, u as uploadBloxManifest, p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, b as buildCollectionResolver, a as prerender, c as validateInternalLinks } from "../validate-output-
|
|
5
|
+
import { v as validateSsgOutput, u as uploadBloxManifest, p as polyfillBloxSsgGlobals, f as fetchCmsSiteData, b as buildCollectionResolver, a as prerender, c as validateInternalLinks } from "../validate-output-CuX33CnX.js";
|
|
6
6
|
function installFetchTimeout() {
|
|
7
7
|
const ms = Number(process.env.BLOX_SSG_FETCH_TIMEOUT_MS) || 2e4;
|
|
8
8
|
const original = globalThis.fetch;
|
|
@@ -146,7 +146,7 @@ Environment:
|
|
|
146
146
|
if (shardsOpt !== null || routesCmd) {
|
|
147
147
|
const { apiBase: apiBase2, websiteName: configWebsiteName2 } = await resolveApiBase(mode);
|
|
148
148
|
const websiteName2 = process.env.WEBSITE_NAME ?? configWebsiteName2 ?? "default";
|
|
149
|
-
const { runSharded } = await import("../shard-runner-
|
|
149
|
+
const { runSharded } = await import("../shard-runner-f05p1VMY.js");
|
|
150
150
|
const code = await runSharded({
|
|
151
151
|
shards: shardsOpt ?? "auto",
|
|
152
152
|
mode,
|
package/dist/ssg/index.cjs
CHANGED
|
@@ -22,7 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
mod
|
|
23
23
|
));
|
|
24
24
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
25
|
-
const llmArtifacts = require("../validate-output-
|
|
25
|
+
const llmArtifacts = require("../validate-output-C94Qpxw3.cjs");
|
|
26
26
|
const ssg_buildGrant = require("./build-grant.cjs");
|
|
27
27
|
const ssg_client = require("../client-AoDTJJXJ.cjs");
|
|
28
28
|
const vue = require("vue");
|
package/dist/ssg/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as buildPageHead, e as primaryContextEntry, h as buildJsonLd, i as extractPageText, B as BloxBuildResponseError, j as bloxBuildJson } from "../validate-output-
|
|
2
|
-
import { k, l, f, m, n, o, q, g, r, s, t, w, x, y, p, a, z, A, u, c, v } from "../validate-output-
|
|
1
|
+
import { d as buildPageHead, e as primaryContextEntry, h as buildJsonLd, i as extractPageText, B as BloxBuildResponseError, j as bloxBuildJson } from "../validate-output-CuX33CnX.js";
|
|
2
|
+
import { k, l, f, m, n, o, q, g, r, s, t, w, x, y, p, a, z, A, u, c, v } from "../validate-output-CuX33CnX.js";
|
|
3
3
|
import { parseBloxBuildGrantBody, resolveBloxBuildGrant } from "./build-grant.mjs";
|
|
4
4
|
import { a as BLOX_HYDRATION_WINDOW_KEY } from "../client-Ce9fRCGH.js";
|
|
5
5
|
import { createSSRApp, h, Suspense } from "vue";
|
package/dist/ssg/seo.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seo.d.ts","sourceRoot":"","sources":["../../src/ssg/seo.ts"],"names":[],"mappings":"AAAA;;;;;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O,CAAA;CACjB,GAAG,MAAM,CAqBT;AAMD,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,aAAa,EAAE,GAAG,MAAM,CAuB3E;AAMD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CACnC,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAC;IAAC,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GAC1D,MAAM,CA8BR;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG;IAC9D,UAAU,EAAE,OAAO,CAAA;IACnB,UAAU,EAAE,OAAO,CAAA;CACnB,CAMA;AAMD,UAAU,gBAAgB;IACzB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,GAClE,gBAAgB,CAgBlB;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAClC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,SAAS,GAClE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,IAAI,CAEtD"}
|
|
@@ -10,6 +10,12 @@ export declare function validateInternalLinks(outDir: string): Promise<void>;
|
|
|
10
10
|
export interface ValidateSsgOutputOptions {
|
|
11
11
|
outDir: string;
|
|
12
12
|
requireFiles?: string[];
|
|
13
|
+
/**
|
|
14
|
+
* Require generated `/assets/*.css|js` references to contain a content hash.
|
|
15
|
+
* Enable when those files are served with long-lived immutable caching.
|
|
16
|
+
* @default true for Blox SSG output validation
|
|
17
|
+
*/
|
|
18
|
+
requireHashedAssets?: boolean;
|
|
13
19
|
/**
|
|
14
20
|
* Fail when a prerendered page contains a relative internal link.
|
|
15
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-output.d.ts","sourceRoot":"","sources":["../../src/ssg/validate-output.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validate-output.d.ts","sourceRoot":"","sources":["../../src/ssg/validate-output.ts"],"names":[],"mappings":"AAWA;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBzE;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC5B;AAgCD,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2ExF"}
|
|
@@ -468,7 +468,16 @@ function buildPageHead(options) {
|
|
|
468
468
|
const ogType = (override == null ? void 0 : override.ogType) ?? "website";
|
|
469
469
|
if (title) parts.push(`<meta property="og:title" content="${esc(title)}">`);
|
|
470
470
|
if (ogDesc) parts.push(`<meta property="og:description" content="${esc(ogDesc)}">`);
|
|
471
|
-
if (ogImage)
|
|
471
|
+
if (ogImage) {
|
|
472
|
+
parts.push(`<meta name="image" property="og:image" content="${esc(ogImage)}">`);
|
|
473
|
+
if (ogImage.startsWith("https://")) {
|
|
474
|
+
parts.push(`<meta property="og:image:secure_url" content="${esc(ogImage)}">`);
|
|
475
|
+
}
|
|
476
|
+
const imageMeta = socialImageMeta(ogImage);
|
|
477
|
+
if (imageMeta.type) parts.push(`<meta property="og:image:type" content="${esc(imageMeta.type)}">`);
|
|
478
|
+
if (imageMeta.width) parts.push(`<meta property="og:image:width" content="${imageMeta.width}">`);
|
|
479
|
+
if (imageMeta.height) parts.push(`<meta property="og:image:height" content="${imageMeta.height}">`);
|
|
480
|
+
}
|
|
472
481
|
parts.push(`<meta property="og:type" content="${esc(ogType)}">`);
|
|
473
482
|
if (canonicalBase) parts.push(`<meta property="og:url" content="${esc(canonicalBase + url)}">`);
|
|
474
483
|
if (siteName) parts.push(`<meta property="og:site_name" content="${esc(siteName)}">`);
|
|
@@ -531,6 +540,22 @@ function buildPageHead(options) {
|
|
|
531
540
|
}
|
|
532
541
|
return parts.join("\n");
|
|
533
542
|
}
|
|
543
|
+
function socialImageMeta(url) {
|
|
544
|
+
var _a;
|
|
545
|
+
try {
|
|
546
|
+
const parsed = new URL(url);
|
|
547
|
+
const format = (_a = parsed.searchParams.get("fmt")) == null ? void 0 : _a.toLowerCase();
|
|
548
|
+
const width = Number(parsed.searchParams.get("w"));
|
|
549
|
+
const height = Number(parsed.searchParams.get("h"));
|
|
550
|
+
return {
|
|
551
|
+
...format === "jpeg" || format === "jpg" ? { type: "image/jpeg" } : format === "png" ? { type: "image/png" } : format === "webp" ? { type: "image/webp" } : {},
|
|
552
|
+
...Number.isSafeInteger(width) && width > 0 ? { width } : {},
|
|
553
|
+
...Number.isSafeInteger(height) && height > 0 ? { height } : {}
|
|
554
|
+
};
|
|
555
|
+
} catch {
|
|
556
|
+
return {};
|
|
557
|
+
}
|
|
558
|
+
}
|
|
534
559
|
function buildSiteHead(website) {
|
|
535
560
|
var _a, _b, _c;
|
|
536
561
|
if (!website) return "";
|
|
@@ -1493,6 +1518,8 @@ const sitemapIndexEntry = /<sitemap>\s*<loc>[^<]+<\/loc>/gm;
|
|
|
1493
1518
|
const sitemapLoc = /<loc>([^<]+)<\/loc>/;
|
|
1494
1519
|
const loadingShell = /class=["'][^"']*\bblox-initial-loading\b/;
|
|
1495
1520
|
const embeddedCmsState = /\b__BLOX_HYDRATION__\b/;
|
|
1521
|
+
const generatedAssetRef = /<(?:script|link)\b[^>]*(?:src|href)=["']([^"']+)["'][^>]*>/gi;
|
|
1522
|
+
const contentHash = /-[A-Za-z0-9_-]{6,}\.(?:css|js)$/;
|
|
1496
1523
|
async function validateInternalLinks(outDir) {
|
|
1497
1524
|
const root = path.resolve(outDir);
|
|
1498
1525
|
const failures = [];
|
|
@@ -1529,6 +1556,7 @@ async function validateSsgOutput(options) {
|
|
|
1529
1556
|
const outDir = path.resolve(options.outDir);
|
|
1530
1557
|
const failures = [];
|
|
1531
1558
|
const checkInternalLinks = options.checkInternalLinks ?? true;
|
|
1559
|
+
const requireHashedAssets = options.requireHashedAssets ?? true;
|
|
1532
1560
|
const requiredFiles = options.requireFiles ?? [
|
|
1533
1561
|
"robots.txt",
|
|
1534
1562
|
"_redirects",
|
|
@@ -1550,6 +1578,13 @@ async function validateSsgOutput(options) {
|
|
|
1550
1578
|
if (loadingShell.test(html) && !embeddedCmsState.test(html)) {
|
|
1551
1579
|
failures.push(`${name}: contains only the Blox loading shell`);
|
|
1552
1580
|
}
|
|
1581
|
+
if (requireHashedAssets) {
|
|
1582
|
+
for (const asset of unhashedGeneratedAssets(html)) {
|
|
1583
|
+
failures.push(
|
|
1584
|
+
`${name}: generated asset "${asset}" is not content-hashed, but Blox sites serve /assets/* with immutable caching. Use an asset filename containing -[hash] before .css/.js.`
|
|
1585
|
+
);
|
|
1586
|
+
}
|
|
1587
|
+
}
|
|
1553
1588
|
if (checkInternalLinks) {
|
|
1554
1589
|
for (const href of relativeInternalLinks(html)) {
|
|
1555
1590
|
failures.push(
|
|
@@ -1584,6 +1619,17 @@ async function validateSsgOutput(options) {
|
|
|
1584
1619
|
${failures.map((item) => ` - ${item}`).join("\n")}`);
|
|
1585
1620
|
}
|
|
1586
1621
|
}
|
|
1622
|
+
function unhashedGeneratedAssets(html) {
|
|
1623
|
+
var _a;
|
|
1624
|
+
const found = /* @__PURE__ */ new Set();
|
|
1625
|
+
for (const match of html.matchAll(generatedAssetRef)) {
|
|
1626
|
+
const value = ((_a = match[1]) == null ? void 0 : _a.trim()) ?? "";
|
|
1627
|
+
const pathname = value.split(/[?#]/, 1)[0];
|
|
1628
|
+
if (!pathname.startsWith("/assets/") || !/\.(?:css|js)$/.test(pathname)) continue;
|
|
1629
|
+
if (!contentHash.test(pathname)) found.add(pathname);
|
|
1630
|
+
}
|
|
1631
|
+
return [...found];
|
|
1632
|
+
}
|
|
1587
1633
|
function relativeInternalLinks(html) {
|
|
1588
1634
|
var _a;
|
|
1589
1635
|
const found = /* @__PURE__ */ new Set();
|
|
@@ -445,7 +445,16 @@ function buildPageHead(options) {
|
|
|
445
445
|
const ogType = (override == null ? void 0 : override.ogType) ?? "website";
|
|
446
446
|
if (title) parts.push(`<meta property="og:title" content="${esc(title)}">`);
|
|
447
447
|
if (ogDesc) parts.push(`<meta property="og:description" content="${esc(ogDesc)}">`);
|
|
448
|
-
if (ogImage)
|
|
448
|
+
if (ogImage) {
|
|
449
|
+
parts.push(`<meta name="image" property="og:image" content="${esc(ogImage)}">`);
|
|
450
|
+
if (ogImage.startsWith("https://")) {
|
|
451
|
+
parts.push(`<meta property="og:image:secure_url" content="${esc(ogImage)}">`);
|
|
452
|
+
}
|
|
453
|
+
const imageMeta = socialImageMeta(ogImage);
|
|
454
|
+
if (imageMeta.type) parts.push(`<meta property="og:image:type" content="${esc(imageMeta.type)}">`);
|
|
455
|
+
if (imageMeta.width) parts.push(`<meta property="og:image:width" content="${imageMeta.width}">`);
|
|
456
|
+
if (imageMeta.height) parts.push(`<meta property="og:image:height" content="${imageMeta.height}">`);
|
|
457
|
+
}
|
|
449
458
|
parts.push(`<meta property="og:type" content="${esc(ogType)}">`);
|
|
450
459
|
if (canonicalBase) parts.push(`<meta property="og:url" content="${esc(canonicalBase + url)}">`);
|
|
451
460
|
if (siteName) parts.push(`<meta property="og:site_name" content="${esc(siteName)}">`);
|
|
@@ -508,6 +517,22 @@ function buildPageHead(options) {
|
|
|
508
517
|
}
|
|
509
518
|
return parts.join("\n");
|
|
510
519
|
}
|
|
520
|
+
function socialImageMeta(url) {
|
|
521
|
+
var _a;
|
|
522
|
+
try {
|
|
523
|
+
const parsed = new URL(url);
|
|
524
|
+
const format = (_a = parsed.searchParams.get("fmt")) == null ? void 0 : _a.toLowerCase();
|
|
525
|
+
const width = Number(parsed.searchParams.get("w"));
|
|
526
|
+
const height = Number(parsed.searchParams.get("h"));
|
|
527
|
+
return {
|
|
528
|
+
...format === "jpeg" || format === "jpg" ? { type: "image/jpeg" } : format === "png" ? { type: "image/png" } : format === "webp" ? { type: "image/webp" } : {},
|
|
529
|
+
...Number.isSafeInteger(width) && width > 0 ? { width } : {},
|
|
530
|
+
...Number.isSafeInteger(height) && height > 0 ? { height } : {}
|
|
531
|
+
};
|
|
532
|
+
} catch {
|
|
533
|
+
return {};
|
|
534
|
+
}
|
|
535
|
+
}
|
|
511
536
|
function buildSiteHead(website) {
|
|
512
537
|
var _a, _b, _c;
|
|
513
538
|
if (!website) return "";
|
|
@@ -1470,6 +1495,8 @@ const sitemapIndexEntry = /<sitemap>\s*<loc>[^<]+<\/loc>/gm;
|
|
|
1470
1495
|
const sitemapLoc = /<loc>([^<]+)<\/loc>/;
|
|
1471
1496
|
const loadingShell = /class=["'][^"']*\bblox-initial-loading\b/;
|
|
1472
1497
|
const embeddedCmsState = /\b__BLOX_HYDRATION__\b/;
|
|
1498
|
+
const generatedAssetRef = /<(?:script|link)\b[^>]*(?:src|href)=["']([^"']+)["'][^>]*>/gi;
|
|
1499
|
+
const contentHash = /-[A-Za-z0-9_-]{6,}\.(?:css|js)$/;
|
|
1473
1500
|
async function validateInternalLinks(outDir) {
|
|
1474
1501
|
const root = path.resolve(outDir);
|
|
1475
1502
|
const failures = [];
|
|
@@ -1506,6 +1533,7 @@ async function validateSsgOutput(options) {
|
|
|
1506
1533
|
const outDir = path.resolve(options.outDir);
|
|
1507
1534
|
const failures = [];
|
|
1508
1535
|
const checkInternalLinks = options.checkInternalLinks ?? true;
|
|
1536
|
+
const requireHashedAssets = options.requireHashedAssets ?? true;
|
|
1509
1537
|
const requiredFiles = options.requireFiles ?? [
|
|
1510
1538
|
"robots.txt",
|
|
1511
1539
|
"_redirects",
|
|
@@ -1527,6 +1555,13 @@ async function validateSsgOutput(options) {
|
|
|
1527
1555
|
if (loadingShell.test(html) && !embeddedCmsState.test(html)) {
|
|
1528
1556
|
failures.push(`${name}: contains only the Blox loading shell`);
|
|
1529
1557
|
}
|
|
1558
|
+
if (requireHashedAssets) {
|
|
1559
|
+
for (const asset of unhashedGeneratedAssets(html)) {
|
|
1560
|
+
failures.push(
|
|
1561
|
+
`${name}: generated asset "${asset}" is not content-hashed, but Blox sites serve /assets/* with immutable caching. Use an asset filename containing -[hash] before .css/.js.`
|
|
1562
|
+
);
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1530
1565
|
if (checkInternalLinks) {
|
|
1531
1566
|
for (const href of relativeInternalLinks(html)) {
|
|
1532
1567
|
failures.push(
|
|
@@ -1561,6 +1596,17 @@ async function validateSsgOutput(options) {
|
|
|
1561
1596
|
${failures.map((item) => ` - ${item}`).join("\n")}`);
|
|
1562
1597
|
}
|
|
1563
1598
|
}
|
|
1599
|
+
function unhashedGeneratedAssets(html) {
|
|
1600
|
+
var _a;
|
|
1601
|
+
const found = /* @__PURE__ */ new Set();
|
|
1602
|
+
for (const match of html.matchAll(generatedAssetRef)) {
|
|
1603
|
+
const value = ((_a = match[1]) == null ? void 0 : _a.trim()) ?? "";
|
|
1604
|
+
const pathname = value.split(/[?#]/, 1)[0];
|
|
1605
|
+
if (!pathname.startsWith("/assets/") || !/\.(?:css|js)$/.test(pathname)) continue;
|
|
1606
|
+
if (!contentHash.test(pathname)) found.add(pathname);
|
|
1607
|
+
}
|
|
1608
|
+
return [...found];
|
|
1609
|
+
}
|
|
1564
1610
|
function relativeInternalLinks(html) {
|
|
1565
1611
|
var _a;
|
|
1566
1612
|
const found = /* @__PURE__ */ new Set();
|
package/dist/vite-plugin.cjs
CHANGED
|
@@ -80,7 +80,7 @@ function bloxPlugin(options = {}) {
|
|
|
80
80
|
};
|
|
81
81
|
if (command === "build") {
|
|
82
82
|
const output = (_b = (_a = config.build) == null ? void 0 : _a.rollupOptions) == null ? void 0 : _b.output;
|
|
83
|
-
const assetFileNames = "assets/[name][extname]";
|
|
83
|
+
const assetFileNames = "assets/[name]-[hash][extname]";
|
|
84
84
|
ssrConfig.build = {
|
|
85
85
|
rollupOptions: {
|
|
86
86
|
output: Array.isArray(output) ? output.map((item) => ({ assetFileNames, ...item })) : { assetFileNames, ...output }
|
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export interface BloxPluginOptions {
|
|
|
3
3
|
/**
|
|
4
4
|
* Enable SSR-aware config injection.
|
|
5
5
|
* When true, adds `resolve.dedupe`, `resolve.alias` for Vue,
|
|
6
|
-
* SSR build rollup options, and
|
|
6
|
+
* SSR build rollup options, and content-hashed build asset filenames.
|
|
7
7
|
* @default false
|
|
8
8
|
*/
|
|
9
9
|
ssr?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAA;AAM9C,MAAM,WAAW,iBAAiB;IACjC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAc,MAAM,MAAM,CAAA;AAM9C,MAAM,WAAW,iBAAiB;IACjC;;;;;OAKG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;;;;;;;;;;;OAaG;IACH,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACzB;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,EAAE,CAiepE"}
|
package/dist/vite-plugin.mjs
CHANGED
|
@@ -56,7 +56,7 @@ function bloxPlugin(options = {}) {
|
|
|
56
56
|
};
|
|
57
57
|
if (command === "build") {
|
|
58
58
|
const output = (_b = (_a = config.build) == null ? void 0 : _a.rollupOptions) == null ? void 0 : _b.output;
|
|
59
|
-
const assetFileNames = "assets/[name][extname]";
|
|
59
|
+
const assetFileNames = "assets/[name]-[hash][extname]";
|
|
60
60
|
ssrConfig.build = {
|
|
61
61
|
rollupOptions: {
|
|
62
62
|
output: Array.isArray(output) ? output.map((item) => ({ assetFileNames, ...item })) : { assetFileNames, ...output }
|
package/package.json
CHANGED