@duffcloudservices/cms 0.13.8 → 0.13.10
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/README.md +4 -0
- package/dist/{chunk-W5Q6SOAP.js → chunk-JWXI5HAZ.js} +39 -3
- package/dist/chunk-JWXI5HAZ.js.map +1 -0
- package/dist/{chunk-GBHJVHXR.js → chunk-P6HQW635.js} +3 -3
- package/dist/{chunk-GBHJVHXR.js.map → chunk-P6HQW635.js.map} +1 -1
- package/dist/index.js +3 -3
- package/dist/plugins/index.d.ts +21 -1
- package/dist/plugins/index.js +30 -7
- package/dist/plugins/index.js.map +1 -1
- package/dist/seo/index.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-W5Q6SOAP.js.map +0 -1
package/README.md
CHANGED
|
@@ -319,6 +319,10 @@ dcsContentPlugin({
|
|
|
319
319
|
})
|
|
320
320
|
```
|
|
321
321
|
|
|
322
|
+
On production builds the plugin also injects the AI-assistant loader, a small inline `<script data-dcs-agent-loader>` in `<head>`. By default it asks the page's own host for `/api/v1/agent/config` first, then falls back to the platform route `/api/v1/sites/<slug>/agent/config`.
|
|
323
|
+
|
|
324
|
+
Some sites have a production host with no `/api` route, such as a site served from its SWA default hostname. For those, set `agent_config_origin: platform` in `.dcs/site.yaml`. The loader then makes one request to the platform route and never probes the page host, so no 404 appears in the visitor's console (C-1941). The served tag carries `data-dcs-agent-config-origin="platform"`. If the key is absent or set to `same-origin`, the loader is unchanged. Any other value is ignored with one build-time warning.
|
|
325
|
+
|
|
322
326
|
### dcsSeoPlugin
|
|
323
327
|
|
|
324
328
|
Injects `.dcs/seo.yaml` at build time and, opt-in, emits per-route static SEO.
|
|
@@ -1398,6 +1398,42 @@ var BodyPrerenderError = class extends Error {
|
|
|
1398
1398
|
this.errors = errors;
|
|
1399
1399
|
}
|
|
1400
1400
|
};
|
|
1401
|
+
var ATTR_RE = /\s([^\s"'=<>/]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/g;
|
|
1402
|
+
function readAttrs(tag) {
|
|
1403
|
+
const attrs = /* @__PURE__ */ new Map();
|
|
1404
|
+
const inner = tag.replace(/^<[a-zA-Z][^\s/>]*/, "").replace(/\/?>$/, "");
|
|
1405
|
+
ATTR_RE.lastIndex = 0;
|
|
1406
|
+
let m;
|
|
1407
|
+
while ((m = ATTR_RE.exec(inner)) !== null) {
|
|
1408
|
+
const name = m[1].toLowerCase();
|
|
1409
|
+
if (!attrs.has(name)) attrs.set(name, m[2] ?? m[3] ?? m[4] ?? "");
|
|
1410
|
+
}
|
|
1411
|
+
return attrs;
|
|
1412
|
+
}
|
|
1413
|
+
function disablePrehydrationSubmit(html) {
|
|
1414
|
+
if (!html.includes("dcs-form")) return html;
|
|
1415
|
+
const formOpenRe = /<form\b[^>]*>/gi;
|
|
1416
|
+
let out = "";
|
|
1417
|
+
let cursor = 0;
|
|
1418
|
+
let m;
|
|
1419
|
+
while ((m = formOpenRe.exec(html)) !== null) {
|
|
1420
|
+
const classes = (readAttrs(m[0]).get("class") ?? "").split(/\s+/);
|
|
1421
|
+
if (!classes.includes("dcs-form")) continue;
|
|
1422
|
+
const start = m.index + m[0].length;
|
|
1423
|
+
const closeIdx = html.toLowerCase().indexOf("</form", start);
|
|
1424
|
+
const end = closeIdx === -1 ? html.length : closeIdx;
|
|
1425
|
+
const inner = html.slice(start, end).replace(/<button\b[^>]*>/gi, (tag) => {
|
|
1426
|
+
const attrs = readAttrs(tag);
|
|
1427
|
+
if ((attrs.get("type") ?? "").toLowerCase() !== "submit") return tag;
|
|
1428
|
+
if (attrs.has("disabled")) return tag;
|
|
1429
|
+
return tag.replace(/\s*(\/?)>$/, (_close, slash) => ` disabled=""${slash}>`);
|
|
1430
|
+
});
|
|
1431
|
+
out += html.slice(cursor, start) + inner;
|
|
1432
|
+
cursor = end;
|
|
1433
|
+
formOpenRe.lastIndex = end;
|
|
1434
|
+
}
|
|
1435
|
+
return cursor === 0 ? html : out + html.slice(cursor);
|
|
1436
|
+
}
|
|
1401
1437
|
function spliceBodyHtml(html, bodyInnerHtml) {
|
|
1402
1438
|
const openRe = /<div\s+[^>]*\bid=["']app["'][^>]*>/i;
|
|
1403
1439
|
const openMatch = openRe.exec(html);
|
|
@@ -1484,7 +1520,7 @@ async function prerenderBodies(params) {
|
|
|
1484
1520
|
runtimeDescriptionCount: rendered.head.descriptionCount
|
|
1485
1521
|
});
|
|
1486
1522
|
}
|
|
1487
|
-
const body = (rendered.bodyHtml ?? "").trim();
|
|
1523
|
+
const body = disablePrehydrationSubmit((rendered.bodyHtml ?? "").trim());
|
|
1488
1524
|
if (body === "") {
|
|
1489
1525
|
skipped += 1;
|
|
1490
1526
|
if (debug) console.log(`[dcs-seo] body-prerender skip (empty render): ${route.path}`);
|
|
@@ -2219,5 +2255,5 @@ function createSeoTransformPageData(options) {
|
|
|
2219
2255
|
}
|
|
2220
2256
|
|
|
2221
2257
|
export { AI_BOTS, BodyPrerenderError, CANONICAL_CHARSET_META, CHARSET_BUDGET_BYTES, CHARSET_HEADROOM_WARN_BYTES, CharsetBudgetError, EmittedUrlError, EmittedUrlNotRunError, HeadHonestyError, HeadHonestyNotRunError, REQUIRED_POSTAL_ADDRESS_FIELDS, SEO_HEAD_ROUTE_HAS_NO_META, absolutizeUrl, assertHeadHonesty, assertHeadHonestyExecuted, auditCheckedTotal, auditSameOriginAssets, breadcrumbTrailFromRoute, buildBlogPosting, buildBreadcrumbList, buildFaqPage, buildGlobalGraph, buildHasCredential, buildHeadTags, buildLlmsTxt, buildReviewSchemaParts, buildRobotsTxt, buildSeoHeadRouteMap, buildSitemapXml, buildVitePressSeoHead, checkCharsetBudget, checkRemoteAssets, checkSameOriginAssets, classifyUrl, collectEmittedUrlsFromFiles, collectUrlsFromHtml, collectUrlsFromLlmsTxt, collectUrlsFromSitemap, createSeoTransformPageData, decodeHtmlEntities, dedupeUrls, defaultRelativePathToRoute, deriveSameAs, escapeJsonLd, extractBakedHead, filterRealFaq, filterRealReviews, findBusinessLicense, findCharsetByteOffset, findDuplicateNormalizedPaths, findGlobalSchemasOfType, findHeadHonestyExecutionFaults, findHeadHonestyViolations, findLocalBusinessSchema, findPostalAddressGaps, findReviewItemsForPage, formatCharsetHeadroomWarning, formatDuplicateNormalizedPaths, formatEmittedUrlAudit, formatEmittedUrlReport, formatHeadHonestyExecutionReport, formatHeadHonestyReport, formatPostalAddressGapReport, generateJsonLd, generateOpenGraphMeta, generateTwitterMeta, graphAbsorbs, graphIds, headInputIdentities, hoistCharsetMeta, installSeoHead, isBodyPrerenderEnabled, isHandAuthoredRobotsAcceptable, isLocalBusinessType, isManagedLinkRel, isManagedMetaTag, isRouteEmitted, isRouteIndexable, loadPagesManifest, normalizeHeadText, normalizeSeoHeadPath, parsePagesManifest, prerenderBodies, renderHeadTags, resolveHonestyMode, resolvePageSeo, routeExclusionReason, routeToOutputFile, slugToTitle, snapshotBakedManagedHeadTags, spliceBodyHtml, spliceHeadHtml, stripManagedHeadTags, sweepBakedManagedHeadTags };
|
|
2222
|
-
//# sourceMappingURL=chunk-
|
|
2223
|
-
//# sourceMappingURL=chunk-
|
|
2258
|
+
//# sourceMappingURL=chunk-JWXI5HAZ.js.map
|
|
2259
|
+
//# sourceMappingURL=chunk-JWXI5HAZ.js.map
|