@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
package/dist/seo/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { H as HeadMetaTag, l as HeadLinkTag } from '../installSeoHead-
|
|
2
|
-
export { m as HeadScriptTag, o as HeadTagOverrides, I as InstallSeoHeadOptions, R as ResolvedHeadTags, B as SEO_HEAD_ROUTE_HAS_NO_META, q as SeoHeadClientLike, t as SeoHeadEntryLike, u as SeoHeadInput, v as SeoHeadPageRoute, w as SeoHeadPagesManifest, x as SeoHeadResolution, y as SeoHeadResolutionReason, C as SeoHeadRouteHasNoMeta, p as SeoHeadRouteLike, S as SeoHeadRouterLike, b as buildHeadTags, k as buildSeoHeadRouteMap, f as escapeJsonLd, z as findDuplicateNormalizedPaths, A as formatDuplicateNormalizedPaths, g as generateJsonLd, a as generateOpenGraphMeta, c as generateTwitterMeta, j as installSeoHead, h as isManagedLinkRel, i as isManagedMetaTag, n as normalizeSeoHeadPath, d as renderHeadTags, r as resolvePageSeo, s as spliceHeadHtml, e as stripManagedHeadTags } from '../installSeoHead-
|
|
3
|
-
import { Z as PageRouteEntry } from '../vitepressTransform-
|
|
4
|
-
export { A as AI_BOTS, y as BlogMeta, x as BreadcrumbCrumb, v as BuildLlmsParams, u as BuildRobotsParams, B as BuildSitemapParams, E as ContentConfig, C as CreateSeoTransformPageDataOptions, D as DcsRobotsOptions, F as FaqSource,
|
|
5
|
-
import { a as HeadObservation } from '../headHonesty-OzxvLuwd.js';
|
|
6
|
-
export { B as BakedHead, g as HeadHonestyError, l as HeadHonestyExecution, k as HeadHonestyNotRunError, p as HeadHonestyOptions, o as HeadHonestyViolation,
|
|
1
|
+
import { H as HeadMetaTag, l as HeadLinkTag } from '../installSeoHead-CuVdVCis.js';
|
|
2
|
+
export { m as HeadScriptTag, o as HeadTagOverrides, I as InstallSeoHeadOptions, R as ResolvedHeadTags, B as SEO_HEAD_ROUTE_HAS_NO_META, q as SeoHeadClientLike, t as SeoHeadEntryLike, u as SeoHeadInput, v as SeoHeadPageRoute, w as SeoHeadPagesManifest, x as SeoHeadResolution, y as SeoHeadResolutionReason, C as SeoHeadRouteHasNoMeta, p as SeoHeadRouteLike, S as SeoHeadRouterLike, b as buildHeadTags, k as buildSeoHeadRouteMap, f as escapeJsonLd, z as findDuplicateNormalizedPaths, A as formatDuplicateNormalizedPaths, g as generateJsonLd, a as generateOpenGraphMeta, c as generateTwitterMeta, j as installSeoHead, h as isManagedLinkRel, i as isManagedMetaTag, n as normalizeSeoHeadPath, d as renderHeadTags, r as resolvePageSeo, s as spliceHeadHtml, e as stripManagedHeadTags } from '../installSeoHead-CuVdVCis.js';
|
|
3
|
+
import { Z as PageRouteEntry } from '../vitepressTransform-CZ_IB3dq.js';
|
|
4
|
+
export { A as AI_BOTS, y as BlogMeta, x as BreadcrumbCrumb, v as BuildLlmsParams, u as BuildRobotsParams, B as BuildSitemapParams, E as ContentConfig, C as CreateSeoTransformPageDataOptions, D as DcsRobotsOptions, F as FaqSource, ag as NormalisedFaq, af as NormalisedReview, ai as PostalAddressGap, ab as REQUIRED_POSTAL_ADDRESS_FIELDS, R as ResolvedPageOverrides, ah as ReviewSchemaParts, z as ReviewSource, a2 as RouteEmissionRules, a3 as RouteExclusionReason, w as SchemaObject, S as SeoPageContext, r as SeoPageTypeRule, t as VitePressHeadConfig, V as VitePressPageData, q as absolutizeUrl, j as breadcrumbTrailFromRoute, k as buildBlogPosting, h as buildBreadcrumbList, l as buildFaqPage, g as buildGlobalGraph, a4 as buildHasCredential, f as buildLlmsTxt, m as buildReviewSchemaParts, e as buildRobotsTxt, a as buildSitemapXml, b as buildVitePressSeoHead, c as createSeoTransformPageData, d as defaultRelativePathToRoute, ac as deriveSameAs, o as filterRealFaq, n as filterRealReviews, a8 as findBusinessLicense, a6 as findGlobalSchemasOfType, a5 as findLocalBusinessSchema, a9 as findPostalAddressGaps, p as findReviewItemsForPage, aa as formatPostalAddressGapReport, a7 as graphAbsorbs, ad as graphIds, ae as isLocalBusinessType, a0 as isRouteEmitted, i as isRouteIndexable, _ as loadPagesManifest, $ as parsePagesManifest, a1 as routeExclusionReason, s as slugToTitle } from '../vitepressTransform-CZ_IB3dq.js';
|
|
5
|
+
import { a as HeadObservation, H as HonestyMode } from '../headHonesty-OzxvLuwd.js';
|
|
6
|
+
export { B as BakedHead, g as HeadHonestyError, l as HeadHonestyExecution, k as HeadHonestyNotRunError, p as HeadHonestyOptions, o as HeadHonestyViolation, m as HonestyModeInput, b as assertHeadHonesty, h as assertHeadHonestyExecuted, d as decodeHtmlEntities, e as extractBakedHead, i as findHeadHonestyExecutionFaults, f as findHeadHonestyViolations, j as formatHeadHonestyExecutionReport, c as formatHeadHonestyReport, n as normalizeHeadText, r as resolveHonestyMode } from '../headHonesty-OzxvLuwd.js';
|
|
7
7
|
import 'vue';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -344,6 +344,131 @@ interface BodyPrerenderEnableInput {
|
|
|
344
344
|
*/
|
|
345
345
|
declare function isBodyPrerenderEnabled(input: BodyPrerenderEnableInput): boolean;
|
|
346
346
|
|
|
347
|
+
/**
|
|
348
|
+
* FAQ body-honesty rail — a `FAQPage` node must describe copy the page RENDERS.
|
|
349
|
+
*
|
|
350
|
+
* ## The defect class
|
|
351
|
+
*
|
|
352
|
+
* `buildFaqPage` (`./schemaGraph.ts`) emits a `FAQPage` from any well-formed
|
|
353
|
+
* `{q,a}` pair it finds in `.dcs/content.yaml`. That gate enforces the SHAPE of
|
|
354
|
+
* the honesty rule (no invented Q&A) but it cannot enforce its SUBSTANCE: the
|
|
355
|
+
* builder is pure and has no idea whether the page it decorates renders those
|
|
356
|
+
* questions anywhere a human — or a crawler — can see them. Seeding
|
|
357
|
+
* `pages.<slug>.faq` without also rendering a visible FAQ section therefore
|
|
358
|
+
* ships structured data for content that does not exist on the page. Google's
|
|
359
|
+
* FAQPage guidance requires the Q&A be visible to the user; markup for invisible
|
|
360
|
+
* content is a spam signal, and it is the exact fabrication class the rest of
|
|
361
|
+
* this module tree exists to prevent.
|
|
362
|
+
*
|
|
363
|
+
* Measured origin: the 2026-08-30 Iron Oak drafting pass
|
|
364
|
+
* (`.docs/analysis/iron-oak-seo-drafts-2026-08-30.md` §3, "The honesty condition
|
|
365
|
+
* on all of the above") — Iron Oak has Q&A-shaped copy and no FAQ section, so
|
|
366
|
+
* applying the FAQPage finding as a one-step content seed would have produced
|
|
367
|
+
* exactly this defect on a live customer site.
|
|
368
|
+
*
|
|
369
|
+
* ## The rail
|
|
370
|
+
*
|
|
371
|
+
* Given an emitted document, take every `Question.name` out of every `FAQPage`
|
|
372
|
+
* JSON-LD node and require each one to appear in the PRERENDERED BODY TEXT.
|
|
373
|
+
*
|
|
374
|
+
* ## The vacuity trap this rail is built around
|
|
375
|
+
*
|
|
376
|
+
* The question text is, by construction, already present in the document — it is
|
|
377
|
+
* sitting in the `<script type="application/ld+json">` block being audited.
|
|
378
|
+
* `dcsSeoPlugin` bakes that block into `<head>`, which `extractPrerenderedBodyText`
|
|
379
|
+
* never reads, but not every emitter does (vite-ssg and hand-rolled prerenders
|
|
380
|
+
* put JSON-LD in the body), and a body extractor that keeps `<script>` content
|
|
381
|
+
* would then find every question in every document — green against a site with
|
|
382
|
+
* no FAQ section at all. `extractPrerenderedBodyText` therefore strips
|
|
383
|
+
* `<script>`, `<style>`, `<noscript>` and comments CONTENT-AND-ALL, and
|
|
384
|
+
* `faqBodyHonesty.test.ts` exercises the body-placed case explicitly.
|
|
385
|
+
*/
|
|
386
|
+
|
|
387
|
+
/** One emitted document to audit. */
|
|
388
|
+
interface FaqBodyObservation {
|
|
389
|
+
/** Route path as it appears in `pages.yaml` (e.g. `/` or `/services`). */
|
|
390
|
+
route: string;
|
|
391
|
+
/** The emitted HTML for that route, exactly as written to `dist/`. */
|
|
392
|
+
html: string;
|
|
393
|
+
}
|
|
394
|
+
/** A `FAQPage` question with no counterpart in the rendered body. */
|
|
395
|
+
interface FaqBodyViolation {
|
|
396
|
+
route: string;
|
|
397
|
+
/** The `Question.name` verbatim, as authored in the JSON-LD. */
|
|
398
|
+
question: string;
|
|
399
|
+
/** How many questions that document's FAQPage node(s) declared in total. */
|
|
400
|
+
questionCount: number;
|
|
401
|
+
}
|
|
402
|
+
/** Configuration for the rail. */
|
|
403
|
+
interface FaqBodyHonestyOptions {
|
|
404
|
+
/**
|
|
405
|
+
* Route paths exempted from the comparison. An exemption is still the caller's
|
|
406
|
+
* to LOG — same contract as `HeadHonestyOptions.allow`.
|
|
407
|
+
*/
|
|
408
|
+
allow?: string[];
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Normalise a string for PRESENCE comparison (is this text on the page?), which
|
|
412
|
+
* is a weaker question than head honesty's IDENTITY comparison and so normalises
|
|
413
|
+
* more:
|
|
414
|
+
* - HTML entities decoded (`&` ⇒ `&`) — the two sides are escaped
|
|
415
|
+
* differently: JSON-LD escapes for JSON, body copy escapes for HTML.
|
|
416
|
+
* - typographic look-alikes folded to ASCII (`’ ‘ “ ” — –` ⇒ `' ' " " - -`) —
|
|
417
|
+
* the schema string and the rendered string come from the SAME content key
|
|
418
|
+
* but the rendered one may pass through a typography transform. A rail that
|
|
419
|
+
* reds because a renderer curled an apostrophe is an accusation, not a find.
|
|
420
|
+
* - whitespace collapsed — rendered copy is wrapped and indented.
|
|
421
|
+
* - lowercased — a question rendered as a title-cased heading is still visible.
|
|
422
|
+
*
|
|
423
|
+
* Deliberately NOT normalised: words. Nothing is stemmed, dropped or fuzzy-
|
|
424
|
+
* matched, so a "close enough" body text does not satisfy the rail.
|
|
425
|
+
*/
|
|
426
|
+
declare function normalizeForPresence(value: string): string;
|
|
427
|
+
/**
|
|
428
|
+
* Collect every `Question.name` declared by every `FAQPage` node in a document.
|
|
429
|
+
*
|
|
430
|
+
* Unparseable JSON-LD is SKIPPED, not reported — `cli/seo-coverage-audit.mjs`
|
|
431
|
+
* already fails a route for unparseable structured data, and this rail must not
|
|
432
|
+
* double-report someone else's finding as an FAQ defect.
|
|
433
|
+
*/
|
|
434
|
+
declare function extractFaqQuestions(html: string): string[];
|
|
435
|
+
/**
|
|
436
|
+
* The visible text of the PRERENDERED BODY — what a non-JS crawler receives.
|
|
437
|
+
*
|
|
438
|
+
* `<script>`, `<style>`, `<noscript>` and HTML comments are removed CONTENT AND
|
|
439
|
+
* ALL before tags are stripped. That is not tidiness: the JSON-LD under audit
|
|
440
|
+
* lives in a `<script>`, so leaving script content in would make every question
|
|
441
|
+
* trivially "present" and the rail vacuous (see the module header).
|
|
442
|
+
*
|
|
443
|
+
* Returns `''` when there is no `<body>` — an SPA shell with no prerendered body
|
|
444
|
+
* has no visible copy, which is the honest answer, not a parse failure.
|
|
445
|
+
*/
|
|
446
|
+
declare function extractPrerenderedBodyText(html: string): string;
|
|
447
|
+
/**
|
|
448
|
+
* Report every `FAQPage` question that the route's prerendered body does not
|
|
449
|
+
* render. A document with no `FAQPage` node yields nothing — the rail is about
|
|
450
|
+
* schema that over-claims, never about pages that decline to have an FAQ.
|
|
451
|
+
*/
|
|
452
|
+
declare function findFaqBodyHonestyViolations(observations: FaqBodyObservation[], options?: FaqBodyHonestyOptions): FaqBodyViolation[];
|
|
453
|
+
/**
|
|
454
|
+
* Render the full report. Names the route, the question, and the fix — both
|
|
455
|
+
* halves of the fix, because deleting the schema and rendering the section are
|
|
456
|
+
* both valid resolutions and the operator picks.
|
|
457
|
+
*/
|
|
458
|
+
declare function formatFaqBodyHonestyReport(violations: FaqBodyViolation[]): string;
|
|
459
|
+
/** Thrown in `error` mode so the build goes red on invisible FAQ markup. */
|
|
460
|
+
declare class FaqBodyHonestyError extends Error {
|
|
461
|
+
readonly violations: FaqBodyViolation[];
|
|
462
|
+
constructor(violations: FaqBodyViolation[]);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Enforce the rail. `error` throws, `warn` logs, `off` does nothing.
|
|
466
|
+
* Mirrors `assertHeadHonesty` so the three-mode contract is uniform across rails.
|
|
467
|
+
*/
|
|
468
|
+
declare function assertFaqBodyHonesty(observations: FaqBodyObservation[], options?: FaqBodyHonestyOptions & {
|
|
469
|
+
mode?: HonestyMode;
|
|
470
|
+
}): FaqBodyViolation[];
|
|
471
|
+
|
|
347
472
|
/**
|
|
348
473
|
* THE HEAD-AUTHORITY CONTRACT (C-356) — a source-level audit.
|
|
349
474
|
*
|
|
@@ -1045,4 +1170,4 @@ declare class CharsetBudgetError extends Error {
|
|
|
1045
1170
|
*/
|
|
1046
1171
|
declare function formatCharsetHeadroomWarning(file: string, result: CharsetBudgetResult, warnBelow?: number): string | null;
|
|
1047
1172
|
|
|
1048
|
-
export { type BodyPrerenderEnableInput, BodyPrerenderError, CANONICAL_CHARSET_META, CHARSET_BUDGET_BYTES, CHARSET_HEADROOM_WARN_BYTES, CharsetBudgetError, type CharsetBudgetResult, type ClassifiedUrl, type EmittedUrl, type EmittedUrlAudit, EmittedUrlError, EmittedUrlNotRunError, type EmittedUrlViolation, type EmittedUrlWarning, type FilteredRoute, type ForeignWriterSite, HeadContractError, type HeadContractExemptionAudit, type HeadContractExemptionCheck, type HeadContractExemptionExpectation, type HeadContractExemptionRecord, type HeadContractExemptionValue, type HeadContractExemptionVerdict, type HeadContractHostProbe, type HeadContractInput, type HeadContractMode, type HeadContractReport, type HeadContractSeoConfig, type HeadContractSourceFile, type HeadContractViolation, type HeadContractViolationCode, type HeadContractWarning, type HeadContractWarningCode, HeadLinkTag, HeadMetaTag, HeadObservation, MIN_EXEMPTION_REASON_LENGTH, PageRouteEntry, type PrerenderBodiesParams, type PrerenderBodiesResult, type PrerenderFilterReason, type RemoteCheckOptions, type RemoteCheckResult, type RenderedHead, type RenderedRoute, type RouteRenderer, type SameOriginAuditResult, type UrlExpectation, type UrlLocality, assertHeadContract, auditCheckedTotal, auditExemptionHosts, auditHeadContract, auditSameOriginAssets, blankComments, checkCharsetBudget, checkRemoteAssets, checkSameOriginAssets, classifyUrl, collectUrlsFromHtml, collectUrlsFromLlmsTxt, collectUrlsFromSitemap, dedupeUrls, findCharsetByteOffset, formatCharsetHeadroomWarning, formatEmittedUrlAudit, formatEmittedUrlReport, formatExemptionAudit, formatHeadContractReport, headInputIdentities, hoistCharsetMeta, hostsNamedIn, isBodyPrerenderEnabled, normalizeExemption, parseHostProbeHtml, prerenderBodies, routeToOutputFile, snapshotBakedManagedHeadTags, spliceBodyHtml, sweepBakedManagedHeadTags };
|
|
1173
|
+
export { type BodyPrerenderEnableInput, BodyPrerenderError, CANONICAL_CHARSET_META, CHARSET_BUDGET_BYTES, CHARSET_HEADROOM_WARN_BYTES, CharsetBudgetError, type CharsetBudgetResult, type ClassifiedUrl, type EmittedUrl, type EmittedUrlAudit, EmittedUrlError, EmittedUrlNotRunError, type EmittedUrlViolation, type EmittedUrlWarning, FaqBodyHonestyError, type FaqBodyHonestyOptions, type FaqBodyObservation, type FaqBodyViolation, type FilteredRoute, type ForeignWriterSite, HeadContractError, type HeadContractExemptionAudit, type HeadContractExemptionCheck, type HeadContractExemptionExpectation, type HeadContractExemptionRecord, type HeadContractExemptionValue, type HeadContractExemptionVerdict, type HeadContractHostProbe, type HeadContractInput, type HeadContractMode, type HeadContractReport, type HeadContractSeoConfig, type HeadContractSourceFile, type HeadContractViolation, type HeadContractViolationCode, type HeadContractWarning, type HeadContractWarningCode, HeadLinkTag, HeadMetaTag, HeadObservation, HonestyMode, MIN_EXEMPTION_REASON_LENGTH, PageRouteEntry, type PrerenderBodiesParams, type PrerenderBodiesResult, type PrerenderFilterReason, type RemoteCheckOptions, type RemoteCheckResult, type RenderedHead, type RenderedRoute, type RouteRenderer, type SameOriginAuditResult, type UrlExpectation, type UrlLocality, assertFaqBodyHonesty, assertHeadContract, auditCheckedTotal, auditExemptionHosts, auditHeadContract, auditSameOriginAssets, blankComments, checkCharsetBudget, checkRemoteAssets, checkSameOriginAssets, classifyUrl, collectUrlsFromHtml, collectUrlsFromLlmsTxt, collectUrlsFromSitemap, dedupeUrls, extractFaqQuestions, extractPrerenderedBodyText, findCharsetByteOffset, findFaqBodyHonestyViolations, formatCharsetHeadroomWarning, formatEmittedUrlAudit, formatEmittedUrlReport, formatExemptionAudit, formatFaqBodyHonestyReport, formatHeadContractReport, headInputIdentities, hoistCharsetMeta, hostsNamedIn, isBodyPrerenderEnabled, normalizeExemption, normalizeForPresence, parseHostProbeHtml, prerenderBodies, routeToOutputFile, snapshotBakedManagedHeadTags, spliceBodyHtml, sweepBakedManagedHeadTags };
|
package/dist/seo/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { HeadContractError, MIN_EXEMPTION_REASON_LENGTH, assertHeadContract, auditExemptionHosts, auditHeadContract, blankComments, formatExemptionAudit, formatHeadContractReport, hostsNamedIn, normalizeExemption, parseHostProbeHtml } from '../chunk-
|
|
2
|
-
export { AI_BOTS, BodyPrerenderError, CANONICAL_CHARSET_META, CHARSET_BUDGET_BYTES, CHARSET_HEADROOM_WARN_BYTES, CharsetBudgetError, EmittedUrlError, EmittedUrlNotRunError, HeadHonestyError, HeadHonestyNotRunError, 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, collectUrlsFromHtml, collectUrlsFromLlmsTxt, collectUrlsFromSitemap, createSeoTransformPageData, decodeHtmlEntities, dedupeUrls, defaultRelativePathToRoute, deriveSameAs, escapeJsonLd, extractBakedHead, filterRealFaq, filterRealReviews, findBusinessLicense, findCharsetByteOffset, findDuplicateNormalizedPaths, findGlobalSchemasOfType, findHeadHonestyExecutionFaults, findHeadHonestyViolations, findLocalBusinessSchema, findReviewItemsForPage, formatCharsetHeadroomWarning, formatDuplicateNormalizedPaths, formatEmittedUrlAudit, formatEmittedUrlReport, formatHeadHonestyExecutionReport, formatHeadHonestyReport, generateJsonLd, generateOpenGraphMeta, generateTwitterMeta, graphAbsorbs, graphIds, headInputIdentities, hoistCharsetMeta, installSeoHead, isBodyPrerenderEnabled, isLocalBusinessType, isManagedLinkRel, isManagedMetaTag, isRouteEmitted, isRouteIndexable, loadPagesManifest, normalizeHeadText, normalizeSeoHeadPath, parsePagesManifest, prerenderBodies, renderHeadTags, resolveHonestyMode, resolvePageSeo, routeExclusionReason, routeToOutputFile, slugToTitle, snapshotBakedManagedHeadTags, spliceBodyHtml, spliceHeadHtml, stripManagedHeadTags, sweepBakedManagedHeadTags } from '../chunk-
|
|
1
|
+
export { FaqBodyHonestyError, HeadContractError, MIN_EXEMPTION_REASON_LENGTH, assertFaqBodyHonesty, assertHeadContract, auditExemptionHosts, auditHeadContract, blankComments, extractFaqQuestions, extractPrerenderedBodyText, findFaqBodyHonestyViolations, formatExemptionAudit, formatFaqBodyHonestyReport, formatHeadContractReport, hostsNamedIn, normalizeExemption, normalizeForPresence, parseHostProbeHtml } from '../chunk-GBHJVHXR.js';
|
|
2
|
+
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, 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, isLocalBusinessType, isManagedLinkRel, isManagedMetaTag, isRouteEmitted, isRouteIndexable, loadPagesManifest, normalizeHeadText, normalizeSeoHeadPath, parsePagesManifest, prerenderBodies, renderHeadTags, resolveHonestyMode, resolvePageSeo, routeExclusionReason, routeToOutputFile, slugToTitle, snapshotBakedManagedHeadTags, spliceBodyHtml, spliceHeadHtml, stripManagedHeadTags, sweepBakedManagedHeadTags } from '../chunk-W5Q6SOAP.js';
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -420,6 +420,52 @@ declare function findLocalBusinessSchema(global: GlobalSeoConfig): {
|
|
|
420
420
|
schema: SeoSchemaConfig;
|
|
421
421
|
index: number;
|
|
422
422
|
} | null;
|
|
423
|
+
/**
|
|
424
|
+
* The `PostalAddress` fields that together make a NAP a real, mappable address.
|
|
425
|
+
* Order is the order a human writes one, which is the order the warning prints.
|
|
426
|
+
*/
|
|
427
|
+
declare const REQUIRED_POSTAL_ADDRESS_FIELDS: readonly ["streetAddress", "addressLocality", "addressRegion", "postalCode", "addressCountry"];
|
|
428
|
+
/** A LocalBusiness node that CLAIMS an address but does not finish it. */
|
|
429
|
+
interface PostalAddressGap {
|
|
430
|
+
/** The LocalBusiness `@type` as authored (e.g. `HomeAndConstructionBusiness`). */
|
|
431
|
+
businessType: string;
|
|
432
|
+
/** Required fields absent or blank, in `REQUIRED_POSTAL_ADDRESS_FIELDS` order. */
|
|
433
|
+
missing: string[];
|
|
434
|
+
/** Required fields actually supplied — what makes the node look answered. */
|
|
435
|
+
present: string[];
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Report a LocalBusiness `address` that is PRESENT BUT PARTIAL.
|
|
439
|
+
*
|
|
440
|
+
* `buildGlobalGraph` spreads the hand-authored node's properties verbatim
|
|
441
|
+
* (`...props`), so a `PostalAddress` carrying only a locality and a region ships
|
|
442
|
+
* to crawlers exactly as authored, with nothing anywhere saying it is half an
|
|
443
|
+
* address. Google matches a LocalBusiness to a place using the NAP; a partial
|
|
444
|
+
* address is the shape that silently fails that match while every audit that
|
|
445
|
+
* only asks "is there an address node?" stays green.
|
|
446
|
+
*
|
|
447
|
+
* ## Why an ABSENT address is not reported
|
|
448
|
+
*
|
|
449
|
+
* A service-area business (a contractor working out of a home, a mobile trade)
|
|
450
|
+
* is *supposed* to omit `address` — that is Google's own guidance, and several
|
|
451
|
+
* DCS fleet sites are exactly that. Warning there would be an accusation
|
|
452
|
+
* levelled at correct configuration, and a warning people learn to ignore is
|
|
453
|
+
* worth less than no warning. The defect is the CLAIM that is not finished, so
|
|
454
|
+
* the trigger is an address node that exists and is incomplete.
|
|
455
|
+
*
|
|
456
|
+
* A non-object `address` (a plain string) is also skipped: it is unstructured,
|
|
457
|
+
* not partial, and belongs to a different finding.
|
|
458
|
+
*
|
|
459
|
+
* @returns one gap per incomplete address, or `[]` when complete/absent.
|
|
460
|
+
*/
|
|
461
|
+
declare function findPostalAddressGaps(global: GlobalSeoConfig): PostalAddressGap[];
|
|
462
|
+
/**
|
|
463
|
+
* Render the partial-address warning. Names the type, what is there, and what is
|
|
464
|
+
* not — an operator must be able to act without re-deriving the finding, and the
|
|
465
|
+
* "or drop the address entirely" branch is stated because for a service-area
|
|
466
|
+
* business that is the CORRECT fix, not a workaround.
|
|
467
|
+
*/
|
|
468
|
+
declare function formatPostalAddressGapReport(gaps: PostalAddressGap[]): string;
|
|
423
469
|
/**
|
|
424
470
|
* True when `buildGlobalGraph` provides this schema canonically, so it must NOT
|
|
425
471
|
* also be emitted standalone: the LocalBusiness subtype it folds in, or a global
|
|
@@ -1144,4 +1190,4 @@ declare function buildVitePressSeoHead(pageData: VitePressPageData, options: Cre
|
|
|
1144
1190
|
*/
|
|
1145
1191
|
declare function createSeoTransformPageData(options: CreateSeoTransformPageDataOptions): (pageData: VitePressPageData) => void;
|
|
1146
1192
|
|
|
1147
|
-
export { parsePagesManifest as $, AI_BOTS as A, type BuildSitemapParams as B, type CreateSeoTransformPageDataOptions as C, type DcsRobotsOptions as D, type ContentConfig as E, type FaqSource as F, type GlobalSeoConfig as G, type SeoConfiguration as H, type SeoAuthorConfig as I, type SeoSocialConfig as J, type SeoImagesConfig as K, type SeoOpenGraphConfig as L, type SeoTwitterConfig as M, type SeoSchemaConfig as N, type SeoAlternateConfig as O, type PageSeoConfig as P, type SeoVerificationConfig as Q, type ResolvedPageOverrides as R, type SeoPageContext as S, type ResolvedPageSeo as T, type UseSeoReturn as U, type VitePressPageData as V, type UseSeoConfig as W, type HeadOverrides as X, type SeoHonestyBlock as Y, type PageRouteEntry as Z, loadPagesManifest as _, buildSitemapXml as a, isRouteEmitted as a0, routeExclusionReason as a1, type RouteEmissionRules as a2, type RouteExclusionReason as a3, buildHasCredential as a4, findLocalBusinessSchema as a5, findGlobalSchemasOfType as a6, graphAbsorbs as a7, findBusinessLicense as a8,
|
|
1193
|
+
export { parsePagesManifest as $, AI_BOTS as A, type BuildSitemapParams as B, type CreateSeoTransformPageDataOptions as C, type DcsRobotsOptions as D, type ContentConfig as E, type FaqSource as F, type GlobalSeoConfig as G, type SeoConfiguration as H, type SeoAuthorConfig as I, type SeoSocialConfig as J, type SeoImagesConfig as K, type SeoOpenGraphConfig as L, type SeoTwitterConfig as M, type SeoSchemaConfig as N, type SeoAlternateConfig as O, type PageSeoConfig as P, type SeoVerificationConfig as Q, type ResolvedPageOverrides as R, type SeoPageContext as S, type ResolvedPageSeo as T, type UseSeoReturn as U, type VitePressPageData as V, type UseSeoConfig as W, type HeadOverrides as X, type SeoHonestyBlock as Y, type PageRouteEntry as Z, loadPagesManifest as _, buildSitemapXml as a, isRouteEmitted as a0, routeExclusionReason as a1, type RouteEmissionRules as a2, type RouteExclusionReason as a3, buildHasCredential as a4, findLocalBusinessSchema as a5, findGlobalSchemasOfType as a6, graphAbsorbs as a7, findBusinessLicense as a8, findPostalAddressGaps as a9, formatPostalAddressGapReport as aa, REQUIRED_POSTAL_ADDRESS_FIELDS as ab, deriveSameAs as ac, graphIds as ad, isLocalBusinessType as ae, type NormalisedReview as af, type NormalisedFaq as ag, type ReviewSchemaParts as ah, type PostalAddressGap as ai, buildVitePressSeoHead as b, createSeoTransformPageData as c, defaultRelativePathToRoute as d, buildRobotsTxt as e, buildLlmsTxt as f, buildGlobalGraph as g, buildBreadcrumbList as h, isRouteIndexable as i, breadcrumbTrailFromRoute as j, buildBlogPosting as k, buildFaqPage as l, buildReviewSchemaParts as m, filterRealReviews as n, filterRealFaq as o, findReviewItemsForPage as p, absolutizeUrl as q, type SeoPageTypeRule as r, slugToTitle as s, type VitePressHeadConfig as t, type BuildRobotsParams as u, type BuildLlmsParams as v, type SchemaObject as w, type BreadcrumbCrumb as x, type BlogMeta as y, type ReviewSource as z };
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@duffcloudservices/cms",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.5",
|
|
4
4
|
"description": "Vue 3 composables and Vite plugins for DCS CMS integration",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"config": {
|
|
7
|
+
"agentApiBaseUrl": "https://portal.duffcloudservices.com",
|
|
8
|
+
"agentWidgetScriptUrl": "https://files.duffcloudservices.com/agent-widget/v1/dcs-agent-widget.js"
|
|
9
|
+
},
|
|
6
10
|
"exports": {
|
|
7
11
|
".": {
|
|
8
12
|
"types": "./dist/index.d.ts",
|
|
@@ -58,7 +62,7 @@
|
|
|
58
62
|
},
|
|
59
63
|
"dependencies": {
|
|
60
64
|
"js-yaml": "^4.1.0",
|
|
61
|
-
"@duffcloudservices/cms-core": "0.8.
|
|
65
|
+
"@duffcloudservices/cms-core": "0.8.5"
|
|
62
66
|
},
|
|
63
67
|
"devDependencies": {
|
|
64
68
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -79,7 +83,9 @@
|
|
|
79
83
|
"vite": "^6.3.5",
|
|
80
84
|
"vitest": "^3.2.3",
|
|
81
85
|
"vue": "^3.5.16",
|
|
82
|
-
"vue-router": "^4.5.1"
|
|
86
|
+
"vue-router": "^4.5.1",
|
|
87
|
+
"@dcs/test-utils": "0.1.0",
|
|
88
|
+
"@dcs/eslint-rules": "0.1.0"
|
|
83
89
|
},
|
|
84
90
|
"keywords": [
|
|
85
91
|
"vue",
|
|
@@ -1,11 +1,84 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
2
|
import { mount } from '@vue/test-utils'
|
|
3
|
+
import { pinEventClock, unpinEventClock } from '@dcs/test-utils/pinEventClock'
|
|
3
4
|
import LiteMediaEmbed from './LiteMediaEmbed.vue'
|
|
4
5
|
|
|
6
|
+
// W283 (2026-09-17) — THE CLOCK PIN BELOW IS LOAD-BEARING. Do not remove it
|
|
7
|
+
// because "this spec has no timers"; it is not here for timers.
|
|
8
|
+
//
|
|
9
|
+
// CI run 35265225886 (Test Gate, commit 2fe5e0590) failed exactly two tests in
|
|
10
|
+
// this file — ":41 expected true, received false" on the YouTube facade's
|
|
11
|
+
// on-click iframe — while the same suite ran 817/817 green on a dev box minutes
|
|
12
|
+
// later. Nothing in the component or the spec had been touched in that push.
|
|
13
|
+
//
|
|
14
|
+
// The cause is the self-hosted runner's wall clock, which takes real BACKWARD
|
|
15
|
+
// steps (39 backward jumps in one run, worst -1903ms, measured by
|
|
16
|
+
// cli/check-run-log-monotonicity.mjs), and mechanism M2:
|
|
17
|
+
//
|
|
18
|
+
// invoker.attached = getNow() // = Date.now() at MOUNT
|
|
19
|
+
// const getNow = () => cachedNow || (…, cachedNow = Date.now())
|
|
20
|
+
// if (!e._vts) { e._vts = Date.now() }
|
|
21
|
+
// else if (e._vts <= invoker.attached) { return } // handler SKIPPED
|
|
22
|
+
// @vue/runtime-dom@3.5.25, runtime-dom.cjs.js:657, 660-664
|
|
23
|
+
//
|
|
24
|
+
// and vue-test-utils buys exactly ONE millisecond of headroom:
|
|
25
|
+
// event._vts = Date.now() + 1 // @vue/test-utils@2.4.6, :7322 (test-utils#1854)
|
|
26
|
+
//
|
|
27
|
+
// Both readings are plain `Date.now()` — this Vue version has no
|
|
28
|
+
// `performance.now()` fallback — so if the host clock moves back by 1ms or more
|
|
29
|
+
// between the mount and the click, `_vts <= attached` holds, Vue returns, and
|
|
30
|
+
// `await trigger('click')` RESOLVES HAVING DISPATCHED NOTHING. No error, no
|
|
31
|
+
// warning. The spec then fails on the un-mutated DOM, and the report points at
|
|
32
|
+
// the component instead of at the host.
|
|
33
|
+
//
|
|
34
|
+
// Verified locally on 2026-09-17 by stepping Date.now() back 1903ms between the
|
|
35
|
+
// mount and the click: the click is swallowed and `iframe.exists()` is false —
|
|
36
|
+
// the CI red, reproduced on a box with a healthy clock.
|
|
37
|
+
//
|
|
38
|
+
// Pinning the clock in `beforeEach` makes `Date.now()` the FAKE timer's reading,
|
|
39
|
+
// which the host cannot move. `attached` and `_vts` are then both taken from the
|
|
40
|
+
// frozen instant, `_vts` is `attached + 1`, and the handler always runs. The pin
|
|
41
|
+
// sits in `beforeEach` (never in a test body) so it runs before any mount and
|
|
42
|
+
// can never itself be the backward step — which is what
|
|
43
|
+
// `dcs-test/no-backward-clock-with-trigger` now enforces for this package.
|
|
44
|
+
//
|
|
45
|
+
// This removes ONE exposure. It does not fix the runner: every other click spec
|
|
46
|
+
// in the fleet on a real clock is still exposed, and the host clock itself is
|
|
47
|
+
// owner action C-1749 / Q-862.
|
|
48
|
+
// `toFake: ['Date']` is LOAD-BEARING and must not be dropped to a bare
|
|
49
|
+
// `useFakeTimers({ now })`. Only `Date` is the clock Vue's invoker reads, so
|
|
50
|
+
// only `Date` needs freezing; faking the timer functions as well would change
|
|
51
|
+
// `setTimeout`/`setInterval` behaviour for every other test in this file, none
|
|
52
|
+
// of which asked for it (W283 shipped that mistake and corrected it in
|
|
53
|
+
// cd48579df). W286 replaced the hand-rolled pin with the canonical helper, which
|
|
54
|
+
// C-1752 lifted out of portal into `@dcs/test-utils` precisely so a second copy
|
|
55
|
+
// of the idiom could not drift here. `pinEventClock.spec.ts` (portal) proves the
|
|
56
|
+
// Date-only guarantee on every portal run.
|
|
57
|
+
const FIXED_CLOCK = new Date('2026-01-01T00:00:00.000Z')
|
|
58
|
+
|
|
59
|
+
beforeEach(() => {
|
|
60
|
+
pinEventClock(FIXED_CLOCK)
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
afterEach(() => {
|
|
64
|
+
unpinEventClock()
|
|
65
|
+
})
|
|
66
|
+
|
|
5
67
|
const YT_URL = 'https://www.youtube.com/watch?v=vz7F8bc1QQ0'
|
|
6
68
|
const YT_ID = 'vz7F8bc1QQ0'
|
|
7
69
|
const IG_URL = 'https://www.instagram.com/p/AbCdEfGhIjK/'
|
|
8
70
|
|
|
71
|
+
describe('LiteMediaEmbed — the clock this file dispatches under', () => {
|
|
72
|
+
// W283 — the guard on the pin above. Deleting the `beforeEach` (or letting a
|
|
73
|
+
// later edit drop `now`) turns this red immediately and names the reason,
|
|
74
|
+
// rather than leaving the file to fail intermittently on a runner months
|
|
75
|
+
// later with ":41 expected true, received false".
|
|
76
|
+
it('runs under a PINNED Date.now, so a backward host clock step cannot reach Vue (M2)', () => {
|
|
77
|
+
expect(Date.now()).toBe(FIXED_CLOCK.getTime())
|
|
78
|
+
expect(new Date().getTime()).toBe(FIXED_CLOCK.getTime())
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
9
82
|
describe('LiteMediaEmbed — YouTube facade', () => {
|
|
10
83
|
it('renders the poster (thumbnail + play button) and NO iframe initially', () => {
|
|
11
84
|
const wrapper = mount(LiteMediaEmbed, {
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
2
|
import { mount } from '@vue/test-utils'
|
|
3
3
|
import ManagedImage from './ManagedImage.vue'
|
|
4
|
+
import { pinEventClock, unpinEventClock } from '@dcs/test-utils/pinEventClock'
|
|
5
|
+
|
|
6
|
+
// C-1752 (the Q-862 / C-1415 event-clock class): this spec MOUNTS and DISPATCHES,
|
|
7
|
+
// so Vue's `_vts <= invoker.attached` check can swallow a dispatch outright when
|
|
8
|
+
// the host clock steps BACKWARD between the mount and the event - the shape that
|
|
9
|
+
// redded CI run 35265225886 on a healthy component. Date-only pin; timers stay
|
|
10
|
+
// real, so flushPromises/nextTick/setTimeout behave exactly as before.
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
pinEventClock()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
unpinEventClock()
|
|
17
|
+
})
|
|
18
|
+
|
|
4
19
|
|
|
5
20
|
/**
|
|
6
21
|
* A CDN URL whose UUID/extension triggers responsive variant resolution
|
|
@@ -86,6 +86,8 @@
|
|
|
86
86
|
<script setup lang="ts">
|
|
87
87
|
import { ref, computed, onMounted, onBeforeUnmount, watch } from 'vue'
|
|
88
88
|
|
|
89
|
+
import { resolveApiBaseUrl } from '../composables/resolveApiBaseUrl'
|
|
90
|
+
|
|
89
91
|
/*
|
|
90
92
|
* NO cms-core VALUE imports in this file. The `./components` export ships RAW SFC
|
|
91
93
|
* source (tsup builds no .vue), so consumer sites type-check this file directly —
|
|
@@ -241,9 +243,15 @@ onMounted(async () => {
|
|
|
241
243
|
// The site is resolved server-side (request Host / DCS_SITE_SLUG); the slug
|
|
242
244
|
// is no longer encoded in the path. VITE_SITE_SLUG is retained for source
|
|
243
245
|
// compatibility but is not required here.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
246
|
+
// C-1062: the env or nothing - never a silent production default.
|
|
247
|
+
const base = resolveApiBaseUrl(
|
|
248
|
+
(import.meta.env as Record<string, string | undefined>).VITE_API_BASE_URL,
|
|
249
|
+
'PreviewRibbon',
|
|
250
|
+
)
|
|
251
|
+
// No configured base: the warning above already said why; do not read
|
|
252
|
+
// relative, where an SWA's 200 HTML shell would trip the C-298 misroute
|
|
253
|
+
// check below and blame the platform for an unset env.
|
|
254
|
+
if (base === '') return
|
|
247
255
|
// C-298 layer 2, INLINED (see the no-cms-core-value-imports note at the top of
|
|
248
256
|
// this <script>): the `catch { /* non-critical */ }` below is a swallow site, so
|
|
249
257
|
// a non-JSON (HTML-shell) body must go LOUD here before it can be swallowed.
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest'
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
2
|
import { mount } from '@vue/test-utils'
|
|
3
3
|
import ResponsiveImage from './ResponsiveImage.vue'
|
|
4
|
+
import { pinEventClock, unpinEventClock } from '@dcs/test-utils/pinEventClock'
|
|
5
|
+
|
|
6
|
+
// C-1752 (the Q-862 / C-1415 event-clock class): this spec MOUNTS and DISPATCHES,
|
|
7
|
+
// so Vue's `_vts <= invoker.attached` check can swallow a dispatch outright when
|
|
8
|
+
// the host clock steps BACKWARD between the mount and the event - the shape that
|
|
9
|
+
// redded CI run 35265225886 on a healthy component. Date-only pin; timers stay
|
|
10
|
+
// real, so flushPromises/nextTick/setTimeout behave exactly as before.
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
pinEventClock()
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
afterEach(() => {
|
|
16
|
+
unpinEventClock()
|
|
17
|
+
})
|
|
18
|
+
|
|
4
19
|
|
|
5
20
|
const ORIGINAL = 'https://files.duffcloudservices.com/kept/assets/hero/abc-123.jpg'
|
|
6
21
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from 'vitest'
|
|
2
|
-
import { readFileSync, readdirSync } from 'node:fs'
|
|
3
|
-
import { join } from 'node:path'
|
|
2
|
+
import { existsSync, readFileSync, readdirSync } from 'node:fs'
|
|
3
|
+
import { dirname, join, relative, resolve } from 'node:path'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The `./components` export ships RAW SFC source (tsup builds no .vue), so every
|
|
@@ -13,9 +13,89 @@ import { join } from 'node:path'
|
|
|
13
13
|
* Measured on the 0.13.0 canary (2026-08-10): one value import in PreviewRibbon.vue
|
|
14
14
|
* would have redded CI on kept (the payer), boogie-babies, bryans and mi-handyman.
|
|
15
15
|
* `import type` is erased at compile time and stays allowed.
|
|
16
|
+
*
|
|
17
|
+
* C-1564 companion (from the C-1062 judge's F5): the guard now follows RELATIVE
|
|
18
|
+
* imports transitively from each shipped .vue, so a .vue reached through another
|
|
19
|
+
* .vue is held to the same rule. A value import of cms-core in a shipped .ts hop
|
|
20
|
+
* (src/composables, also shipped raw) is REPORTED, not failed: it is measured
|
|
21
|
+
* harmless in the fleet - handyman-bryan's own ResponsiveImage.vue wraps
|
|
22
|
+
* `@duffcloudservices/cms/responsive-image`, whose ResponsiveImage.vue imports
|
|
23
|
+
* `../composables/useResponsiveImage.ts`, which value-imports cms-core, and that
|
|
24
|
+
* site's CI type-check gate (C-303) is green on cms ^0.13.2. TS resolves a .ts
|
|
25
|
+
* module's bare imports from the module's own location inside the installed
|
|
26
|
+
* package, where cms-core is a declared dependency; the .vue case differs because
|
|
27
|
+
* vue-tsc compiles the SFC as part of the consumer's program. The known .ts hops
|
|
28
|
+
* are listed below so a NEW one is still visible in the failure text.
|
|
16
29
|
*/
|
|
17
|
-
|
|
30
|
+
|
|
31
|
+
const VALUE_IMPORT = /^\s*import\s+(?!type\b)[^;'"]*['"]@duffcloudservices\/cms-core['"]/gm
|
|
32
|
+
const RELATIVE_IMPORT = /^\s*import\s+(?:type\s+)?[^;'"]*['"](\.{1,2}\/[^'"]+)['"]/gm
|
|
33
|
+
|
|
34
|
+
export interface Hop {
|
|
35
|
+
/** Path relative to src/, forward slashes. */
|
|
36
|
+
file: string
|
|
37
|
+
/** The import chain that reached it, starting at the shipped .vue. */
|
|
38
|
+
via: string[]
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface WalkResult {
|
|
42
|
+
/** Value imports of cms-core in a .vue anywhere on the chain: the broken class. */
|
|
43
|
+
vueValueImports: Hop[]
|
|
44
|
+
/** Value imports of cms-core in a .ts hop: reported, measured harmless. */
|
|
45
|
+
tsValueImports: Hop[]
|
|
46
|
+
/** Every file visited. */
|
|
47
|
+
visited: string[]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Resolve a relative specifier the way the consumer's bundler / tsc would. */
|
|
51
|
+
function resolveSpecifier(fromFile: string, spec: string, exists: (p: string) => boolean): string | null {
|
|
52
|
+
const base = resolve(dirname(fromFile), spec)
|
|
53
|
+
const candidates = [base, `${base}.ts`, `${base}.vue`, join(base, 'index.ts')]
|
|
54
|
+
for (const c of candidates) if (exists(c)) return c
|
|
55
|
+
return null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Pure walker: `read` and `exists` are injected so the polarity can be proven on
|
|
60
|
+
* an in-memory file map without touching the tree.
|
|
61
|
+
*/
|
|
62
|
+
export function walkShippedVue(
|
|
63
|
+
srcDir: string,
|
|
64
|
+
entries: string[],
|
|
65
|
+
read: (p: string) => string,
|
|
66
|
+
exists: (p: string) => boolean,
|
|
67
|
+
): WalkResult {
|
|
68
|
+
const out: WalkResult = { vueValueImports: [], tsValueImports: [], visited: [] }
|
|
69
|
+
const seen = new Set<string>()
|
|
70
|
+
const rel = (p: string) => relative(srcDir, p).replace(/\\/g, '/')
|
|
71
|
+
const visit = (file: string, via: string[]) => {
|
|
72
|
+
if (seen.has(file)) return
|
|
73
|
+
seen.add(file)
|
|
74
|
+
out.visited.push(rel(file))
|
|
75
|
+
const source = read(file)
|
|
76
|
+
const chain = [...via, rel(file)]
|
|
77
|
+
if (Array.from(source.matchAll(VALUE_IMPORT)).length > 0) {
|
|
78
|
+
;(file.endsWith('.vue') ? out.vueValueImports : out.tsValueImports).push({ file: rel(file), via: chain })
|
|
79
|
+
}
|
|
80
|
+
for (const m of source.matchAll(RELATIVE_IMPORT)) {
|
|
81
|
+
const target = resolveSpecifier(file, m[1], exists)
|
|
82
|
+
if (target) visit(target, chain)
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
for (const entry of entries) visit(entry, [])
|
|
86
|
+
return out
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** The .ts hops known and measured at the C-1564 landing (see the header). */
|
|
90
|
+
const KNOWN_TS_HOPS = [
|
|
91
|
+
'composables/useResponsiveImage.ts',
|
|
92
|
+
'composables/useTextContent.ts',
|
|
93
|
+
'composables/resolveApiBaseUrl.ts', // imports nothing; listed so a future cms-core import there is a deliberate change
|
|
94
|
+
].filter((f) => f !== 'composables/resolveApiBaseUrl.ts')
|
|
95
|
+
|
|
96
|
+
describe('raw-source-imports: shipped .vue exports must not value-import cms-core', () => {
|
|
18
97
|
const dir = __dirname
|
|
98
|
+
const srcDir = resolve(dir, '..')
|
|
19
99
|
const vueFiles = readdirSync(dir).filter((f) => f.endsWith('.vue'))
|
|
20
100
|
|
|
21
101
|
it('finds the raw-shipped component set (non-vacuity)', () => {
|
|
@@ -26,7 +106,7 @@ describe('raw-source .vue exports must not value-import cms-core', () => {
|
|
|
26
106
|
for (const file of vueFiles) {
|
|
27
107
|
it(`${file} has no cms-core value import`, () => {
|
|
28
108
|
const src = readFileSync(join(dir, file), 'utf8')
|
|
29
|
-
const valueImports = Array.from(src.matchAll(
|
|
109
|
+
const valueImports = Array.from(src.matchAll(VALUE_IMPORT))
|
|
30
110
|
expect(
|
|
31
111
|
valueImports.map((m) => m[0].trim()),
|
|
32
112
|
`${file} value-imports cms-core — this ships as raw source and breaks every consumer site's type-check (see header comment)`,
|
|
@@ -34,6 +114,29 @@ describe('raw-source .vue exports must not value-import cms-core', () => {
|
|
|
34
114
|
})
|
|
35
115
|
}
|
|
36
116
|
|
|
117
|
+
const walk = walkShippedVue(
|
|
118
|
+
srcDir,
|
|
119
|
+
vueFiles.map((f) => join(dir, f)),
|
|
120
|
+
(p) => readFileSync(p, 'utf8'),
|
|
121
|
+
existsSync,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
it('follows relative imports transitively: no .vue reached from a shipped .vue value-imports cms-core', () => {
|
|
125
|
+
expect(walk.visited.length).toBeGreaterThan(vueFiles.length)
|
|
126
|
+
expect(
|
|
127
|
+
walk.vueValueImports.map((h) => `${h.file} via ${h.via.join(' -> ')}`),
|
|
128
|
+
'a .vue reached through a shipped .vue value-imports cms-core (see header comment)',
|
|
129
|
+
).toEqual([])
|
|
130
|
+
})
|
|
131
|
+
|
|
132
|
+
it('every .ts hop that value-imports cms-core is a known, measured one', () => {
|
|
133
|
+
const found = walk.tsValueImports.map((h) => h.file).sort()
|
|
134
|
+
expect(
|
|
135
|
+
found,
|
|
136
|
+
'a NEW shipped .ts hop value-imports cms-core: measure it against a fleet site type-check before adding it to KNOWN_TS_HOPS',
|
|
137
|
+
).toEqual([...KNOWN_TS_HOPS].sort())
|
|
138
|
+
})
|
|
139
|
+
|
|
37
140
|
it('kill-test: the guard regex catches the 0.13.0 defect shape', () => {
|
|
38
141
|
const bad = "import { platformFetch } from '@duffcloudservices/cms-core'"
|
|
39
142
|
const good = "import type { PlatformFetchOptions } from '@duffcloudservices/cms-core'"
|
|
@@ -41,4 +144,25 @@ describe('raw-source .vue exports must not value-import cms-core', () => {
|
|
|
41
144
|
expect(Array.from(bad.matchAll(re)).length).toBe(1)
|
|
42
145
|
expect(Array.from(good.matchAll(re)).length).toBe(0)
|
|
43
146
|
})
|
|
147
|
+
|
|
148
|
+
it('polarity: a two-hop chain (.vue -> .vue -> cms-core value import) is caught; a .ts hop is reported', () => {
|
|
149
|
+
const files: Record<string, string> = {
|
|
150
|
+
'/m/src/components/A.vue': "import B from './B.vue'\nimport { x } from '../composables/useX'\n",
|
|
151
|
+
'/m/src/components/B.vue': "import { platformFetch } from '@duffcloudservices/cms-core'\n",
|
|
152
|
+
'/m/src/composables/useX.ts': "import { platformFetch } from '@duffcloudservices/cms-core'\nimport type { T } from '@duffcloudservices/cms-core'\n",
|
|
153
|
+
'/m/src/components/C.vue': "import type { T } from '@duffcloudservices/cms-core'\nimport { y } from '../composables/useY'\n",
|
|
154
|
+
'/m/src/composables/useY.ts': "import { ref } from 'vue'\n",
|
|
155
|
+
}
|
|
156
|
+
// path.resolve on Windows prefixes the drive letter; the in-memory map has none.
|
|
157
|
+
const norm = (p: string) => p.replace(/\\/g, '/').replace(/^[A-Za-z]:/, '')
|
|
158
|
+
const r = walkShippedVue(
|
|
159
|
+
'/m/src',
|
|
160
|
+
['/m/src/components/A.vue', '/m/src/components/C.vue'],
|
|
161
|
+
(p) => files[norm(p)] ?? '',
|
|
162
|
+
(p) => norm(p) in files,
|
|
163
|
+
)
|
|
164
|
+
expect(r.vueValueImports.map((h) => h.via.join(' -> '))).toEqual(['components/A.vue -> components/B.vue'])
|
|
165
|
+
expect(r.tsValueImports.map((h) => h.file)).toEqual(['composables/useX.ts'])
|
|
166
|
+
expect(r.visited).toContain('composables/useY.ts')
|
|
167
|
+
})
|
|
44
168
|
})
|