@duffcloudservices/cms 0.13.3 → 0.13.5
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 +6 -2
- package/dist/{chunk-OGAJX4KM.js → chunk-GBHJVHXR.js} +116 -3
- package/dist/chunk-GBHJVHXR.js.map +1 -0
- package/dist/{chunk-64BUBTW7.js → chunk-W5Q6SOAP.js} +35 -3
- package/dist/chunk-W5Q6SOAP.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +22 -5
- package/dist/index.js.map +1 -1
- package/dist/{installSeoHead-EE0Z7UmK.d.ts → installSeoHead-CuVdVCis.d.ts} +1 -1
- package/dist/plugins/index.d.ts +12 -6
- package/dist/plugins/index.js +49 -33
- package/dist/plugins/index.js.map +1 -1
- package/dist/seo/index.d.ts +132 -7
- package/dist/seo/index.js +2 -2
- package/dist/{vitepressTransform-Ds5Hff8t.d.ts → vitepressTransform-CZ_IB3dq.d.ts} +47 -1
- package/package.json +9 -3
- package/src/components/LiteMediaEmbed.test.ts +74 -1
- package/src/components/ManagedImage.test.ts +16 -1
- package/src/components/PreviewRibbon.vue +11 -3
- package/src/components/ResponsiveImage.test.ts +16 -1
- package/src/components/raw-source-imports.test.ts +128 -4
- package/src/composables/resolveApiBaseUrl.test.ts +71 -0
- package/src/composables/resolveApiBaseUrl.ts +49 -0
- package/src/composables/useReleaseNotes.ts +3 -1
- package/src/composables/useSiteVersion.ts +3 -1
- package/dist/chunk-64BUBTW7.js.map +0 -1
- package/dist/chunk-OGAJX4KM.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as SeoConfiguration, x as BreadcrumbCrumb, z as ReviewSource, F as FaqSource, y as BlogMeta, T as ResolvedPageSeo, N as SeoSchemaConfig, G as GlobalSeoConfig, L as SeoOpenGraphConfig, M as SeoTwitterConfig } from './vitepressTransform-
|
|
1
|
+
import { H as SeoConfiguration, x as BreadcrumbCrumb, z as ReviewSource, F as FaqSource, y as BlogMeta, T as ResolvedPageSeo, N as SeoSchemaConfig, G as GlobalSeoConfig, L as SeoOpenGraphConfig, M as SeoTwitterConfig } from './vitepressTransform-CZ_IB3dq.js';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Framework-agnostic SEO head-tag resolution.
|
package/dist/plugins/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin, HtmlTagDescriptor } from 'vite';
|
|
2
|
-
import { D as DcsRobotsOptions, Y as SeoHonestyBlock, Z as PageRouteEntry, H as SeoConfiguration, E as ContentConfig } from '../vitepressTransform-
|
|
3
|
-
export { C as CreateSeoTransformPageDataOptions, R as ResolvedPageOverrides, S as SeoPageContext, r as SeoPageTypeRule, t as VitePressHeadConfig, V as VitePressPageData, b as buildVitePressSeoHead, c as createSeoTransformPageData, d as defaultRelativePathToRoute } from '../vitepressTransform-
|
|
2
|
+
import { D as DcsRobotsOptions, Y as SeoHonestyBlock, Z as PageRouteEntry, H as SeoConfiguration, E as ContentConfig } from '../vitepressTransform-CZ_IB3dq.js';
|
|
3
|
+
export { C as CreateSeoTransformPageDataOptions, R as ResolvedPageOverrides, S as SeoPageContext, r as SeoPageTypeRule, t as VitePressHeadConfig, V as VitePressPageData, b as buildVitePressSeoHead, c as createSeoTransformPageData, d as defaultRelativePathToRoute } from '../vitepressTransform-CZ_IB3dq.js';
|
|
4
4
|
import { H as HonestyMode } from '../headHonesty-OzxvLuwd.js';
|
|
5
5
|
import { Component, Plugin as Plugin$1 } from 'vue';
|
|
6
6
|
import MarkdownIt from 'markdown-it';
|
|
@@ -697,17 +697,23 @@ declare function dcsMotionTokensStyleTag(): HtmlTagDescriptor;
|
|
|
697
697
|
* this network-touching loader stays out of the dev server.
|
|
698
698
|
*/
|
|
699
699
|
|
|
700
|
-
/**
|
|
701
|
-
|
|
700
|
+
/**
|
|
701
|
+
* DCS API origin the loader calls when the build passes none (dcsContentPlugin
|
|
702
|
+
* feeds `process.env.VITE_API_BASE_URL` first). The value lives in this
|
|
703
|
+
* package's `package.json` `config` block (C-1062: no production URL as a source
|
|
704
|
+
* literal); the exported name is unchanged for consumers.
|
|
705
|
+
*/
|
|
706
|
+
declare const DEFAULT_AGENT_API_BASE_URL: string;
|
|
702
707
|
/**
|
|
703
708
|
* Versioned CDN URL of the widget bundle. Both `cdn.` (branding CDN, CorsAllowAll)
|
|
704
709
|
* and the already-live `files.` route serve the same `sgdcs` blob origin with an
|
|
705
710
|
* identical `/agent-widget/v1/...` layout, so this is a plain classic-script
|
|
706
711
|
* include that needs no CORS on the bundle host. Defaults to `files.` because the
|
|
707
712
|
* `cdn.` Front Door route is still provisioning-gated (enableCdnDomain=false) —
|
|
708
|
-
* flip the default only after that domain is live, or pass cdnScriptUrl.
|
|
713
|
+
* flip the default only after that domain is live, or pass cdnScriptUrl. The
|
|
714
|
+
* value lives in `package.json` `config.agentWidgetScriptUrl` (C-1062).
|
|
709
715
|
*/
|
|
710
|
-
declare const DEFAULT_AGENT_WIDGET_SCRIPT_URL
|
|
716
|
+
declare const DEFAULT_AGENT_WIDGET_SCRIPT_URL: string;
|
|
711
717
|
interface DcsAgentWidgetLoaderOptions {
|
|
712
718
|
/** Owning site slug — baked into the loader so it can build the config URL. */
|
|
713
719
|
siteSlug: string;
|
package/dist/plugins/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { buildSitemapXml, isHandAuthoredRobotsAcceptable, buildRobotsTxt, buildLlmsTxt, routeExclusionReason, breadcrumbTrailFromRoute, findReviewItemsForPage, findBusinessLicense, buildHeadTags, spliceHeadHtml, routeToOutputFile, loadPagesManifest, hoistCharsetMeta, checkCharsetBudget, isBodyPrerenderEnabled, resolveHonestyMode, assertHeadHonestyExecuted, findHeadHonestyViolations, assertHeadHonesty, isRouteEmitted, findDuplicateNormalizedPaths, formatDuplicateNormalizedPaths, prerenderBodies, CharsetBudgetError, formatCharsetHeadroomWarning, dedupeUrls, collectEmittedUrlsFromFiles, classifyUrl, auditSameOriginAssets, checkRemoteAssets, auditCheckedTotal, EmittedUrlNotRunError, formatEmittedUrlAudit, formatEmittedUrlReport, EmittedUrlError } from '../chunk-
|
|
2
|
-
export { buildVitePressSeoHead, createSeoTransformPageData, defaultRelativePathToRoute } from '../chunk-
|
|
1
|
+
import { buildSitemapXml, isHandAuthoredRobotsAcceptable, buildRobotsTxt, buildLlmsTxt, routeExclusionReason, breadcrumbTrailFromRoute, findReviewItemsForPage, findBusinessLicense, buildHeadTags, spliceHeadHtml, routeToOutputFile, loadPagesManifest, hoistCharsetMeta, checkCharsetBudget, findPostalAddressGaps, formatPostalAddressGapReport, isBodyPrerenderEnabled, resolveHonestyMode, assertHeadHonestyExecuted, findHeadHonestyViolations, assertHeadHonesty, isRouteEmitted, findDuplicateNormalizedPaths, formatDuplicateNormalizedPaths, prerenderBodies, CharsetBudgetError, formatCharsetHeadroomWarning, dedupeUrls, collectEmittedUrlsFromFiles, classifyUrl, auditSameOriginAssets, checkRemoteAssets, auditCheckedTotal, EmittedUrlNotRunError, formatEmittedUrlAudit, formatEmittedUrlReport, EmittedUrlError } from '../chunk-W5Q6SOAP.js';
|
|
2
|
+
export { buildVitePressSeoHead, createSeoTransformPageData, defaultRelativePathToRoute } from '../chunk-W5Q6SOAP.js';
|
|
3
3
|
import fs5 from 'fs';
|
|
4
4
|
import path5 from 'path';
|
|
5
5
|
import yaml4 from 'js-yaml';
|
|
6
6
|
import http from 'http';
|
|
7
7
|
import { defineComponent, h } from 'vue';
|
|
8
|
+
import { isVectorImageUrl } from '@duffcloudservices/cms-core';
|
|
8
9
|
|
|
9
10
|
function dcsSearchPaths(projectRoot, relPath) {
|
|
10
11
|
return [
|
|
@@ -68,8 +69,16 @@ function dcsMotionTokensStyleTag() {
|
|
|
68
69
|
injectTo: "head"
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
|
|
73
|
+
// package.json
|
|
74
|
+
var config = {
|
|
75
|
+
agentApiBaseUrl: "https://portal.duffcloudservices.com",
|
|
76
|
+
agentWidgetScriptUrl: "https://files.duffcloudservices.com/agent-widget/v1/dcs-agent-widget.js"
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
// src/plugins/agentWidget.ts
|
|
80
|
+
var DEFAULT_AGENT_API_BASE_URL = config.agentApiBaseUrl;
|
|
81
|
+
var DEFAULT_AGENT_WIDGET_SCRIPT_URL = config.agentWidgetScriptUrl;
|
|
73
82
|
var trimTrailingSlash = (value) => value.replace(/\/+$/, "");
|
|
74
83
|
var encodeForInlineScript = (value) => JSON.stringify(value).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
75
84
|
function buildAgentWidgetLoaderScript(options) {
|
|
@@ -118,11 +127,11 @@ function dcsContentPlugin(options = {}) {
|
|
|
118
127
|
let isDev = false;
|
|
119
128
|
return {
|
|
120
129
|
name: "dcs-content",
|
|
121
|
-
configResolved(
|
|
122
|
-
resolvedConfig =
|
|
123
|
-
isDev =
|
|
130
|
+
configResolved(config2) {
|
|
131
|
+
resolvedConfig = config2;
|
|
132
|
+
isDev = config2.command === "serve";
|
|
124
133
|
},
|
|
125
|
-
config(
|
|
134
|
+
config(config2, env) {
|
|
126
135
|
if (env.command === "serve") {
|
|
127
136
|
return {
|
|
128
137
|
define: {
|
|
@@ -131,7 +140,7 @@ function dcsContentPlugin(options = {}) {
|
|
|
131
140
|
ssr: { noExternal: DCS_SSR_NO_EXTERNAL }
|
|
132
141
|
};
|
|
133
142
|
}
|
|
134
|
-
const projectRoot =
|
|
143
|
+
const projectRoot = config2.root || process.cwd();
|
|
135
144
|
const possiblePaths = [
|
|
136
145
|
path5.resolve(projectRoot, contentPath),
|
|
137
146
|
path5.resolve(projectRoot, "..", contentPath),
|
|
@@ -271,6 +280,11 @@ function dcsContentPlugin(options = {}) {
|
|
|
271
280
|
}
|
|
272
281
|
};
|
|
273
282
|
}
|
|
283
|
+
function prerenderNavigationUrl(origin, routePath) {
|
|
284
|
+
const url = new URL(routePath, origin);
|
|
285
|
+
url.searchParams.set("dcs-no-telemetry", "");
|
|
286
|
+
return url.toString();
|
|
287
|
+
}
|
|
274
288
|
var CONTENT_TYPES = {
|
|
275
289
|
".html": "text/html; charset=utf-8",
|
|
276
290
|
".js": "text/javascript; charset=utf-8",
|
|
@@ -414,7 +428,7 @@ async function createPlaywrightRenderer(options) {
|
|
|
414
428
|
}
|
|
415
429
|
});
|
|
416
430
|
try {
|
|
417
|
-
await page.goto(server.origin
|
|
431
|
+
await page.goto(prerenderNavigationUrl(server.origin, routePath), {
|
|
418
432
|
waitUntil: "load",
|
|
419
433
|
timeout: navTimeoutMs
|
|
420
434
|
});
|
|
@@ -481,9 +495,9 @@ function readHonestyBlock(value) {
|
|
|
481
495
|
network: value.network
|
|
482
496
|
};
|
|
483
497
|
}
|
|
484
|
-
function resolveOutDir(
|
|
485
|
-
const out =
|
|
486
|
-
return path5.isAbsolute(out) ? out : path5.resolve(
|
|
498
|
+
function resolveOutDir(config2) {
|
|
499
|
+
const out = config2.build?.outDir || "dist";
|
|
500
|
+
return path5.isAbsolute(out) ? out : path5.resolve(config2.root || process.cwd(), out);
|
|
487
501
|
}
|
|
488
502
|
function loadSeoConfig(projectRoot, seoPath, debug) {
|
|
489
503
|
const possiblePaths = [
|
|
@@ -508,8 +522,8 @@ function loadSeoConfig(projectRoot, seoPath, debug) {
|
|
|
508
522
|
}
|
|
509
523
|
try {
|
|
510
524
|
const fileContent = fs5.readFileSync(foundPath, "utf8");
|
|
511
|
-
const
|
|
512
|
-
return { config, foundPath };
|
|
525
|
+
const config2 = yaml4.load(fileContent);
|
|
526
|
+
return { config: config2, foundPath };
|
|
513
527
|
} catch (error) {
|
|
514
528
|
console.warn("[dcs-seo] Failed to parse seo.yaml:", error);
|
|
515
529
|
return null;
|
|
@@ -964,11 +978,11 @@ function dcsSeoPlugin(options = {}) {
|
|
|
964
978
|
let isDev = false;
|
|
965
979
|
return {
|
|
966
980
|
name: "dcs-seo",
|
|
967
|
-
configResolved(
|
|
968
|
-
resolvedConfig =
|
|
969
|
-
isDev =
|
|
981
|
+
configResolved(config2) {
|
|
982
|
+
resolvedConfig = config2;
|
|
983
|
+
isDev = config2.command === "serve";
|
|
970
984
|
},
|
|
971
|
-
config(
|
|
985
|
+
config(config2, env) {
|
|
972
986
|
if (env.command === "serve") {
|
|
973
987
|
return {
|
|
974
988
|
define: {
|
|
@@ -977,7 +991,7 @@ function dcsSeoPlugin(options = {}) {
|
|
|
977
991
|
}
|
|
978
992
|
};
|
|
979
993
|
}
|
|
980
|
-
const projectRoot =
|
|
994
|
+
const projectRoot = config2.root || process.cwd();
|
|
981
995
|
const pagesDefine = (() => {
|
|
982
996
|
const routes = loadPagesManifest(projectRoot, pagesPath, debug);
|
|
983
997
|
if (!routes) {
|
|
@@ -1101,6 +1115,10 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1101
1115
|
}
|
|
1102
1116
|
const excludedGlobs = loadExcludedGlobs(projectRoot, pagesPath);
|
|
1103
1117
|
const contentConfig = loadContentConfig(projectRoot, contentPath, debug);
|
|
1118
|
+
const addressGaps = findPostalAddressGaps(loaded?.config?.global ?? {});
|
|
1119
|
+
if (addressGaps.length > 0) {
|
|
1120
|
+
console.warn(formatPostalAddressGapReport(addressGaps));
|
|
1121
|
+
}
|
|
1104
1122
|
const written = emitStaticSeoHtml({
|
|
1105
1123
|
outDir,
|
|
1106
1124
|
shellHtml,
|
|
@@ -1331,14 +1349,14 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1331
1349
|
if (!isDev) return html;
|
|
1332
1350
|
const projectRoot = resolvedConfig?.root || process.cwd();
|
|
1333
1351
|
const tags = [];
|
|
1334
|
-
const
|
|
1335
|
-
if (
|
|
1352
|
+
const config2 = readDcsYamlFresh(projectRoot, seoPath, "dcs-seo", debug);
|
|
1353
|
+
if (config2 !== void 0) {
|
|
1336
1354
|
if (debug) {
|
|
1337
1355
|
console.log("[dcs-seo] serve: injecting fresh __DCS_SEO__ into <head>");
|
|
1338
1356
|
}
|
|
1339
1357
|
tags.push({
|
|
1340
1358
|
tag: "script",
|
|
1341
|
-
children: buildGlobalAssignScript("__DCS_SEO__",
|
|
1359
|
+
children: buildGlobalAssignScript("__DCS_SEO__", config2),
|
|
1342
1360
|
injectTo: "head-prepend"
|
|
1343
1361
|
});
|
|
1344
1362
|
}
|
|
@@ -1430,9 +1448,9 @@ function dcsEditorPlugin(options = {}) {
|
|
|
1430
1448
|
return { server: { hmr: false } };
|
|
1431
1449
|
}
|
|
1432
1450
|
},
|
|
1433
|
-
configResolved(
|
|
1434
|
-
isDev =
|
|
1435
|
-
basePath =
|
|
1451
|
+
configResolved(config2) {
|
|
1452
|
+
isDev = config2.command === "serve";
|
|
1453
|
+
basePath = config2.base ?? "/";
|
|
1436
1454
|
isPreview = process.env.DCS_PREVIEW === "true";
|
|
1437
1455
|
},
|
|
1438
1456
|
resolveId(id) {
|
|
@@ -1637,7 +1655,7 @@ function dcsCdnImagePlugin(options = {}) {
|
|
|
1637
1655
|
const extraAttrs = otherAttrs ? " " + otherAttrs : "";
|
|
1638
1656
|
const sizesMatch = (beforeSrc + afterSrc).match(/data-sizes=["']([^"']*)["']/);
|
|
1639
1657
|
const sizes = sizesMatch ? sizesMatch[1] : defaultSizes;
|
|
1640
|
-
if (!entry.variants || entry.variants.length === 0) {
|
|
1658
|
+
if (!entry.variants || entry.variants.length === 0 || isVectorImageUrl(entry.cdnUrl)) {
|
|
1641
1659
|
return `<img src="${escapeHtml(entry.cdnUrl)}" alt="${escapeHtml(alt)}"${extraAttrs}${dimensionAttrs(entry)} loading="lazy" decoding="async" />`;
|
|
1642
1660
|
}
|
|
1643
1661
|
return buildPictureElement(entry, alt, extraAttrs, sizes);
|
|
@@ -1648,15 +1666,15 @@ function dcsCdnImagePlugin(options = {}) {
|
|
|
1648
1666
|
return {
|
|
1649
1667
|
name: "dcs-cdn-image",
|
|
1650
1668
|
enforce: "pre",
|
|
1651
|
-
configResolved(
|
|
1652
|
-
isProduction =
|
|
1669
|
+
configResolved(config2) {
|
|
1670
|
+
isProduction = config2.command === "build";
|
|
1653
1671
|
if (!isProduction) {
|
|
1654
1672
|
if (debug) {
|
|
1655
1673
|
console.log("[dcs-cdn-image] Dev mode \u2014 plugin disabled (local images served by Vite)");
|
|
1656
1674
|
}
|
|
1657
1675
|
return;
|
|
1658
1676
|
}
|
|
1659
|
-
imageMap = loadCdnImageMap(
|
|
1677
|
+
imageMap = loadCdnImageMap(config2.root, mapPath, debug);
|
|
1660
1678
|
},
|
|
1661
1679
|
transform(code, id) {
|
|
1662
1680
|
if (!isProduction || !imageMap) return;
|
|
@@ -1795,8 +1813,6 @@ function dcsCdnBuildEnd(options = {}) {
|
|
|
1795
1813
|
}
|
|
1796
1814
|
};
|
|
1797
1815
|
}
|
|
1798
|
-
|
|
1799
|
-
// src/plugins/responsiveImagePlugin.ts
|
|
1800
1816
|
var CDN_PATTERN = /^(https?:\/\/files\.[^/]+\/(?:content\/)?[^/]+\/assets\/(?:[^/]+\/)*)([a-f0-9-]+)\.(\w+)$/;
|
|
1801
1817
|
function escapeHtml2(str) {
|
|
1802
1818
|
return str.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
@@ -1808,7 +1824,7 @@ function responsiveImagePlugin(md) {
|
|
|
1808
1824
|
const src = token.attrGet("src") ?? "";
|
|
1809
1825
|
const alt = token.content ?? "";
|
|
1810
1826
|
const match = src.match(CDN_PATTERN);
|
|
1811
|
-
if (!match) {
|
|
1827
|
+
if (!match || isVectorImageUrl(src)) {
|
|
1812
1828
|
if (defaultImageRenderer) {
|
|
1813
1829
|
return defaultImageRenderer(tokens, idx, options, env, self);
|
|
1814
1830
|
}
|