@duffcloudservices/cms 0.13.15 → 0.15.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-P6HQW635.js → chunk-56RSSOAM.js} +3 -3
- package/dist/{chunk-P6HQW635.js.map → chunk-56RSSOAM.js.map} +1 -1
- package/dist/{chunk-JWXI5HAZ.js → chunk-CJATCOZJ.js} +198 -33
- package/dist/chunk-CJATCOZJ.js.map +1 -0
- package/dist/chunk-ZGVP7AKD.js +10 -0
- package/dist/chunk-ZGVP7AKD.js.map +1 -0
- package/dist/editor/editorBridge.d.ts +11 -2
- package/dist/editor/editorBridge.js +76 -2
- package/dist/editor/editorBridge.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/{installSeoHead-DPVmX-eY.d.ts → installSeoHead-CcNfcxNF.d.ts} +1 -1
- package/dist/plugins/index.d.ts +160 -4
- package/dist/plugins/index.js +664 -100
- package/dist/plugins/index.js.map +1 -1
- package/dist/seo/index.d.ts +4 -4
- package/dist/seo/index.js +2 -2
- package/dist/{vitepressTransform-BJrpGbVT.d.ts → vitepressTransform-CQXBpYEC.d.ts} +198 -20
- package/package.json +2 -1
- package/dist/chunk-JWXI5HAZ.js.map +0 -1
package/dist/plugins/index.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { config } from '../chunk-ZGVP7AKD.js';
|
|
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';
|
|
3
|
+
export { buildVitePressSeoHead, createSeoTransformPageData, defaultRelativePathToRoute } from '../chunk-CJATCOZJ.js';
|
|
4
|
+
import fs8 from 'fs';
|
|
4
5
|
import path7 from 'path';
|
|
5
|
-
import
|
|
6
|
+
import yaml5 from 'js-yaml';
|
|
6
7
|
import crypto from 'crypto';
|
|
7
8
|
import http from 'http';
|
|
9
|
+
import { execFileSync } from 'child_process';
|
|
10
|
+
import { builtinModules } from 'module';
|
|
8
11
|
import { defineComponent, h } from 'vue';
|
|
9
12
|
import { isVectorImageUrl } from '@duffcloudservices/cms-core';
|
|
10
13
|
|
|
@@ -16,7 +19,7 @@ function dcsSearchPaths(projectRoot, relPath) {
|
|
|
16
19
|
];
|
|
17
20
|
}
|
|
18
21
|
function resolveDcsFile(projectRoot, relPath) {
|
|
19
|
-
return dcsSearchPaths(projectRoot, relPath).find((p) =>
|
|
22
|
+
return dcsSearchPaths(projectRoot, relPath).find((p) => fs8.existsSync(p));
|
|
20
23
|
}
|
|
21
24
|
function readDcsYamlFresh(projectRoot, relPath, label, debug = false) {
|
|
22
25
|
const found = resolveDcsFile(projectRoot, relPath);
|
|
@@ -25,7 +28,7 @@ function readDcsYamlFresh(projectRoot, relPath, label, debug = false) {
|
|
|
25
28
|
return void 0;
|
|
26
29
|
}
|
|
27
30
|
try {
|
|
28
|
-
return
|
|
31
|
+
return yaml5.load(fs8.readFileSync(found, "utf8"));
|
|
29
32
|
} catch (error) {
|
|
30
33
|
console.warn(`[${label}] serve: failed to parse ${relPath}:`, error);
|
|
31
34
|
return void 0;
|
|
@@ -70,14 +73,6 @@ function dcsMotionTokensStyleTag() {
|
|
|
70
73
|
injectTo: "head"
|
|
71
74
|
};
|
|
72
75
|
}
|
|
73
|
-
|
|
74
|
-
// package.json
|
|
75
|
-
var config = {
|
|
76
|
-
agentApiBaseUrl: "https://portal.duffcloudservices.com",
|
|
77
|
-
agentWidgetScriptUrl: "https://files.duffcloudservices.com/agent-widget/v1/dcs-agent-widget.js"
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
// src/plugins/agentWidget.ts
|
|
81
76
|
var DEFAULT_AGENT_API_BASE_URL = config.agentApiBaseUrl;
|
|
82
77
|
var DEFAULT_AGENT_WIDGET_SCRIPT_URL = config.agentWidgetScriptUrl;
|
|
83
78
|
var AGENT_CONFIG_ORIGINS = ["same-origin", "platform"];
|
|
@@ -103,8 +98,8 @@ function readSiteYaml(projectRoot) {
|
|
|
103
98
|
];
|
|
104
99
|
for (const candidate of candidates) {
|
|
105
100
|
try {
|
|
106
|
-
if (!
|
|
107
|
-
const parsed =
|
|
101
|
+
if (!fs8.existsSync(candidate)) continue;
|
|
102
|
+
const parsed = yaml5.load(fs8.readFileSync(candidate, "utf8"));
|
|
108
103
|
const slug = parsed && typeof parsed.site_slug === "string" ? parsed.site_slug.trim() : "";
|
|
109
104
|
if (parsed && slug) return { slug, fields: parsed };
|
|
110
105
|
} catch {
|
|
@@ -172,7 +167,7 @@ function dcsContentPlugin(options = {}) {
|
|
|
172
167
|
];
|
|
173
168
|
let foundPath;
|
|
174
169
|
for (const testPath of possiblePaths) {
|
|
175
|
-
if (
|
|
170
|
+
if (fs8.existsSync(testPath)) {
|
|
176
171
|
foundPath = testPath;
|
|
177
172
|
break;
|
|
178
173
|
}
|
|
@@ -191,8 +186,8 @@ function dcsContentPlugin(options = {}) {
|
|
|
191
186
|
};
|
|
192
187
|
}
|
|
193
188
|
try {
|
|
194
|
-
const fileContent =
|
|
195
|
-
const content =
|
|
189
|
+
const fileContent = fs8.readFileSync(foundPath, "utf8");
|
|
190
|
+
const content = yaml5.load(fileContent);
|
|
196
191
|
if (debug) {
|
|
197
192
|
console.log(`[dcs-content] Loaded ${foundPath}`);
|
|
198
193
|
console.log(`[dcs-content] Version: ${content.version}`);
|
|
@@ -286,7 +281,7 @@ function dcsContentPlugin(options = {}) {
|
|
|
286
281
|
path7.resolve(projectRoot, "..", contentPath)
|
|
287
282
|
].map((p) => path7.normalize(p));
|
|
288
283
|
watchPaths.forEach((watchPath) => {
|
|
289
|
-
if (
|
|
284
|
+
if (fs8.existsSync(watchPath)) {
|
|
290
285
|
server.watcher.add(watchPath);
|
|
291
286
|
}
|
|
292
287
|
});
|
|
@@ -338,15 +333,15 @@ function dcsResponsiveImageLint(options = {}) {
|
|
|
338
333
|
return async (siteConfig) => {
|
|
339
334
|
const report = { filesScanned: 0, violations: [] };
|
|
340
335
|
const outDir = siteConfig.outDir;
|
|
341
|
-
if (!outDir || !
|
|
336
|
+
if (!outDir || !fs8.existsSync(outDir)) return report;
|
|
342
337
|
const walk = (dir) => {
|
|
343
|
-
for (const entry of
|
|
338
|
+
for (const entry of fs8.readdirSync(dir, { withFileTypes: true })) {
|
|
344
339
|
const full = path7.join(dir, entry.name);
|
|
345
340
|
if (entry.isDirectory()) {
|
|
346
341
|
walk(full);
|
|
347
342
|
} else if (extensions.some((ext) => entry.name.endsWith(ext))) {
|
|
348
343
|
report.filesScanned++;
|
|
349
|
-
const html =
|
|
344
|
+
const html = fs8.readFileSync(full, "utf8");
|
|
350
345
|
if (!html.includes("/assets/")) continue;
|
|
351
346
|
const rel = path7.relative(outDir, full);
|
|
352
347
|
for (const v of findFullSizeCdnImages(html)) {
|
|
@@ -416,7 +411,7 @@ function resolveManifestPath(options) {
|
|
|
416
411
|
function realpathNearest(p) {
|
|
417
412
|
let cur = path7.resolve(p);
|
|
418
413
|
const tail = [];
|
|
419
|
-
while (!
|
|
414
|
+
while (!fs8.existsSync(cur)) {
|
|
420
415
|
const parent = path7.dirname(cur);
|
|
421
416
|
if (parent === cur) break;
|
|
422
417
|
tail.unshift(path7.basename(cur));
|
|
@@ -424,7 +419,7 @@ function realpathNearest(p) {
|
|
|
424
419
|
}
|
|
425
420
|
let real = cur;
|
|
426
421
|
try {
|
|
427
|
-
real =
|
|
422
|
+
real = fs8.realpathSync.native(cur);
|
|
428
423
|
} catch {
|
|
429
424
|
}
|
|
430
425
|
return path7.join(real, ...tail);
|
|
@@ -441,21 +436,21 @@ function clearDirIndexManifest(manifestPath = process.env[DIR_INDEX_MANIFEST_ENV
|
|
|
441
436
|
if (!manifestPath) return void 0;
|
|
442
437
|
const file = path7.resolve(manifestPath);
|
|
443
438
|
try {
|
|
444
|
-
const st =
|
|
439
|
+
const st = fs8.lstatSync(file);
|
|
445
440
|
if (!st.isFile() && !st.isSymbolicLink()) return void 0;
|
|
446
441
|
} catch {
|
|
447
442
|
return void 0;
|
|
448
443
|
}
|
|
449
|
-
|
|
444
|
+
fs8.unlinkSync(file);
|
|
450
445
|
return file;
|
|
451
446
|
}
|
|
452
447
|
var sha256 = (bytes) => crypto.createHash("sha256").update(bytes).digest("hex");
|
|
453
448
|
function writeManifest(file, manifest) {
|
|
454
|
-
|
|
449
|
+
fs8.mkdirSync(path7.dirname(file), { recursive: true });
|
|
455
450
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
456
|
-
|
|
451
|
+
fs8.writeFileSync(tmp, `${JSON.stringify(manifest, null, 2)}
|
|
457
452
|
`);
|
|
458
|
-
|
|
453
|
+
fs8.renameSync(tmp, file);
|
|
459
454
|
}
|
|
460
455
|
function emitDirectoryIndexes(siteConfig, options = {}) {
|
|
461
456
|
const outDir = siteConfig.outDir;
|
|
@@ -466,7 +461,7 @@ function emitDirectoryIndexes(siteConfig, options = {}) {
|
|
|
466
461
|
`[dcs-dir-index] ${DIR_INDEX_MANIFEST_ENV}=${manifestPath} is inside outDir ${outDir}; the manifest must not ship with the site. Point it outside the build output.`
|
|
467
462
|
);
|
|
468
463
|
}
|
|
469
|
-
|
|
464
|
+
fs8.rmSync(manifestPath, { force: true });
|
|
470
465
|
}
|
|
471
466
|
if (siteConfig.cleanUrls !== true) {
|
|
472
467
|
if (!manifestPath) return { written: 0, identical: 0, twins: [] };
|
|
@@ -484,13 +479,13 @@ function emitDirectoryIndexes(siteConfig, options = {}) {
|
|
|
484
479
|
const dstRel = `${stem}/index.html`;
|
|
485
480
|
const src = path7.join(outDir, srcRel);
|
|
486
481
|
const dst = path7.join(outDir, dstRel);
|
|
487
|
-
if (!
|
|
482
|
+
if (!fs8.existsSync(src) || !fs8.statSync(src).isFile()) {
|
|
488
483
|
missing.push(`${page} -> ${srcRel}`);
|
|
489
484
|
continue;
|
|
490
485
|
}
|
|
491
|
-
const bytes =
|
|
492
|
-
if (
|
|
493
|
-
const existing =
|
|
486
|
+
const bytes = fs8.readFileSync(src);
|
|
487
|
+
if (fs8.existsSync(dst)) {
|
|
488
|
+
const existing = fs8.statSync(dst).isFile() ? fs8.readFileSync(dst) : null;
|
|
494
489
|
if (existing && existing.equals(bytes)) {
|
|
495
490
|
identicalRel.push(dstRel);
|
|
496
491
|
entries.push({ twin: dstRel, source: srcRel, sha256: sha256(bytes) });
|
|
@@ -519,8 +514,8 @@ function emitDirectoryIndexes(siteConfig, options = {}) {
|
|
|
519
514
|
${problems.join("\n")}`);
|
|
520
515
|
}
|
|
521
516
|
for (const t of toWrite) {
|
|
522
|
-
|
|
523
|
-
|
|
517
|
+
fs8.mkdirSync(path7.dirname(t.dst), { recursive: true });
|
|
518
|
+
fs8.writeFileSync(t.dst, t.bytes);
|
|
524
519
|
entries.push({ twin: t.rel, source: t.srcRel, sha256: sha256(t.bytes) });
|
|
525
520
|
}
|
|
526
521
|
const twins = [...toWrite.map((t) => t.rel), ...identicalRel].sort();
|
|
@@ -625,7 +620,7 @@ async function startStaticServer(outDir) {
|
|
|
625
620
|
}
|
|
626
621
|
let filePath = resolved;
|
|
627
622
|
try {
|
|
628
|
-
const stat =
|
|
623
|
+
const stat = fs8.statSync(filePath);
|
|
629
624
|
if (stat.isDirectory()) filePath = path7.join(filePath, "index.html");
|
|
630
625
|
} catch {
|
|
631
626
|
if (path7.extname(pathname)) {
|
|
@@ -635,7 +630,7 @@ async function startStaticServer(outDir) {
|
|
|
635
630
|
}
|
|
636
631
|
filePath = path7.join(outDir, "index.html");
|
|
637
632
|
}
|
|
638
|
-
|
|
633
|
+
fs8.readFile(filePath, (err, buf) => {
|
|
639
634
|
if (err) {
|
|
640
635
|
res.writeHead(404);
|
|
641
636
|
res.end();
|
|
@@ -794,6 +789,551 @@ async function createPlaywrightRenderer(options) {
|
|
|
794
789
|
}
|
|
795
790
|
};
|
|
796
791
|
}
|
|
792
|
+
var IDENTICAL_LASTMOD_ROUTE_LIMIT = 3;
|
|
793
|
+
var CONTENT_WALK_LIMIT = 300;
|
|
794
|
+
var DEFAULT_LASTMOD_EXCLUDE = [
|
|
795
|
+
// App shell, routing, entry points
|
|
796
|
+
"App.vue",
|
|
797
|
+
"main.{ts,js,mts,mjs}",
|
|
798
|
+
"**/router/**",
|
|
799
|
+
// Layouts (VitePress theme Layout.vue, any layouts/ dir) and theme/config shell
|
|
800
|
+
"Layout.vue",
|
|
801
|
+
"**/layouts/**",
|
|
802
|
+
"**/.vitepress/config.*",
|
|
803
|
+
"**/.vitepress/theme/index.*",
|
|
804
|
+
// Site-wide header / footer / nav / banner chrome
|
|
805
|
+
"{App,Site,Main,Global,Top,Page,The,Mobile,}{Header,Footer,Nav,NavBar,Navbar,Navigation,NavMenu,Banner,AnnouncementBanner}.vue",
|
|
806
|
+
// Non-content code
|
|
807
|
+
"**/composables/**",
|
|
808
|
+
"**/stores/**",
|
|
809
|
+
"**/lib/**",
|
|
810
|
+
"**/utils/**",
|
|
811
|
+
"**/components/ui/**",
|
|
812
|
+
// Styles and tests
|
|
813
|
+
"*.{css,scss,sass,less,styl,pcss,postcss}",
|
|
814
|
+
"*.{test,spec}.*",
|
|
815
|
+
"**/__tests__/**",
|
|
816
|
+
// DCS metadata: seo/pages/site are head + registry, content is dated per route
|
|
817
|
+
"**/.dcs/{seo,pages,site,content}.yaml",
|
|
818
|
+
"**/node_modules/**"
|
|
819
|
+
];
|
|
820
|
+
var defaultGit = (args, cwd) => execFileSync("git", args, {
|
|
821
|
+
cwd,
|
|
822
|
+
encoding: "utf8",
|
|
823
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
824
|
+
timeout: 6e4,
|
|
825
|
+
maxBuffer: 256 * 1024 * 1024,
|
|
826
|
+
windowsHide: true
|
|
827
|
+
});
|
|
828
|
+
function toPascal(value) {
|
|
829
|
+
return value.split(/[^A-Za-z0-9]+/).filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
830
|
+
}
|
|
831
|
+
function defaultRouteSourceCandidates(route) {
|
|
832
|
+
const rel = route.path.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
833
|
+
const isHome = rel === "";
|
|
834
|
+
const names = /* @__PURE__ */ new Set();
|
|
835
|
+
const slugName = toPascal(route.slug || "");
|
|
836
|
+
if (slugName) names.add(slugName);
|
|
837
|
+
const lastSegment = rel.split("/").pop() ?? "";
|
|
838
|
+
const segName = toPascal(lastSegment);
|
|
839
|
+
if (segName) names.add(segName);
|
|
840
|
+
if (isHome) names.add("Home");
|
|
841
|
+
const out = [];
|
|
842
|
+
for (const name of names) {
|
|
843
|
+
out.push(`src/views/${name}View.vue`, `src/views/${name}.vue`, `src/pages/${name}.vue`, `src/pages/${name}View.vue`);
|
|
844
|
+
}
|
|
845
|
+
if (isHome) {
|
|
846
|
+
out.push("index.md", "docs/index.md");
|
|
847
|
+
} else {
|
|
848
|
+
out.push(`${rel}.md`, `${rel}/index.md`, `docs/${rel}.md`, `docs/${rel}/index.md`);
|
|
849
|
+
}
|
|
850
|
+
return out;
|
|
851
|
+
}
|
|
852
|
+
function isFile(abs) {
|
|
853
|
+
try {
|
|
854
|
+
return fs8.statSync(abs).isFile();
|
|
855
|
+
} catch {
|
|
856
|
+
return false;
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
function routeEntries(route, projectRoot, sourcesForRoute) {
|
|
860
|
+
const custom = sourcesForRoute?.(route);
|
|
861
|
+
if (custom) {
|
|
862
|
+
return [...new Set(custom.filter((c) => typeof c === "string" && c).map((c) => path7.resolve(projectRoot, c)))].filter(isFile);
|
|
863
|
+
}
|
|
864
|
+
const first = defaultRouteSourceCandidates(route).map((c) => path7.resolve(projectRoot, c)).find(isFile);
|
|
865
|
+
return first ? [first] : [];
|
|
866
|
+
}
|
|
867
|
+
function escapeRe(s) {
|
|
868
|
+
return s.replace(/[.+^${}()|[\]\\]/g, "\\$&");
|
|
869
|
+
}
|
|
870
|
+
function lastmodGlobToRegExp(glob) {
|
|
871
|
+
const convert = (g) => {
|
|
872
|
+
let re = "";
|
|
873
|
+
for (let i = 0; i < g.length; i++) {
|
|
874
|
+
const c = g[i];
|
|
875
|
+
if (c === "*") {
|
|
876
|
+
if (g[i + 1] === "*") {
|
|
877
|
+
if (g[i + 2] === "/") {
|
|
878
|
+
re += "(?:.*/)?";
|
|
879
|
+
i += 2;
|
|
880
|
+
} else {
|
|
881
|
+
re += ".*";
|
|
882
|
+
i += 1;
|
|
883
|
+
}
|
|
884
|
+
} else {
|
|
885
|
+
re += "[^/]*";
|
|
886
|
+
}
|
|
887
|
+
} else if (c === "?") {
|
|
888
|
+
re += "[^/]";
|
|
889
|
+
} else if (c === "{") {
|
|
890
|
+
const end = g.indexOf("}", i);
|
|
891
|
+
if (end > i) {
|
|
892
|
+
re += "(?:" + g.slice(i + 1, end).split(",").map(convert).join("|") + ")";
|
|
893
|
+
i = end;
|
|
894
|
+
} else {
|
|
895
|
+
re += "\\{";
|
|
896
|
+
}
|
|
897
|
+
} else {
|
|
898
|
+
re += escapeRe(c);
|
|
899
|
+
}
|
|
900
|
+
}
|
|
901
|
+
return re;
|
|
902
|
+
};
|
|
903
|
+
return new RegExp("^" + convert(glob) + "$");
|
|
904
|
+
}
|
|
905
|
+
function toPosix(p) {
|
|
906
|
+
return p.split(path7.sep).join("/");
|
|
907
|
+
}
|
|
908
|
+
function makeExcluder(projectRoot, extra, alsoExcludeAbs) {
|
|
909
|
+
const plain = [...DEFAULT_LASTMOD_EXCLUDE, ...extra.filter((g) => !g.startsWith("!"))].map((g) => ({
|
|
910
|
+
re: lastmodGlobToRegExp(g),
|
|
911
|
+
base: !g.includes("/")
|
|
912
|
+
}));
|
|
913
|
+
const reinclude = extra.filter((g) => g.startsWith("!")).map((g) => ({ re: lastmodGlobToRegExp(g.slice(1)), base: !g.slice(1).includes("/") }));
|
|
914
|
+
const fixed = new Set(alsoExcludeAbs.map((a) => path7.resolve(a).toLowerCase()));
|
|
915
|
+
const test = (rules, rel) => rules.some((r) => r.re.test(r.base ? rel.split("/").pop() ?? rel : rel));
|
|
916
|
+
return (abs) => {
|
|
917
|
+
if (fixed.has(path7.resolve(abs).toLowerCase())) return true;
|
|
918
|
+
const rel = toPosix(path7.relative(projectRoot, abs));
|
|
919
|
+
if (!test(plain, rel)) return false;
|
|
920
|
+
return !test(reinclude, rel);
|
|
921
|
+
};
|
|
922
|
+
}
|
|
923
|
+
function expandGlob(absPattern) {
|
|
924
|
+
const posix = toPosix(absPattern);
|
|
925
|
+
const firstWild = posix.search(/[*?{]/);
|
|
926
|
+
if (firstWild < 0) return isFile(absPattern) ? [path7.resolve(absPattern)] : [];
|
|
927
|
+
const baseDir = posix.slice(0, posix.lastIndexOf("/", firstWild));
|
|
928
|
+
const re = lastmodGlobToRegExp(posix);
|
|
929
|
+
const out = [];
|
|
930
|
+
const walk = (dir, depth) => {
|
|
931
|
+
if (depth > 12) return;
|
|
932
|
+
let entries;
|
|
933
|
+
try {
|
|
934
|
+
entries = fs8.readdirSync(dir, { withFileTypes: true });
|
|
935
|
+
} catch {
|
|
936
|
+
return;
|
|
937
|
+
}
|
|
938
|
+
for (const e of entries) {
|
|
939
|
+
if (e.name === "node_modules" || e.name === ".git") continue;
|
|
940
|
+
const full = path7.join(dir, e.name);
|
|
941
|
+
if (e.isDirectory()) walk(full, depth + 1);
|
|
942
|
+
else if (e.isFile() && re.test(toPosix(full))) out.push(path7.resolve(full));
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
walk(baseDir || "/", 0);
|
|
946
|
+
return out;
|
|
947
|
+
}
|
|
948
|
+
var CODE_EXT = /\.(vue|[cm]?[jt]sx?|md)$/i;
|
|
949
|
+
var RESOLVE_EXTENSIONS = ["", ".ts", ".js", ".mts", ".mjs", ".tsx", ".jsx", ".vue", ".json", "/index.ts", "/index.js", "/index.vue"];
|
|
950
|
+
var BUILTINS = new Set(builtinModules);
|
|
951
|
+
var VITEPRESS_BUILTIN_TAGS = /* @__PURE__ */ new Set(["Badge", "Content", "ClientOnly"]);
|
|
952
|
+
var VITEPRESS_BUILTIN_LAYOUTS = /* @__PURE__ */ new Set(["doc", "home", "page", "false"]);
|
|
953
|
+
function stripComments(src) {
|
|
954
|
+
return src.replace(/\/\*[\s\S]*?\*\//g, "").replace(/^\s*\/\/.*$/gm, "");
|
|
955
|
+
}
|
|
956
|
+
function findSrcDir(file) {
|
|
957
|
+
let dir = path7.dirname(file);
|
|
958
|
+
for (let i = 0; i < 12; i++) {
|
|
959
|
+
if (fs8.existsSync(path7.join(dir, ".vitepress"))) return dir;
|
|
960
|
+
const up = path7.dirname(dir);
|
|
961
|
+
if (up === dir) return void 0;
|
|
962
|
+
dir = up;
|
|
963
|
+
}
|
|
964
|
+
return void 0;
|
|
965
|
+
}
|
|
966
|
+
function hasPackage(specifier, fromFile) {
|
|
967
|
+
const parts = specifier.split("/");
|
|
968
|
+
const pkg = specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0];
|
|
969
|
+
let dir = path7.dirname(fromFile);
|
|
970
|
+
for (let i = 0; i < 40; i++) {
|
|
971
|
+
if (fs8.existsSync(path7.join(dir, "node_modules", pkg))) return true;
|
|
972
|
+
const up = path7.dirname(dir);
|
|
973
|
+
if (up === dir) return false;
|
|
974
|
+
dir = up;
|
|
975
|
+
}
|
|
976
|
+
return false;
|
|
977
|
+
}
|
|
978
|
+
function resolveWithExtensions(base) {
|
|
979
|
+
for (const ext of RESOLVE_EXTENSIONS) {
|
|
980
|
+
const c = base + ext;
|
|
981
|
+
if (isFile(c)) return path7.resolve(c);
|
|
982
|
+
}
|
|
983
|
+
return void 0;
|
|
984
|
+
}
|
|
985
|
+
function resolveImport(specifierRaw, fromFile, projectRoot) {
|
|
986
|
+
const specifier = specifierRaw.replace(/[?#].*$/, "");
|
|
987
|
+
if (!specifier) return { kind: "unresolved" };
|
|
988
|
+
if (specifier.startsWith("node:") || BUILTINS.has(specifier)) return { kind: "package" };
|
|
989
|
+
if (specifier.startsWith("virtual:") || specifier.startsWith("\0")) return { kind: "unresolved" };
|
|
990
|
+
let base;
|
|
991
|
+
if (specifier.startsWith(".")) base = path7.resolve(path7.dirname(fromFile), specifier);
|
|
992
|
+
else if (specifier.startsWith("@/") || specifier.startsWith("~/")) base = path7.join(projectRoot, "src", specifier.slice(2));
|
|
993
|
+
else if (specifier.startsWith("@theme/")) {
|
|
994
|
+
const srcDir = findSrcDir(fromFile);
|
|
995
|
+
if (srcDir) base = path7.join(srcDir, ".vitepress", "theme", specifier.slice("@theme/".length));
|
|
996
|
+
} else if (specifier.startsWith("/")) {
|
|
997
|
+
const srcDir = findSrcDir(fromFile);
|
|
998
|
+
const hit2 = resolveWithExtensions(path7.join(projectRoot, specifier)) ?? (srcDir ? resolveWithExtensions(path7.join(srcDir, specifier)) : void 0);
|
|
999
|
+
return hit2 ? { kind: "file", file: hit2 } : { kind: "unresolved" };
|
|
1000
|
+
} else {
|
|
1001
|
+
return hasPackage(specifier, fromFile) ? { kind: "package" } : { kind: "unresolved" };
|
|
1002
|
+
}
|
|
1003
|
+
if (!base) return { kind: "unresolved" };
|
|
1004
|
+
const hit = resolveWithExtensions(base);
|
|
1005
|
+
return hit ? { kind: "file", file: hit } : { kind: "unresolved" };
|
|
1006
|
+
}
|
|
1007
|
+
function themeRegistry(srcDir, cache) {
|
|
1008
|
+
const hit = cache.get(srcDir);
|
|
1009
|
+
if (hit) return hit;
|
|
1010
|
+
const reg = /* @__PURE__ */ new Map();
|
|
1011
|
+
const themeDir = path7.join(srcDir, ".vitepress", "theme");
|
|
1012
|
+
const indexFile = ["index.ts", "index.js", "index.mts", "index.mjs"].map((f) => path7.join(themeDir, f)).find(isFile);
|
|
1013
|
+
if (indexFile) {
|
|
1014
|
+
const src = stripComments(fs8.readFileSync(indexFile, "utf8"));
|
|
1015
|
+
const idents = /* @__PURE__ */ new Map();
|
|
1016
|
+
for (const m of src.matchAll(/^\s*import\s+(\w+)\s+from\s+['"]([^'"]+)['"]/gm)) idents.set(m[1], m[2]);
|
|
1017
|
+
for (const m of src.matchAll(/\.component\(\s*['"]([\w-]+)['"]\s*,\s*(\w+)\s*\)/g)) {
|
|
1018
|
+
const spec = idents.get(m[2]);
|
|
1019
|
+
if (!spec) continue;
|
|
1020
|
+
const r = resolveImport(spec, indexFile, srcDir);
|
|
1021
|
+
if (r.kind === "file") {
|
|
1022
|
+
reg.set(m[1], r.file);
|
|
1023
|
+
reg.set(toPascal(m[1]), r.file);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
cache.set(srcDir, reg);
|
|
1028
|
+
return reg;
|
|
1029
|
+
}
|
|
1030
|
+
function dataLoaderInputs(src, loaderFile) {
|
|
1031
|
+
const srcDir = findSrcDir(loaderFile) ?? path7.dirname(loaderFile);
|
|
1032
|
+
const literals = (s) => [...s.matchAll(/['"]([^'"]+)['"]/g)].map((m) => m[1]);
|
|
1033
|
+
const out = [];
|
|
1034
|
+
let found = false;
|
|
1035
|
+
for (const m of src.matchAll(/createContentLoader\(\s*(\[[^\]]*\]|['"][^'"]+['"])/g)) {
|
|
1036
|
+
found = true;
|
|
1037
|
+
for (const g of literals(m[1])) out.push(...expandGlob(path7.resolve(srcDir, g)));
|
|
1038
|
+
}
|
|
1039
|
+
for (const m of src.matchAll(/\bwatch\s*:\s*(\[[^\]]*\]|['"][^'"]+['"])/g)) {
|
|
1040
|
+
found = true;
|
|
1041
|
+
for (const g of literals(m[1])) {
|
|
1042
|
+
const base = g.startsWith(".") ? path7.dirname(loaderFile) : srcDir;
|
|
1043
|
+
out.push(...expandGlob(path7.resolve(base, g)));
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
return found ? out : null;
|
|
1047
|
+
}
|
|
1048
|
+
function walkContentModules(entries, projectRoot, isExcluded, registryCache, fileCache) {
|
|
1049
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1050
|
+
const queue = [];
|
|
1051
|
+
for (const e of entries) {
|
|
1052
|
+
if (!seen.has(e)) {
|
|
1053
|
+
seen.add(e);
|
|
1054
|
+
queue.push(e);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
while (queue.length > 0) {
|
|
1058
|
+
const file = queue.shift();
|
|
1059
|
+
let info = fileCache.get(file);
|
|
1060
|
+
if (!info) {
|
|
1061
|
+
info = scanFile(file, projectRoot, registryCache);
|
|
1062
|
+
fileCache.set(file, info);
|
|
1063
|
+
}
|
|
1064
|
+
if (info.bad) return { files: [...seen], omitted: info.bad };
|
|
1065
|
+
for (const dep of info.deps) {
|
|
1066
|
+
if (seen.has(dep) || isExcluded(dep)) continue;
|
|
1067
|
+
seen.add(dep);
|
|
1068
|
+
queue.push(dep);
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
return { files: [...seen] };
|
|
1072
|
+
}
|
|
1073
|
+
function scanFile(file, projectRoot, registryCache) {
|
|
1074
|
+
if (!CODE_EXT.test(file)) return { deps: [] };
|
|
1075
|
+
let raw;
|
|
1076
|
+
try {
|
|
1077
|
+
raw = fs8.readFileSync(file, "utf8");
|
|
1078
|
+
} catch {
|
|
1079
|
+
return { deps: [], bad: "unresolved-import" };
|
|
1080
|
+
}
|
|
1081
|
+
const isMd = /\.md$/i.test(file);
|
|
1082
|
+
if (isMd) {
|
|
1083
|
+
const fm = raw.match(/^---\r?\n([\s\S]*?)\r?\n---/);
|
|
1084
|
+
const layout = fm?.[1].match(/^layout\s*:\s*(.*?)\s*$/m)?.[1].replace(/^['"]|['"]$/g, "");
|
|
1085
|
+
if (layout && !VITEPRESS_BUILTIN_LAYOUTS.has(layout)) return { deps: [], bad: "custom-layout" };
|
|
1086
|
+
}
|
|
1087
|
+
const body = isMd ? raw.replace(/^(```|~~~)[\s\S]*?^\1/gm, "") : raw;
|
|
1088
|
+
const code = isMd ? [...body.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script>/gi)].map((m) => m[1]).join("\n") : body;
|
|
1089
|
+
const src = stripComments(code);
|
|
1090
|
+
const deps = /* @__PURE__ */ new Set();
|
|
1091
|
+
if (/\.data\.[cm]?[jt]s$/i.test(file)) {
|
|
1092
|
+
const inputs = dataLoaderInputs(src, file);
|
|
1093
|
+
if (inputs === null) return { deps: [], bad: "data-loader" };
|
|
1094
|
+
for (const f of inputs) deps.add(f);
|
|
1095
|
+
}
|
|
1096
|
+
for (const m of src.matchAll(/(?:\bfrom\s*|\bimport\s*\(\s*|^\s*import\s+)['"]([^'"]+)['"]/gm)) {
|
|
1097
|
+
const r = resolveImport(m[1], file, projectRoot);
|
|
1098
|
+
if (r.kind === "unresolved") return { deps: [], bad: "unresolved-import" };
|
|
1099
|
+
if (r.kind === "file" && r.file !== path7.resolve(file)) deps.add(r.file);
|
|
1100
|
+
}
|
|
1101
|
+
for (const m of src.matchAll(/import\.meta\.glob(?:<[^>]*>)?\(\s*(\[[^\]]*\]|['"][^'"]+['"])/g)) {
|
|
1102
|
+
for (const lit of [...m[1].matchAll(/['"]([^'"]+)['"]/g)].map((x) => x[1])) {
|
|
1103
|
+
if (lit.startsWith("!")) continue;
|
|
1104
|
+
const abs = lit.startsWith("/") ? path7.join(projectRoot, lit) : path7.resolve(path7.dirname(file), lit);
|
|
1105
|
+
for (const f of expandGlob(abs)) deps.add(f);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
const srcDir = findSrcDir(file);
|
|
1109
|
+
if (srcDir) {
|
|
1110
|
+
const reg = themeRegistry(srcDir, registryCache);
|
|
1111
|
+
const markup = isMd ? body.replace(/<script\b[\s\S]*?<\/script>/gi, "").replace(/`[^`\n]*`/g, "") : raw.match(/<template\b[\s\S]*<\/template>/i)?.[0] ?? "";
|
|
1112
|
+
const tags = /* @__PURE__ */ new Set();
|
|
1113
|
+
for (const m of markup.matchAll(/<([A-Z][A-Za-z0-9]*)\b/g)) tags.add(m[1]);
|
|
1114
|
+
for (const m of markup.matchAll(/<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\b/g)) tags.add(toPascal(m[1]));
|
|
1115
|
+
for (const tag of tags) {
|
|
1116
|
+
const target = reg.get(tag);
|
|
1117
|
+
if (target) deps.add(target);
|
|
1118
|
+
else if (isMd && !VITEPRESS_BUILTIN_TAGS.has(tag)) return { deps: [], bad: "unresolved-component" };
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return { deps: [...deps] };
|
|
1122
|
+
}
|
|
1123
|
+
var ZERO_BLOB = /^0+$/;
|
|
1124
|
+
function findContentFile(projectRoot, contentPath) {
|
|
1125
|
+
const rel = contentPath ?? ".dcs/content.yaml";
|
|
1126
|
+
if (path7.isAbsolute(rel)) return isFile(rel) ? path7.resolve(rel) : void 0;
|
|
1127
|
+
return [path7.resolve(projectRoot, rel), path7.resolve(projectRoot, "..", rel), path7.resolve(process.cwd(), rel)].find(isFile);
|
|
1128
|
+
}
|
|
1129
|
+
function referencedGlobalKeys(files, globalKeys) {
|
|
1130
|
+
if (globalKeys.length === 0) return [];
|
|
1131
|
+
const text = files.filter((f) => CODE_EXT.test(f)).map((f) => {
|
|
1132
|
+
try {
|
|
1133
|
+
return fs8.readFileSync(f, "utf8");
|
|
1134
|
+
} catch {
|
|
1135
|
+
return "";
|
|
1136
|
+
}
|
|
1137
|
+
}).join("\n");
|
|
1138
|
+
return globalKeys.filter((k) => text.includes(`'${k}'`) || text.includes(`"${k}"`) || text.includes(`\`${k}\``));
|
|
1139
|
+
}
|
|
1140
|
+
function deriveRouteLastmods(options) {
|
|
1141
|
+
const {
|
|
1142
|
+
routes,
|
|
1143
|
+
projectRoot,
|
|
1144
|
+
sourcesForRoute,
|
|
1145
|
+
contentPath,
|
|
1146
|
+
exclude = [],
|
|
1147
|
+
contentWalkLimit = CONTENT_WALK_LIMIT,
|
|
1148
|
+
git = defaultGit,
|
|
1149
|
+
debug = false
|
|
1150
|
+
} = options;
|
|
1151
|
+
const omitted = /* @__PURE__ */ new Map();
|
|
1152
|
+
const sources = /* @__PURE__ */ new Map();
|
|
1153
|
+
const empty = (withheld) => {
|
|
1154
|
+
if (debug) console.log(`[dcs-seo] git-derived <lastmod> withheld: ${withheld}`);
|
|
1155
|
+
return { lastmods: /* @__PURE__ */ new Map(), withheld, omitted, sources };
|
|
1156
|
+
};
|
|
1157
|
+
let shallow;
|
|
1158
|
+
try {
|
|
1159
|
+
shallow = git(["rev-parse", "--is-shallow-repository"], projectRoot).trim();
|
|
1160
|
+
} catch {
|
|
1161
|
+
return empty("git-unavailable");
|
|
1162
|
+
}
|
|
1163
|
+
if (shallow === "true") return empty("shallow");
|
|
1164
|
+
if (shallow !== "false") return empty("git-unavailable");
|
|
1165
|
+
let top;
|
|
1166
|
+
try {
|
|
1167
|
+
top = path7.resolve(git(["rev-parse", "--show-toplevel"], projectRoot).trim());
|
|
1168
|
+
} catch {
|
|
1169
|
+
return empty("git-unavailable");
|
|
1170
|
+
}
|
|
1171
|
+
const relTop = (abs) => toPosix(path7.relative(top, abs));
|
|
1172
|
+
const contentFile = findContentFile(projectRoot, contentPath);
|
|
1173
|
+
const isExcluded = makeExcluder(projectRoot, exclude, contentFile ? [contentFile] : []);
|
|
1174
|
+
const registryCache = /* @__PURE__ */ new Map();
|
|
1175
|
+
const fileCache = /* @__PURE__ */ new Map();
|
|
1176
|
+
const routeFiles = /* @__PURE__ */ new Map();
|
|
1177
|
+
for (const route of routes) {
|
|
1178
|
+
if (routeFiles.has(route.path) || omitted.has(route.path)) continue;
|
|
1179
|
+
const entries = routeEntries(route, projectRoot, sourcesForRoute);
|
|
1180
|
+
if (entries.length === 0) {
|
|
1181
|
+
omitted.set(route.path, "no-source");
|
|
1182
|
+
continue;
|
|
1183
|
+
}
|
|
1184
|
+
const walked = walkContentModules(entries, projectRoot, isExcluded, registryCache, fileCache);
|
|
1185
|
+
if (walked.omitted) {
|
|
1186
|
+
omitted.set(route.path, walked.omitted);
|
|
1187
|
+
continue;
|
|
1188
|
+
}
|
|
1189
|
+
routeFiles.set(route.path, walked.files);
|
|
1190
|
+
}
|
|
1191
|
+
const allFiles = [...new Set([...routeFiles.values()].flat())];
|
|
1192
|
+
const material = contentFile ? [...allFiles, contentFile] : allFiles;
|
|
1193
|
+
const tracked = /* @__PURE__ */ new Set();
|
|
1194
|
+
const dirty = /* @__PURE__ */ new Set();
|
|
1195
|
+
const newest = /* @__PURE__ */ new Map();
|
|
1196
|
+
if (material.length > 0) {
|
|
1197
|
+
const rels = [...new Set(material.map(relTop))];
|
|
1198
|
+
try {
|
|
1199
|
+
for (const line of git(["-c", "core.quotepath=off", "ls-files"], top).split("\n")) {
|
|
1200
|
+
if (line.trim()) tracked.add(line.trim());
|
|
1201
|
+
}
|
|
1202
|
+
for (const line of git(["-c", "core.quotepath=off", "status", "--porcelain=v1", "--untracked-files=all"], top).split("\n")) {
|
|
1203
|
+
if (line.length <= 3) continue;
|
|
1204
|
+
for (const part of line.slice(3).trim().split(" -> ")) dirty.add(part.replace(/^"|"$/g, ""));
|
|
1205
|
+
}
|
|
1206
|
+
const dated = rels.filter((r) => tracked.has(r));
|
|
1207
|
+
for (let i = 0; i < dated.length; i += 150) {
|
|
1208
|
+
const out = git(
|
|
1209
|
+
["-c", "core.quotepath=off", "log", "--format=%x01%cI", "--name-only", "--cc", "--", ...dated.slice(i, i + 150)],
|
|
1210
|
+
top
|
|
1211
|
+
);
|
|
1212
|
+
let date = null;
|
|
1213
|
+
for (const line of out.split("\n")) {
|
|
1214
|
+
const t = line.trim();
|
|
1215
|
+
if (t.startsWith("")) {
|
|
1216
|
+
date = t.slice(1);
|
|
1217
|
+
continue;
|
|
1218
|
+
}
|
|
1219
|
+
if (!t || !date) continue;
|
|
1220
|
+
const known = newest.get(t);
|
|
1221
|
+
if (!known || Date.parse(date) > Date.parse(known)) newest.set(t, date);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
} catch {
|
|
1225
|
+
return empty("git-unavailable");
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
const isClean = (abs) => tracked.has(relTop(abs)) && !dirty.has(relTop(abs));
|
|
1229
|
+
let contentEntries = [];
|
|
1230
|
+
let contentCapped = false;
|
|
1231
|
+
let contentOk = true;
|
|
1232
|
+
const blobCache = /* @__PURE__ */ new Map();
|
|
1233
|
+
let globalKeys = [];
|
|
1234
|
+
if (contentFile) {
|
|
1235
|
+
if (!isClean(contentFile)) {
|
|
1236
|
+
contentOk = false;
|
|
1237
|
+
} else {
|
|
1238
|
+
try {
|
|
1239
|
+
const out = git(
|
|
1240
|
+
["log", "--first-parent", "-m", `-n${contentWalkLimit + 1}`, "--format=%x01%cI", "--raw", "--no-abbrev", "--", relTop(contentFile)],
|
|
1241
|
+
top
|
|
1242
|
+
);
|
|
1243
|
+
let date = null;
|
|
1244
|
+
for (const line of out.split("\n")) {
|
|
1245
|
+
const t = line.trim();
|
|
1246
|
+
if (t.startsWith("")) {
|
|
1247
|
+
date = t.slice(1);
|
|
1248
|
+
continue;
|
|
1249
|
+
}
|
|
1250
|
+
const m = t.match(/^:\d+ \d+ ([0-9a-f]+) ([0-9a-f]+) /);
|
|
1251
|
+
if (m && date) contentEntries.push({ date, oldBlob: m[1], newBlob: m[2] });
|
|
1252
|
+
}
|
|
1253
|
+
} catch {
|
|
1254
|
+
return empty("git-unavailable");
|
|
1255
|
+
}
|
|
1256
|
+
if (contentEntries.length > contentWalkLimit) {
|
|
1257
|
+
contentCapped = true;
|
|
1258
|
+
contentEntries = contentEntries.slice(0, contentWalkLimit);
|
|
1259
|
+
}
|
|
1260
|
+
try {
|
|
1261
|
+
const head = yaml5.load(fs8.readFileSync(contentFile, "utf8"));
|
|
1262
|
+
globalKeys = Object.keys(head?.global ?? {});
|
|
1263
|
+
} catch {
|
|
1264
|
+
contentOk = false;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
const loadBlob = (blob) => {
|
|
1269
|
+
if (ZERO_BLOB.test(blob)) return null;
|
|
1270
|
+
if (blobCache.has(blob)) return blobCache.get(blob) ?? null;
|
|
1271
|
+
let doc = null;
|
|
1272
|
+
try {
|
|
1273
|
+
doc = yaml5.load(git(["cat-file", "-p", blob], top)) ?? null;
|
|
1274
|
+
} catch {
|
|
1275
|
+
doc = null;
|
|
1276
|
+
}
|
|
1277
|
+
blobCache.set(blob, doc);
|
|
1278
|
+
return doc;
|
|
1279
|
+
};
|
|
1280
|
+
const subtreeKey = (doc, slug, keys) => {
|
|
1281
|
+
const pages = doc?.pages ?? {};
|
|
1282
|
+
const global = doc?.global ?? {};
|
|
1283
|
+
return JSON.stringify({ page: pages[slug] ?? null, global: keys.map((k) => [k, global[k] ?? null]) });
|
|
1284
|
+
};
|
|
1285
|
+
const lastmods = /* @__PURE__ */ new Map();
|
|
1286
|
+
for (const route of routes) {
|
|
1287
|
+
const files = routeFiles.get(route.path);
|
|
1288
|
+
if (!files || lastmods.has(route.path)) continue;
|
|
1289
|
+
if (!files.every(isClean)) {
|
|
1290
|
+
omitted.set(route.path, "untracked-source");
|
|
1291
|
+
continue;
|
|
1292
|
+
}
|
|
1293
|
+
let best = null;
|
|
1294
|
+
let undated = false;
|
|
1295
|
+
for (const f of files) {
|
|
1296
|
+
const d = newest.get(relTop(f));
|
|
1297
|
+
if (!d) {
|
|
1298
|
+
undated = true;
|
|
1299
|
+
break;
|
|
1300
|
+
}
|
|
1301
|
+
if (best === null || Date.parse(d) > Date.parse(best)) best = d;
|
|
1302
|
+
}
|
|
1303
|
+
if (undated || best === null) {
|
|
1304
|
+
omitted.set(route.path, "undated-source");
|
|
1305
|
+
continue;
|
|
1306
|
+
}
|
|
1307
|
+
if (contentFile) {
|
|
1308
|
+
if (!contentOk) {
|
|
1309
|
+
omitted.set(route.path, "content-untracked");
|
|
1310
|
+
continue;
|
|
1311
|
+
}
|
|
1312
|
+
const keys = referencedGlobalKeys(files, globalKeys);
|
|
1313
|
+
let contentDate = null;
|
|
1314
|
+
for (const e of contentEntries) {
|
|
1315
|
+
if (subtreeKey(loadBlob(e.newBlob), route.slug, keys) !== subtreeKey(loadBlob(e.oldBlob), route.slug, keys)) {
|
|
1316
|
+
contentDate = e.date;
|
|
1317
|
+
break;
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
if (contentDate === null && contentCapped) {
|
|
1321
|
+
omitted.set(route.path, "content-walk-cap");
|
|
1322
|
+
continue;
|
|
1323
|
+
}
|
|
1324
|
+
if (contentDate && Date.parse(contentDate) > Date.parse(best)) best = contentDate;
|
|
1325
|
+
}
|
|
1326
|
+
lastmods.set(route.path, best);
|
|
1327
|
+
sources.set(route.path, contentFile ? [...files, contentFile] : files);
|
|
1328
|
+
}
|
|
1329
|
+
if (lastmods.size >= IDENTICAL_LASTMOD_ROUTE_LIMIT && new Set(lastmods.values()).size === 1) {
|
|
1330
|
+
return empty("identical-dates");
|
|
1331
|
+
}
|
|
1332
|
+
if (debug) {
|
|
1333
|
+
for (const [p, why] of omitted) console.log(`[dcs-seo] <lastmod> omitted for ${p}: ${why}`);
|
|
1334
|
+
}
|
|
1335
|
+
return { lastmods, omitted, sources };
|
|
1336
|
+
}
|
|
797
1337
|
|
|
798
1338
|
// src/plugins/dcsSeoPlugin.ts
|
|
799
1339
|
function readHonestyBlock(value) {
|
|
@@ -818,7 +1358,7 @@ function loadSeoConfig(projectRoot, seoPath, debug) {
|
|
|
818
1358
|
];
|
|
819
1359
|
let foundPath;
|
|
820
1360
|
for (const testPath of possiblePaths) {
|
|
821
|
-
if (
|
|
1361
|
+
if (fs8.existsSync(testPath)) {
|
|
822
1362
|
foundPath = testPath;
|
|
823
1363
|
break;
|
|
824
1364
|
}
|
|
@@ -832,8 +1372,8 @@ function loadSeoConfig(projectRoot, seoPath, debug) {
|
|
|
832
1372
|
return null;
|
|
833
1373
|
}
|
|
834
1374
|
try {
|
|
835
|
-
const fileContent =
|
|
836
|
-
const config2 =
|
|
1375
|
+
const fileContent = fs8.readFileSync(foundPath, "utf8");
|
|
1376
|
+
const config2 = yaml5.load(fileContent);
|
|
837
1377
|
return { config: config2, foundPath };
|
|
838
1378
|
} catch (error) {
|
|
839
1379
|
console.warn("[dcs-seo] Failed to parse seo.yaml:", error);
|
|
@@ -846,13 +1386,13 @@ function loadContentConfig(projectRoot, contentRelPath, debug) {
|
|
|
846
1386
|
path7.resolve(projectRoot, "..", contentRelPath),
|
|
847
1387
|
path7.resolve(process.cwd(), contentRelPath)
|
|
848
1388
|
];
|
|
849
|
-
const foundPath = possiblePaths.find((p) =>
|
|
1389
|
+
const foundPath = possiblePaths.find((p) => fs8.existsSync(p));
|
|
850
1390
|
if (!foundPath) {
|
|
851
1391
|
if (debug) console.log(`[dcs-seo] No content.yaml found (reviews disabled)`);
|
|
852
1392
|
return void 0;
|
|
853
1393
|
}
|
|
854
1394
|
try {
|
|
855
|
-
const parsed =
|
|
1395
|
+
const parsed = yaml5.load(fs8.readFileSync(foundPath, "utf8"));
|
|
856
1396
|
if (!parsed || typeof parsed !== "object") return void 0;
|
|
857
1397
|
return parsed;
|
|
858
1398
|
} catch (error) {
|
|
@@ -866,10 +1406,10 @@ function loadExcludedGlobs(projectRoot, pagesPath) {
|
|
|
866
1406
|
path7.resolve(projectRoot, "..", pagesPath),
|
|
867
1407
|
path7.resolve(process.cwd(), pagesPath)
|
|
868
1408
|
];
|
|
869
|
-
const found = possiblePaths.find((p) =>
|
|
1409
|
+
const found = possiblePaths.find((p) => fs8.existsSync(p));
|
|
870
1410
|
if (!found) return [];
|
|
871
1411
|
try {
|
|
872
|
-
const raw =
|
|
1412
|
+
const raw = yaml5.load(fs8.readFileSync(found, "utf8"));
|
|
873
1413
|
const excluded = raw?.excluded;
|
|
874
1414
|
if (!Array.isArray(excluded)) return [];
|
|
875
1415
|
return excluded.filter((e) => typeof e === "string");
|
|
@@ -919,24 +1459,6 @@ function assertNoOrphanNoindexEntries(noindex, routes) {
|
|
|
919
1459
|
if (orphans.length === 0) return;
|
|
920
1460
|
throw new NoindexOrphanError(orphans, [...collectNoindexMatchKeys(routes)].sort());
|
|
921
1461
|
}
|
|
922
|
-
function deriveLastmod(seoConfig, projectRoot, pagesPath) {
|
|
923
|
-
const fromSeo = seoConfig?.lastUpdated;
|
|
924
|
-
if (typeof fromSeo === "string" && fromSeo.length > 0) return fromSeo;
|
|
925
|
-
const possiblePaths = [
|
|
926
|
-
path7.resolve(projectRoot, pagesPath),
|
|
927
|
-
path7.resolve(projectRoot, "..", pagesPath),
|
|
928
|
-
path7.resolve(process.cwd(), pagesPath)
|
|
929
|
-
];
|
|
930
|
-
const found = possiblePaths.find((p) => fs7.existsSync(p));
|
|
931
|
-
if (!found) return void 0;
|
|
932
|
-
try {
|
|
933
|
-
const raw = yaml4.load(fs7.readFileSync(found, "utf8"));
|
|
934
|
-
const fromPages = raw?.lastUpdated;
|
|
935
|
-
if (typeof fromPages === "string" && fromPages.length > 0) return fromPages;
|
|
936
|
-
} catch {
|
|
937
|
-
}
|
|
938
|
-
return void 0;
|
|
939
|
-
}
|
|
940
1462
|
function emitSiteFiles(params) {
|
|
941
1463
|
const {
|
|
942
1464
|
outDir,
|
|
@@ -950,12 +1472,25 @@ function emitSiteFiles(params) {
|
|
|
950
1472
|
preview = false,
|
|
951
1473
|
robots = {},
|
|
952
1474
|
llms = true,
|
|
1475
|
+
gitLastmod,
|
|
1476
|
+
lastmodSources,
|
|
1477
|
+
contentPath,
|
|
1478
|
+
git,
|
|
953
1479
|
debug = false
|
|
954
1480
|
} = params;
|
|
955
1481
|
const written = [];
|
|
956
1482
|
const effectiveSiteUrl = siteUrl || seoConfig?.global?.siteUrl;
|
|
957
1483
|
const excludedGlobs = loadExcludedGlobs(projectRoot, pagesPath);
|
|
958
|
-
const
|
|
1484
|
+
const gitOptIn = gitLastmod ?? seoConfig?.sitemap?.lastmodFromGit === true;
|
|
1485
|
+
const routeLastmods = !preview && gitOptIn ? deriveRouteLastmods({
|
|
1486
|
+
routes,
|
|
1487
|
+
projectRoot,
|
|
1488
|
+
sourcesForRoute: lastmodSources,
|
|
1489
|
+
contentPath,
|
|
1490
|
+
exclude: Array.isArray(seoConfig?.sitemap?.lastmodExclude) ? seoConfig.sitemap.lastmodExclude.filter((g) => typeof g === "string") : [],
|
|
1491
|
+
git,
|
|
1492
|
+
debug
|
|
1493
|
+
}).lastmods : void 0;
|
|
959
1494
|
let wroteSitemap = false;
|
|
960
1495
|
if (!preview) {
|
|
961
1496
|
const xml = buildSitemapXml({
|
|
@@ -965,10 +1500,10 @@ function emitSiteFiles(params) {
|
|
|
965
1500
|
exclude,
|
|
966
1501
|
noindex,
|
|
967
1502
|
excludedGlobs,
|
|
968
|
-
|
|
1503
|
+
routeLastmods
|
|
969
1504
|
});
|
|
970
1505
|
if (xml) {
|
|
971
|
-
|
|
1506
|
+
fs8.writeFileSync(path7.join(outDir, "sitemap.xml"), xml, "utf8");
|
|
972
1507
|
wroteSitemap = true;
|
|
973
1508
|
written.push("sitemap.xml");
|
|
974
1509
|
if (debug) console.log("[dcs-seo] wrote sitemap.xml");
|
|
@@ -976,21 +1511,36 @@ function emitSiteFiles(params) {
|
|
|
976
1511
|
console.log("[dcs-seo] no absolute <loc> derivable; sitemap.xml not written");
|
|
977
1512
|
}
|
|
978
1513
|
}
|
|
1514
|
+
const seoAiTraining = seoConfig?.robots?.aiTraining;
|
|
1515
|
+
const effectiveRobots = {
|
|
1516
|
+
...robots,
|
|
1517
|
+
aiTraining: robots.aiTraining ?? (typeof seoAiTraining === "boolean" ? seoAiTraining : true)
|
|
1518
|
+
};
|
|
979
1519
|
if (robots.enabled ?? true) {
|
|
980
1520
|
const robotsPath = path7.join(outDir, "robots.txt");
|
|
981
|
-
const existing =
|
|
1521
|
+
const existing = fs8.existsSync(robotsPath) && !robots.force ? fs8.readFileSync(robotsPath, "utf8") : null;
|
|
982
1522
|
const keepHandAuthored = existing !== null && isHandAuthoredRobotsAcceptable(existing);
|
|
983
1523
|
if (keepHandAuthored) {
|
|
984
|
-
if (
|
|
1524
|
+
if (effectiveRobots.aiTraining === false && !preview) {
|
|
1525
|
+
const conflicts = findAiTrainingRobotsConflicts(existing);
|
|
1526
|
+
if (conflicts.length > 0) throw new RobotsAiTrainingConflictError(robotsPath, conflicts);
|
|
1527
|
+
const { text, added } = appendAiTrainingOptOut(existing);
|
|
1528
|
+
if (added.length > 0) {
|
|
1529
|
+
fs8.writeFileSync(robotsPath, text, "utf8");
|
|
1530
|
+
written.push("robots.txt");
|
|
1531
|
+
}
|
|
1532
|
+
if (debug) console.log(`[dcs-seo] dist/robots.txt is hand-authored; appended AI training opt-out for ${added.join(", ") || "(none)"}`);
|
|
1533
|
+
} else if (debug) {
|
|
985
1534
|
console.log("[dcs-seo] dist/robots.txt is hand-authored and meets the floor; leaving it");
|
|
1535
|
+
}
|
|
986
1536
|
} else {
|
|
987
1537
|
const txt = buildRobotsTxt({
|
|
988
1538
|
siteUrl: effectiveSiteUrl,
|
|
989
1539
|
preview,
|
|
990
|
-
robots,
|
|
1540
|
+
robots: effectiveRobots,
|
|
991
1541
|
hasSitemap: wroteSitemap
|
|
992
1542
|
});
|
|
993
|
-
|
|
1543
|
+
fs8.writeFileSync(robotsPath, txt, "utf8");
|
|
994
1544
|
written.push("robots.txt");
|
|
995
1545
|
if (debug) {
|
|
996
1546
|
console.log(
|
|
@@ -1009,7 +1559,7 @@ function emitSiteFiles(params) {
|
|
|
1009
1559
|
excludedGlobs
|
|
1010
1560
|
});
|
|
1011
1561
|
if (txt) {
|
|
1012
|
-
|
|
1562
|
+
fs8.writeFileSync(path7.join(outDir, "llms.txt"), txt, "utf8");
|
|
1013
1563
|
written.push("llms.txt");
|
|
1014
1564
|
if (debug) console.log("[dcs-seo] wrote llms.txt");
|
|
1015
1565
|
} else if (debug) {
|
|
@@ -1076,8 +1626,8 @@ function emitStaticSeoHtml(params) {
|
|
|
1076
1626
|
});
|
|
1077
1627
|
const html = spliceHeadHtml(shellHtml, tags);
|
|
1078
1628
|
const outFile = routeToOutputFile(outDir, route.path);
|
|
1079
|
-
|
|
1080
|
-
|
|
1629
|
+
fs8.mkdirSync(path7.dirname(outFile), { recursive: true });
|
|
1630
|
+
fs8.writeFileSync(outFile, html, "utf8");
|
|
1081
1631
|
written++;
|
|
1082
1632
|
if (debug) {
|
|
1083
1633
|
console.log(
|
|
@@ -1235,7 +1785,7 @@ function runCharsetBudget(params) {
|
|
|
1235
1785
|
const file = routeToOutputFile(outDir, route.path);
|
|
1236
1786
|
let html;
|
|
1237
1787
|
try {
|
|
1238
|
-
html =
|
|
1788
|
+
html = fs8.readFileSync(file, "utf8");
|
|
1239
1789
|
} catch {
|
|
1240
1790
|
continue;
|
|
1241
1791
|
}
|
|
@@ -1284,6 +1834,8 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1284
1834
|
// release/** SWA preview build never body-prerenders; an explicit option wins.
|
|
1285
1835
|
preview = process.env.DCS_PREVIEW === "true",
|
|
1286
1836
|
llms = true,
|
|
1837
|
+
gitLastmod,
|
|
1838
|
+
lastmodSources,
|
|
1287
1839
|
dirIndex = true
|
|
1288
1840
|
} = options;
|
|
1289
1841
|
let resolvedConfig;
|
|
@@ -1385,12 +1937,12 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1385
1937
|
try {
|
|
1386
1938
|
const projectRoot = resolvedConfig?.root || process.cwd();
|
|
1387
1939
|
const outDir = resolveOutDir(resolvedConfig);
|
|
1388
|
-
if (!
|
|
1940
|
+
if (!fs8.existsSync(outDir)) {
|
|
1389
1941
|
console.warn(`[dcs-seo] emitStaticHtml: outDir not found (${outDir}); skipping`);
|
|
1390
1942
|
return;
|
|
1391
1943
|
}
|
|
1392
1944
|
const shellPath = path7.join(outDir, "index.html");
|
|
1393
|
-
if (!
|
|
1945
|
+
if (!fs8.existsSync(shellPath)) {
|
|
1394
1946
|
console.warn(
|
|
1395
1947
|
`[dcs-seo] emitStaticHtml: no index.html in ${outDir}; nothing to emit`
|
|
1396
1948
|
);
|
|
@@ -1409,7 +1961,7 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1409
1961
|
`[dcs-seo] emitStaticHtml: ${seoPath} missing or unparseable; emitting with defaults only`
|
|
1410
1962
|
);
|
|
1411
1963
|
}
|
|
1412
|
-
const rawShellHtml =
|
|
1964
|
+
const rawShellHtml = fs8.readFileSync(shellPath, "utf8");
|
|
1413
1965
|
const shellHtml = hoistCharsetMeta(rawShellHtml);
|
|
1414
1966
|
{
|
|
1415
1967
|
const b = checkCharsetBudget(rawShellHtml);
|
|
@@ -1425,7 +1977,7 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1425
1977
|
};
|
|
1426
1978
|
}
|
|
1427
1979
|
if (shellHtml !== rawShellHtml) {
|
|
1428
|
-
|
|
1980
|
+
fs8.writeFileSync(shellPath, shellHtml, "utf8");
|
|
1429
1981
|
const before = checkCharsetBudget(rawShellHtml);
|
|
1430
1982
|
const after = checkCharsetBudget(shellHtml);
|
|
1431
1983
|
console.log(
|
|
@@ -1465,6 +2017,9 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1465
2017
|
preview,
|
|
1466
2018
|
robots,
|
|
1467
2019
|
llms,
|
|
2020
|
+
gitLastmod,
|
|
2021
|
+
lastmodSources,
|
|
2022
|
+
contentPath,
|
|
1468
2023
|
debug
|
|
1469
2024
|
});
|
|
1470
2025
|
if (debug) {
|
|
@@ -1539,6 +2094,7 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1539
2094
|
renderForHonestyOnly
|
|
1540
2095
|
};
|
|
1541
2096
|
} catch (error) {
|
|
2097
|
+
if (error instanceof RobotsAiTrainingConflictError) throw error;
|
|
1542
2098
|
console.warn("[dcs-seo] emitStaticHtml failed; build output left unchanged:", error);
|
|
1543
2099
|
}
|
|
1544
2100
|
let headObservations = [];
|
|
@@ -1637,8 +2193,8 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1637
2193
|
} finally {
|
|
1638
2194
|
if (reportPath) {
|
|
1639
2195
|
try {
|
|
1640
|
-
|
|
1641
|
-
|
|
2196
|
+
fs8.mkdirSync(path7.dirname(path7.resolve(reportPath)), { recursive: true });
|
|
2197
|
+
fs8.writeFileSync(path7.resolve(reportPath), JSON.stringify(report, null, 2), "utf8");
|
|
1642
2198
|
console.log(`[dcs-seo] honesty report written: ${path7.resolve(reportPath)}`);
|
|
1643
2199
|
} catch (err) {
|
|
1644
2200
|
console.warn("[dcs-seo] could not write honesty report:", err);
|
|
@@ -1727,7 +2283,7 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1727
2283
|
path7.resolve(projectRoot, "..", seoPath)
|
|
1728
2284
|
].map((p) => path7.normalize(p));
|
|
1729
2285
|
watchPaths.forEach((watchPath) => {
|
|
1730
|
-
if (
|
|
2286
|
+
if (fs8.existsSync(watchPath)) {
|
|
1731
2287
|
server.watcher.add(watchPath);
|
|
1732
2288
|
}
|
|
1733
2289
|
});
|
|
@@ -1747,6 +2303,22 @@ function dcsSeoPlugin(options = {}) {
|
|
|
1747
2303
|
}
|
|
1748
2304
|
|
|
1749
2305
|
// src/plugins/dcsEditorPlugin.ts
|
|
2306
|
+
var PORTAL_ORIGIN_ENV = "VITE_DCS_PORTAL_ORIGIN";
|
|
2307
|
+
function editorBridgeModuleSource(portalOrigin) {
|
|
2308
|
+
const literal = portalOrigin === void 0 ? "undefined" : JSON.stringify(String(portalOrigin));
|
|
2309
|
+
return `
|
|
2310
|
+
import { initEditorBridge } from '@duffcloudservices/cms/editor'
|
|
2311
|
+
const startBridge = () => initEditorBridge({ portalOrigin: ${literal} })
|
|
2312
|
+
// The bridge only activates inside an iframe (portal preview)
|
|
2313
|
+
if (window.parent !== window) {
|
|
2314
|
+
if (document.readyState === 'loading') {
|
|
2315
|
+
document.addEventListener('DOMContentLoaded', () => setTimeout(startBridge, 200))
|
|
2316
|
+
} else {
|
|
2317
|
+
setTimeout(startBridge, 200)
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
`;
|
|
2321
|
+
}
|
|
1750
2322
|
function dcsEditorPlugin(options = {}) {
|
|
1751
2323
|
const { debug = false } = options;
|
|
1752
2324
|
const VIRTUAL_PATH = "/__dcs-editor-bridge.js";
|
|
@@ -1754,6 +2326,7 @@ function dcsEditorPlugin(options = {}) {
|
|
|
1754
2326
|
let isDev = false;
|
|
1755
2327
|
let basePath = "/";
|
|
1756
2328
|
let isPreview = false;
|
|
2329
|
+
let portalOrigin;
|
|
1757
2330
|
return {
|
|
1758
2331
|
name: "dcs-editor-bridge",
|
|
1759
2332
|
// Preview only: stop Vite running an unreachable HMR WebSocket server.
|
|
@@ -1771,6 +2344,7 @@ function dcsEditorPlugin(options = {}) {
|
|
|
1771
2344
|
isDev = config2.command === "serve";
|
|
1772
2345
|
basePath = config2.base ?? "/";
|
|
1773
2346
|
isPreview = process.env.DCS_PREVIEW === "true";
|
|
2347
|
+
portalOrigin = config2.env?.[PORTAL_ORIGIN_ENV];
|
|
1774
2348
|
},
|
|
1775
2349
|
resolveId(id) {
|
|
1776
2350
|
if (id === VIRTUAL_PATH || id === RIBBON_VIRTUAL_PATH) {
|
|
@@ -1779,17 +2353,7 @@ function dcsEditorPlugin(options = {}) {
|
|
|
1779
2353
|
},
|
|
1780
2354
|
load(id) {
|
|
1781
2355
|
if (id === VIRTUAL_PATH) {
|
|
1782
|
-
return
|
|
1783
|
-
import { initEditorBridge } from '@duffcloudservices/cms/editor'
|
|
1784
|
-
// The bridge only activates inside an iframe (portal preview)
|
|
1785
|
-
if (window.parent !== window) {
|
|
1786
|
-
if (document.readyState === 'loading') {
|
|
1787
|
-
document.addEventListener('DOMContentLoaded', () => setTimeout(initEditorBridge, 200))
|
|
1788
|
-
} else {
|
|
1789
|
-
setTimeout(initEditorBridge, 200)
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
`;
|
|
2356
|
+
return editorBridgeModuleSource(portalOrigin);
|
|
1793
2357
|
}
|
|
1794
2358
|
if (id === RIBBON_VIRTUAL_PATH) {
|
|
1795
2359
|
return `
|
|
@@ -1904,9 +2468,9 @@ function loadCdnImageMap(projectRoot, relativeMapPath, debug) {
|
|
|
1904
2468
|
path7.resolve(process.cwd(), relativeMapPath)
|
|
1905
2469
|
];
|
|
1906
2470
|
for (const testPath of possiblePaths) {
|
|
1907
|
-
if (
|
|
2471
|
+
if (fs8.existsSync(testPath)) {
|
|
1908
2472
|
try {
|
|
1909
|
-
const raw =
|
|
2473
|
+
const raw = fs8.readFileSync(testPath, "utf8");
|
|
1910
2474
|
const data = JSON.parse(raw);
|
|
1911
2475
|
const map = /* @__PURE__ */ new Map();
|
|
1912
2476
|
for (const entry of data.images) {
|
|
@@ -2070,11 +2634,11 @@ function dcsCdnBuildEnd(options = {}) {
|
|
|
2070
2634
|
return;
|
|
2071
2635
|
}
|
|
2072
2636
|
const outDir = siteConfig.outDir;
|
|
2073
|
-
if (!
|
|
2637
|
+
if (!fs8.existsSync(outDir)) return;
|
|
2074
2638
|
let filesProcessed = 0;
|
|
2075
2639
|
let refsReplaced = 0;
|
|
2076
2640
|
function walkDir(dir) {
|
|
2077
|
-
const entries =
|
|
2641
|
+
const entries = fs8.readdirSync(dir, { withFileTypes: true });
|
|
2078
2642
|
for (const entry of entries) {
|
|
2079
2643
|
const fullPath = path7.join(dir, entry.name);
|
|
2080
2644
|
if (entry.isDirectory()) {
|
|
@@ -2085,7 +2649,7 @@ function dcsCdnBuildEnd(options = {}) {
|
|
|
2085
2649
|
}
|
|
2086
2650
|
}
|
|
2087
2651
|
function processFile(filePath) {
|
|
2088
|
-
let content =
|
|
2652
|
+
let content = fs8.readFileSync(filePath, "utf8");
|
|
2089
2653
|
if (!pathPrefixes.some((p) => content.includes(p))) return;
|
|
2090
2654
|
let changed = false;
|
|
2091
2655
|
if (filePath.endsWith(".html")) {
|
|
@@ -2120,7 +2684,7 @@ function dcsCdnBuildEnd(options = {}) {
|
|
|
2120
2684
|
}
|
|
2121
2685
|
}
|
|
2122
2686
|
if (changed) {
|
|
2123
|
-
|
|
2687
|
+
fs8.writeFileSync(filePath, content, "utf8");
|
|
2124
2688
|
filesProcessed++;
|
|
2125
2689
|
}
|
|
2126
2690
|
}
|
|
@@ -2167,6 +2731,6 @@ function responsiveImagePlugin(md) {
|
|
|
2167
2731
|
};
|
|
2168
2732
|
}
|
|
2169
2733
|
|
|
2170
|
-
export { AGENT_CONFIG_ORIGINS, DCS_MOTION_TOKENS_CSS, DEFAULT_AGENT_API_BASE_URL, DEFAULT_AGENT_WIDGET_SCRIPT_URL, DIR_INDEX_INSTALLED, DIR_INDEX_MANIFEST_ENV, DIR_INDEX_MANIFEST_SCHEMA, DirIndexError, NoindexOrphanError, buildAgentWidgetLoaderScript, chainBuildEnd, clearDirIndexManifest, collectNoindexMatchKeys, dcsAgentWidgetLoaderTag, dcsCdnBuildEnd, dcsCdnImagePlugin, dcsContentPlugin, dcsDirIndexBuildEnd, dcsEditorPlugin, dcsMotionTokensStyleTag, dcsPreviewPlugin, dcsResponsiveImageLint, dcsSeoPlugin, dirIndexCandidates, emitDirectoryIndexes, emitSiteFiles, emitStaticSeoHtml, findFullSizeCdnImages, findOrphanNoindexEntries, installDirIndex, isFullSizeCdnUrl, readAgentConfigOrigin, readSiteSlug, responsiveImagePlugin };
|
|
2734
|
+
export { AGENT_CONFIG_ORIGINS, CONTENT_WALK_LIMIT, DCS_MOTION_TOKENS_CSS, DEFAULT_AGENT_API_BASE_URL, DEFAULT_AGENT_WIDGET_SCRIPT_URL, DEFAULT_LASTMOD_EXCLUDE, DIR_INDEX_INSTALLED, DIR_INDEX_MANIFEST_ENV, DIR_INDEX_MANIFEST_SCHEMA, DirIndexError, IDENTICAL_LASTMOD_ROUTE_LIMIT, NoindexOrphanError, buildAgentWidgetLoaderScript, chainBuildEnd, clearDirIndexManifest, collectNoindexMatchKeys, dcsAgentWidgetLoaderTag, dcsCdnBuildEnd, dcsCdnImagePlugin, dcsContentPlugin, dcsDirIndexBuildEnd, dcsEditorPlugin, dcsMotionTokensStyleTag, dcsPreviewPlugin, dcsResponsiveImageLint, dcsSeoPlugin, defaultRouteSourceCandidates, deriveRouteLastmods, dirIndexCandidates, emitDirectoryIndexes, emitSiteFiles, emitStaticSeoHtml, findFullSizeCdnImages, findOrphanNoindexEntries, installDirIndex, isFullSizeCdnUrl, lastmodGlobToRegExp, readAgentConfigOrigin, readSiteSlug, responsiveImagePlugin };
|
|
2171
2735
|
//# sourceMappingURL=index.js.map
|
|
2172
2736
|
//# sourceMappingURL=index.js.map
|