@duffcloudservices/cms 0.14.0 → 0.16.0
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 +10 -0
- package/dist/chunk-KD2HFSIZ.js +10 -0
- package/dist/chunk-KD2HFSIZ.js.map +1 -0
- package/dist/editor/editorBridge.d.ts +27 -2
- package/dist/editor/editorBridge.js +247 -5
- package/dist/editor/editorBridge.js.map +1 -1
- package/dist/plugins/index.js +55 -21
- package/dist/plugins/index.js.map +1 -1
- package/package.json +3 -2
package/dist/plugins/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { config } from '../chunk-KD2HFSIZ.js';
|
|
1
2
|
import { buildSitemapXml, isHandAuthoredRobotsAcceptable, findAiTrainingRobotsConflicts, RobotsAiTrainingConflictError, appendAiTrainingOptOut, 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-CJATCOZJ.js';
|
|
2
3
|
export { buildVitePressSeoHead, createSeoTransformPageData, defaultRelativePathToRoute } from '../chunk-CJATCOZJ.js';
|
|
3
4
|
import fs8 from 'fs';
|
|
@@ -72,14 +73,6 @@ function dcsMotionTokensStyleTag() {
|
|
|
72
73
|
injectTo: "head"
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
|
-
|
|
76
|
-
// package.json
|
|
77
|
-
var config = {
|
|
78
|
-
agentApiBaseUrl: "https://portal.duffcloudservices.com",
|
|
79
|
-
agentWidgetScriptUrl: "https://files.duffcloudservices.com/agent-widget/v1/dcs-agent-widget.js"
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
// src/plugins/agentWidget.ts
|
|
83
76
|
var DEFAULT_AGENT_API_BASE_URL = config.agentApiBaseUrl;
|
|
84
77
|
var DEFAULT_AGENT_WIDGET_SCRIPT_URL = config.agentWidgetScriptUrl;
|
|
85
78
|
var AGENT_CONFIG_ORIGINS = ["same-origin", "platform"];
|
|
@@ -2308,8 +2301,50 @@ function dcsSeoPlugin(options = {}) {
|
|
|
2308
2301
|
}
|
|
2309
2302
|
};
|
|
2310
2303
|
}
|
|
2311
|
-
|
|
2312
|
-
|
|
2304
|
+
var PORTAL_ORIGIN_ENV = "VITE_DCS_PORTAL_ORIGIN";
|
|
2305
|
+
function editorBridgeModuleSource(portalOrigin) {
|
|
2306
|
+
const literal = portalOrigin === void 0 ? "undefined" : JSON.stringify(String(portalOrigin));
|
|
2307
|
+
return `
|
|
2308
|
+
import { initEditorBridge } from '@duffcloudservices/cms/editor'
|
|
2309
|
+
const startBridge = () => initEditorBridge({ portalOrigin: ${literal} })
|
|
2310
|
+
// The bridge only activates inside an iframe (portal preview)
|
|
2311
|
+
if (window.parent !== window) {
|
|
2312
|
+
if (document.readyState === 'loading') {
|
|
2313
|
+
document.addEventListener('DOMContentLoaded', () => setTimeout(startBridge, 200))
|
|
2314
|
+
} else {
|
|
2315
|
+
setTimeout(startBridge, 200)
|
|
2316
|
+
}
|
|
2317
|
+
}
|
|
2318
|
+
`;
|
|
2319
|
+
}
|
|
2320
|
+
var CONTENT_LOADER_ID = /\.data\.[cm]?[jt]s(?:$|\?)/;
|
|
2321
|
+
function isContentLoaderId(id) {
|
|
2322
|
+
return CONTENT_LOADER_ID.test(id);
|
|
2323
|
+
}
|
|
2324
|
+
function isInside(dir, file) {
|
|
2325
|
+
const rel = path7.relative(dir, file);
|
|
2326
|
+
return rel !== "" && !rel.startsWith("..") && !path7.isAbsolute(rel);
|
|
2327
|
+
}
|
|
2328
|
+
function invalidateContentLoadersOnChange(server) {
|
|
2329
|
+
const root = path7.resolve(server.config.root || process.cwd());
|
|
2330
|
+
const dcsDirs = [.../* @__PURE__ */ new Set([
|
|
2331
|
+
path7.resolve(root, ".dcs"),
|
|
2332
|
+
path7.resolve(root, "..", ".dcs"),
|
|
2333
|
+
path7.resolve(process.cwd(), ".dcs")
|
|
2334
|
+
])].filter((dir) => fs8.existsSync(dir));
|
|
2335
|
+
for (const dir of dcsDirs) {
|
|
2336
|
+
if (!isInside(root, dir)) server.watcher.add(dir);
|
|
2337
|
+
}
|
|
2338
|
+
const scopes = [root, ...dcsDirs];
|
|
2339
|
+
const onFile = (file) => {
|
|
2340
|
+
const abs = path7.resolve(file);
|
|
2341
|
+
if (!scopes.some((dir) => isInside(dir, abs))) return;
|
|
2342
|
+
for (const [id, mod] of server.moduleGraph.idToModuleMap) {
|
|
2343
|
+
if (isContentLoaderId(id)) server.moduleGraph.invalidateModule(mod);
|
|
2344
|
+
}
|
|
2345
|
+
};
|
|
2346
|
+
for (const event of ["change", "add", "unlink"]) server.watcher.on(event, onFile);
|
|
2347
|
+
}
|
|
2313
2348
|
function dcsEditorPlugin(options = {}) {
|
|
2314
2349
|
const { debug = false } = options;
|
|
2315
2350
|
const VIRTUAL_PATH = "/__dcs-editor-bridge.js";
|
|
@@ -2317,6 +2352,7 @@ function dcsEditorPlugin(options = {}) {
|
|
|
2317
2352
|
let isDev = false;
|
|
2318
2353
|
let basePath = "/";
|
|
2319
2354
|
let isPreview = false;
|
|
2355
|
+
let portalOrigin;
|
|
2320
2356
|
return {
|
|
2321
2357
|
name: "dcs-editor-bridge",
|
|
2322
2358
|
// Preview only: stop Vite running an unreachable HMR WebSocket server.
|
|
@@ -2334,6 +2370,14 @@ function dcsEditorPlugin(options = {}) {
|
|
|
2334
2370
|
isDev = config2.command === "serve";
|
|
2335
2371
|
basePath = config2.base ?? "/";
|
|
2336
2372
|
isPreview = process.env.DCS_PREVIEW === "true";
|
|
2373
|
+
portalOrigin = config2.env?.[PORTAL_ORIGIN_ENV];
|
|
2374
|
+
},
|
|
2375
|
+
// Dev server only (Vite never calls configureServer for a build or for
|
|
2376
|
+
// `vite preview`). Active only in the DCS preview with HMR off; with HMR on,
|
|
2377
|
+
// VitePress refreshes its loaders from handleHotUpdate itself.
|
|
2378
|
+
configureServer(server) {
|
|
2379
|
+
if (process.env.DCS_PREVIEW !== "true" || server.config.server.hmr !== false) return;
|
|
2380
|
+
invalidateContentLoadersOnChange(server);
|
|
2337
2381
|
},
|
|
2338
2382
|
resolveId(id) {
|
|
2339
2383
|
if (id === VIRTUAL_PATH || id === RIBBON_VIRTUAL_PATH) {
|
|
@@ -2342,17 +2386,7 @@ function dcsEditorPlugin(options = {}) {
|
|
|
2342
2386
|
},
|
|
2343
2387
|
load(id) {
|
|
2344
2388
|
if (id === VIRTUAL_PATH) {
|
|
2345
|
-
return
|
|
2346
|
-
import { initEditorBridge } from '@duffcloudservices/cms/editor'
|
|
2347
|
-
// The bridge only activates inside an iframe (portal preview)
|
|
2348
|
-
if (window.parent !== window) {
|
|
2349
|
-
if (document.readyState === 'loading') {
|
|
2350
|
-
document.addEventListener('DOMContentLoaded', () => setTimeout(initEditorBridge, 200))
|
|
2351
|
-
} else {
|
|
2352
|
-
setTimeout(initEditorBridge, 200)
|
|
2353
|
-
}
|
|
2354
|
-
}
|
|
2355
|
-
`;
|
|
2389
|
+
return editorBridgeModuleSource(portalOrigin);
|
|
2356
2390
|
}
|
|
2357
2391
|
if (id === RIBBON_VIRTUAL_PATH) {
|
|
2358
2392
|
return `
|