@xtrable-ltd/nanoesis 0.1.11 → 0.1.13
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/adapter-azure-blob.js +1 -1
- package/dist/{chunk-XO3CT6GL.js → chunk-7TB5ANIS.js} +58 -4
- package/dist/chunk-LXNOLO66.js +1224 -0
- package/dist/editor-api.js +21 -1198
- package/dist/index.d.ts +50 -12
- package/dist/index.js +1 -1
- package/dist/mcp.d.ts +48 -0
- package/dist/mcp.js +76 -0
- package/editor/assets/{MigrationsPane-BYGqWBAA.js → MigrationsPane-BnVflp7I.js} +1 -1
- package/editor/assets/{TemplatesPane-B5hn_v0Z.js → TemplatesPane-DPcXg8ZA.js} +12 -8
- package/editor/assets/{cssMode-BbIf5k6I.js → cssMode-CA8TzUhD.js} +1 -1
- package/editor/assets/{freemarker2-DoW0pSYV.js → freemarker2-BVvYxc4P.js} +1 -1
- package/editor/assets/{handlebars-DLlET-qc.js → handlebars-mDJMZKVv.js} +1 -1
- package/editor/assets/{html-4khbqrhe.js → html-D6Gw0A_W.js} +1 -1
- package/editor/assets/{htmlMode-DblHkZ-k.js → htmlMode-BD8QBoPu.js} +1 -1
- package/editor/assets/index-DAuQQi22.js +138 -0
- package/editor/assets/{javascript-CgPO2Hmj.js → javascript-CT1GQ3oq.js} +1 -1
- package/editor/assets/{jsonMode-BrWh2436.js → jsonMode-CBS8chp_.js} +1 -1
- package/editor/assets/{liquid-BsQJXwPT.js → liquid-BywhH4Kg.js} +1 -1
- package/editor/assets/{mdx-AO8t67gx.js → mdx-VnQOs-88.js} +1 -1
- package/editor/assets/{python-3w4sZj5c.js → python-vRZdM7SD.js} +1 -1
- package/editor/assets/{razor-BFsvo06w.js → razor--qLVVNOO.js} +1 -1
- package/editor/assets/{tsMode-QrC4ERjp.js → tsMode-CLwp9V4R.js} +1 -1
- package/editor/assets/{typescript-BXJ3QLad.js → typescript-DUO5mANL.js} +1 -1
- package/editor/assets/{xml-CxKYn1FP.js → xml-CcxvqYR1.js} +1 -1
- package/editor/assets/{yaml-BmWLvF7Q.js → yaml-BpCmDgZz.js} +1 -1
- package/editor/index.html +1 -1
- package/package.json +7 -1
- package/editor/assets/index-Do1drqEQ.js +0 -138
|
@@ -43,6 +43,15 @@ var ContentParseError = class extends Error {
|
|
|
43
43
|
this.name = "ContentParseError";
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
|
+
var KNOWN_TOP_LEVEL_KEYS = /* @__PURE__ */ new Set([
|
|
47
|
+
"template",
|
|
48
|
+
"title",
|
|
49
|
+
"isPublished",
|
|
50
|
+
"fields",
|
|
51
|
+
"created",
|
|
52
|
+
"published",
|
|
53
|
+
"updated"
|
|
54
|
+
]);
|
|
46
55
|
function isPlainObject(value) {
|
|
47
56
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
48
57
|
}
|
|
@@ -72,6 +81,9 @@ function parseOptionalString(raw, key) {
|
|
|
72
81
|
return value;
|
|
73
82
|
}
|
|
74
83
|
function parseContentItem(raw) {
|
|
84
|
+
return parseContentItemWithDiagnostics(raw).item;
|
|
85
|
+
}
|
|
86
|
+
function parseContentItemWithDiagnostics(raw) {
|
|
75
87
|
if (!isPlainObject(raw)) {
|
|
76
88
|
throw new ContentParseError("A content item must be a JSON object.");
|
|
77
89
|
}
|
|
@@ -100,7 +112,8 @@ function parseContentItem(raw) {
|
|
|
100
112
|
const created = parseOptionalString(raw, "created");
|
|
101
113
|
const published = parseOptionalString(raw, "published");
|
|
102
114
|
const updated = parseOptionalString(raw, "updated");
|
|
103
|
-
|
|
115
|
+
const unknownTopLevelKeys = Object.keys(raw).filter((key) => !KNOWN_TOP_LEVEL_KEYS.has(key)).sort();
|
|
116
|
+
const item = {
|
|
104
117
|
title: raw.title,
|
|
105
118
|
isPublished,
|
|
106
119
|
fields,
|
|
@@ -109,6 +122,7 @@ function parseContentItem(raw) {
|
|
|
109
122
|
...published !== void 0 && { published },
|
|
110
123
|
...updated !== void 0 && { updated }
|
|
111
124
|
};
|
|
125
|
+
return { item, diagnostics: { unknownTopLevelKeys } };
|
|
112
126
|
}
|
|
113
127
|
|
|
114
128
|
// ../engine/src/content/sort.ts
|
|
@@ -776,10 +790,15 @@ var IndexedStore = class {
|
|
|
776
790
|
}
|
|
777
791
|
}
|
|
778
792
|
this.index = nextIndex;
|
|
793
|
+
let parseDiagnostics;
|
|
794
|
+
if (isContentItemPath(target)) {
|
|
795
|
+
parseDiagnostics = contentParseDiagnosticsFor(bytes);
|
|
796
|
+
}
|
|
779
797
|
return {
|
|
780
798
|
...stamped !== void 0 && { stamped },
|
|
781
799
|
...stampIncomplete === true && { stampIncomplete: true },
|
|
782
|
-
...schemaDelta !== void 0 && { schemaDelta }
|
|
800
|
+
...schemaDelta !== void 0 && { schemaDelta },
|
|
801
|
+
...parseDiagnostics !== void 0 && { parseDiagnostics }
|
|
783
802
|
};
|
|
784
803
|
});
|
|
785
804
|
}
|
|
@@ -897,6 +916,20 @@ function stampTargetOf(target) {
|
|
|
897
916
|
if (stem === "" || stem.includes("@v")) return void 0;
|
|
898
917
|
return { dir, name: stem };
|
|
899
918
|
}
|
|
919
|
+
function isContentItemPath(target) {
|
|
920
|
+
if (!target.startsWith("content/") || !target.endsWith(".json")) return false;
|
|
921
|
+
const tail = target.slice(target.lastIndexOf("/") + 1);
|
|
922
|
+
return tail !== "_sort.json" && tail !== "_redirects.json" && tail !== "_site.json";
|
|
923
|
+
}
|
|
924
|
+
function contentParseDiagnosticsFor(bytes) {
|
|
925
|
+
try {
|
|
926
|
+
const text = new TextDecoder().decode(bytes);
|
|
927
|
+
const { diagnostics } = parseContentItemWithDiagnostics(JSON.parse(text));
|
|
928
|
+
return diagnostics.unknownTopLevelKeys.length > 0 ? diagnostics : void 0;
|
|
929
|
+
} catch {
|
|
930
|
+
return void 0;
|
|
931
|
+
}
|
|
932
|
+
}
|
|
900
933
|
function guarded(key) {
|
|
901
934
|
if (key === "" || key.startsWith(RESERVED_PREFIX)) {
|
|
902
935
|
throw new Error(`Refusing to mutate a reserved key: ${key === "" ? "(root)" : key}`);
|
|
@@ -1081,8 +1114,14 @@ async function loadDir(source, dirPath, slug, treePath) {
|
|
|
1081
1114
|
async function loadItem(source, filePath, slug, parentPath2) {
|
|
1082
1115
|
const raw = await source.readText(filePath);
|
|
1083
1116
|
try {
|
|
1084
|
-
const item =
|
|
1085
|
-
return {
|
|
1117
|
+
const { item, diagnostics } = parseContentItemWithDiagnostics(JSON.parse(raw));
|
|
1118
|
+
return {
|
|
1119
|
+
kind: "item",
|
|
1120
|
+
slug,
|
|
1121
|
+
path: join(parentPath2, slug),
|
|
1122
|
+
item,
|
|
1123
|
+
...diagnostics.unknownTopLevelKeys.length > 0 && { parseDiagnostics: diagnostics }
|
|
1124
|
+
};
|
|
1086
1125
|
} catch (error) {
|
|
1087
1126
|
throw new Error(`Failed to load ${filePath}: ${error.message}`);
|
|
1088
1127
|
}
|
|
@@ -2598,6 +2637,12 @@ function guardrailsSection() {
|
|
|
2598
2637
|
{
|
|
2599
2638
|
name: "richtext values are HTML, shorttext/text are plain text",
|
|
2600
2639
|
summary: "For a `richtext` field, write the value as HTML (`<p>...</p>` etc). For `shorttext` or `text`, write plain text \u2014 any HTML you include is escaped at render time. If the gate emits a `content.type-drift` warning, a field's type changed destructively (commonly richtext \u2192 shorttext) and the old HTML content now renders as escaped text."
|
|
2640
|
+
},
|
|
2641
|
+
{
|
|
2642
|
+
name: "Content fields nest under `fields`, not at the top level",
|
|
2643
|
+
summary: "A content/*.json item has system keys at the top level (`template`, `title`, `isPublished`, `created`, `published`, `updated`) and ALL template-specific values under `fields`. Writing `{ template, title, body, tagline }` at the top level silently drops `body`/`tagline` because the parser is tolerant of unknown keys; the page publishes with empty placeholders. After write_file, check the response for `parseDiagnostics.unknownTopLevelKeys` and the gate for `content.unknown-top-level-key` \u2014 both list what was dropped.",
|
|
2644
|
+
detail: 'System keys are case-sensitive: `IsPublished` is not the same as `isPublished` (the typo silently defaults to false), and `Fields` is not `fields`. The same drop-and-flag applies. The published HTML for a tolerated-drift item will render with empty `<div class="prose"></div>` etc., which is the smoking-gun symptom.',
|
|
2645
|
+
example: '<!-- WRONG (body and tagline silently dropped) -->\n{ "template": "about", "title": "Hi", "body": "...", "tagline": "..." }\n\n<!-- RIGHT -->\n{ "template": "about", "title": "Hi", "fields": { "title": "Hi", "body": "...", "tagline": "..." } }'
|
|
2601
2646
|
}
|
|
2602
2647
|
]
|
|
2603
2648
|
};
|
|
@@ -2780,6 +2825,15 @@ async function validateSite(source) {
|
|
|
2780
2825
|
const owners = urlOwners.get(urlForItem(node.path)) ?? [];
|
|
2781
2826
|
owners.push(node.path);
|
|
2782
2827
|
urlOwners.set(urlForItem(node.path), owners);
|
|
2828
|
+
const dropped = node.parseDiagnostics?.unknownTopLevelKeys ?? [];
|
|
2829
|
+
if (dropped.length > 0) {
|
|
2830
|
+
add(
|
|
2831
|
+
"warning",
|
|
2832
|
+
"content.unknown-top-level-key",
|
|
2833
|
+
`"${node.path}" has top-level key${dropped.length === 1 ? "" : "s"} the parser does not recognise: ${dropped.map((k) => `"${k}"`).join(", ")}. They were dropped \u2014 content values belong under "fields" (and system keys are case-sensitive: "isPublished", not "IsPublished").`,
|
|
2834
|
+
node.path
|
|
2835
|
+
);
|
|
2836
|
+
}
|
|
2783
2837
|
if (templateName === void 0) {
|
|
2784
2838
|
add(
|
|
2785
2839
|
"error",
|