anymorph 0.9.0 → 0.10.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/dist/index.js +34 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12221,6 +12221,14 @@ var require_src = __commonJS({
|
|
|
12221
12221
|
var cmsThemeTokens = require_cms_theme_tokens();
|
|
12222
12222
|
var HOSTNAME_LABEL_RE = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/i;
|
|
12223
12223
|
var CMS_MDX_COMPONENT_CONTRACTS2 = Object.freeze({
|
|
12224
|
+
ArticleHeader: Object.freeze({
|
|
12225
|
+
reserved: true,
|
|
12226
|
+
reason: "ArticleHeader is renderer-owned and must be derived from frontmatter/meta, not authored in MDX."
|
|
12227
|
+
}),
|
|
12228
|
+
RelatedContent: Object.freeze({
|
|
12229
|
+
reserved: true,
|
|
12230
|
+
reason: "RelatedContent is backend-owned and must be derived from related page data, not authored in MDX."
|
|
12231
|
+
}),
|
|
12224
12232
|
Callout: Object.freeze({
|
|
12225
12233
|
props: Object.freeze({
|
|
12226
12234
|
tone: Object.freeze({
|
|
@@ -12236,10 +12244,22 @@ var require_src = __commonJS({
|
|
|
12236
12244
|
});
|
|
12237
12245
|
function validateCmsMdxComponentContracts2(mdx) {
|
|
12238
12246
|
const issues = [];
|
|
12247
|
+
checkReservedComponents(mdx, issues);
|
|
12239
12248
|
checkRequiredComponentProps(mdx, issues);
|
|
12240
12249
|
checkEnumComponentProps(mdx, issues);
|
|
12241
12250
|
return issues;
|
|
12242
12251
|
}
|
|
12252
|
+
function checkReservedComponents(mdx, issues) {
|
|
12253
|
+
for (const [component, contract] of Object.entries(CMS_MDX_COMPONENT_CONTRACTS2)) {
|
|
12254
|
+
if (!contract.reserved) continue;
|
|
12255
|
+
if (!findComponentAttrs(mdx, component).length) continue;
|
|
12256
|
+
issues.push({
|
|
12257
|
+
code: "reserved_component",
|
|
12258
|
+
component,
|
|
12259
|
+
message: `<${component}> is renderer/backend-owned and must not be authored in MDX. ${contract.reason ?? ""}`.trim()
|
|
12260
|
+
});
|
|
12261
|
+
}
|
|
12262
|
+
}
|
|
12243
12263
|
function checkRequiredComponentProps(mdx, issues) {
|
|
12244
12264
|
for (const [component, contract] of Object.entries(CMS_MDX_COMPONENT_CONTRACTS2)) {
|
|
12245
12265
|
if (!Array.isArray(contract.requiredProps) || contract.requiredProps.length === 0) continue;
|
|
@@ -45307,7 +45327,12 @@ async function validateMdx(mdx) {
|
|
|
45307
45327
|
// src/geo/mdx-validate.ts
|
|
45308
45328
|
async function validateCmsMdxFileContent(input) {
|
|
45309
45329
|
const verdict = await validateMdx(input.mdx);
|
|
45310
|
-
const issues =
|
|
45330
|
+
const issues = validateCmsMdxComponentContracts(input.mdx).map(
|
|
45331
|
+
(issue) => ({
|
|
45332
|
+
code: "cms_component_contract_violation",
|
|
45333
|
+
message: issue.message
|
|
45334
|
+
})
|
|
45335
|
+
);
|
|
45311
45336
|
if (verdict.ok) {
|
|
45312
45337
|
if (isCommerceWorkspace(input.workspace) && !hasHeroImage(input.mdx)) {
|
|
45313
45338
|
issues.push({
|
|
@@ -45321,6 +45346,13 @@ async function validateCmsMdxFileContent(input) {
|
|
|
45321
45346
|
issues
|
|
45322
45347
|
};
|
|
45323
45348
|
}
|
|
45349
|
+
if (issues.length > 0) {
|
|
45350
|
+
return {
|
|
45351
|
+
file: input.file,
|
|
45352
|
+
ok: false,
|
|
45353
|
+
issues
|
|
45354
|
+
};
|
|
45355
|
+
}
|
|
45324
45356
|
return {
|
|
45325
45357
|
file: input.file,
|
|
45326
45358
|
ok: false,
|
|
@@ -46651,7 +46683,7 @@ function printScaffoldError(prefix, err) {
|
|
|
46651
46683
|
|
|
46652
46684
|
// src/index.ts
|
|
46653
46685
|
var program2 = new Command();
|
|
46654
|
-
program2.name("anymorph").description("Check AI visibility and run local GEO strategy workflows").version("0.
|
|
46686
|
+
program2.name("anymorph").description("Check AI visibility and run local GEO strategy workflows").version("0.10.0");
|
|
46655
46687
|
program2.command("login").description("Sign in to your Anymorph account").addHelpText(
|
|
46656
46688
|
"after",
|
|
46657
46689
|
`
|