@xtrable-ltd/nanoesis 0.1.13 → 0.1.14
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-7TB5ANIS.js → chunk-CBLBQP27.js} +225 -224
- package/dist/{chunk-LXNOLO66.js → chunk-PKCYTOHW.js} +1 -4
- package/dist/editor-api.js +2 -2
- package/dist/index.js +1 -1
- package/dist/mcp.js +3 -3
- package/editor/assets/MigrationsPane-DSiYzhDN.js +4 -0
- package/editor/assets/{TemplatesPane-DPcXg8ZA.js → TemplatesPane-DacDItlh.js} +168 -168
- package/editor/assets/{cssMode-CA8TzUhD.js → cssMode-CiAvvnrb.js} +1 -1
- package/editor/assets/{freemarker2-BVvYxc4P.js → freemarker2-C7G3JwfA.js} +1 -1
- package/editor/assets/{handlebars-mDJMZKVv.js → handlebars-DsJPq-J8.js} +1 -1
- package/editor/assets/{html-D6Gw0A_W.js → html-i_wgtIMk.js} +1 -1
- package/editor/assets/{htmlMode-BD8QBoPu.js → htmlMode-Bx_dmHBj.js} +1 -1
- package/editor/assets/index-CLUiygGJ.js +138 -0
- package/editor/assets/{javascript-CT1GQ3oq.js → javascript-C3n1eUNo.js} +1 -1
- package/editor/assets/{jsonMode-CBS8chp_.js → jsonMode-BpC5c5px.js} +1 -1
- package/editor/assets/{liquid-BywhH4Kg.js → liquid-B3_Yp2NE.js} +1 -1
- package/editor/assets/{mdx-VnQOs-88.js → mdx-nOh_vCzd.js} +1 -1
- package/editor/assets/{python-vRZdM7SD.js → python-BZXwPif_.js} +1 -1
- package/editor/assets/{razor--qLVVNOO.js → razor-BYwO2G_q.js} +1 -1
- package/editor/assets/{tsMode-CLwp9V4R.js → tsMode-CmNOLqvJ.js} +1 -1
- package/editor/assets/{typescript-DUO5mANL.js → typescript-C9KU4rft.js} +1 -1
- package/editor/assets/{xml-CcxvqYR1.js → xml-CFRBv758.js} +1 -1
- package/editor/assets/{yaml-BpCmDgZz.js → yaml-Co0yIk6T.js} +1 -1
- package/editor/index.html +1 -1
- package/package.json +1 -1
- package/editor/assets/MigrationsPane-BnVflp7I.js +0 -4
- package/editor/assets/index-DAuQQi22.js +0 -138
|
@@ -168,6 +168,218 @@ function copy(bytes) {
|
|
|
168
168
|
return bytes.slice();
|
|
169
169
|
}
|
|
170
170
|
|
|
171
|
+
// ../engine/src/url/redirects.ts
|
|
172
|
+
var DEFAULT_STATUS = 301;
|
|
173
|
+
var OUTPUT_PATH = "_redirects";
|
|
174
|
+
function isRule(value) {
|
|
175
|
+
if (typeof value !== "object" || value === null) return false;
|
|
176
|
+
const record = value;
|
|
177
|
+
return typeof record.from === "string" && typeof record.to === "string";
|
|
178
|
+
}
|
|
179
|
+
function parseRedirects(raw) {
|
|
180
|
+
if (!Array.isArray(raw)) return [];
|
|
181
|
+
const rules = [];
|
|
182
|
+
for (const entry of raw) {
|
|
183
|
+
if (!isRule(entry)) continue;
|
|
184
|
+
const status = entry.status;
|
|
185
|
+
rules.push(
|
|
186
|
+
typeof status === "number" && Number.isInteger(status) ? { from: entry.from, to: entry.to, status } : { from: entry.from, to: entry.to }
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
return rules;
|
|
190
|
+
}
|
|
191
|
+
function resolveTarget(from, exact) {
|
|
192
|
+
const seen = /* @__PURE__ */ new Set([from]);
|
|
193
|
+
let target = exact.get(from).to;
|
|
194
|
+
while (exact.has(target) && !seen.has(target)) {
|
|
195
|
+
seen.add(target);
|
|
196
|
+
target = exact.get(target).to;
|
|
197
|
+
}
|
|
198
|
+
return target;
|
|
199
|
+
}
|
|
200
|
+
function buildRedirects(rules, liveUrls) {
|
|
201
|
+
const exact = /* @__PURE__ */ new Map();
|
|
202
|
+
const wildcard = /* @__PURE__ */ new Map();
|
|
203
|
+
for (const rule of rules) {
|
|
204
|
+
(rule.from.includes("*") ? wildcard : exact).set(rule.from, rule);
|
|
205
|
+
}
|
|
206
|
+
const resolved = [];
|
|
207
|
+
for (const [from, rule] of exact) {
|
|
208
|
+
if (liveUrls.has(from)) continue;
|
|
209
|
+
const to = resolveTarget(from, exact);
|
|
210
|
+
if (to === from) continue;
|
|
211
|
+
resolved.push(rule.status !== void 0 ? { from, to, status: rule.status } : { from, to });
|
|
212
|
+
}
|
|
213
|
+
resolved.push(...wildcard.values());
|
|
214
|
+
if (resolved.length === 0) return void 0;
|
|
215
|
+
resolved.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to));
|
|
216
|
+
const contents = resolved.map((rule) => `${rule.from} ${rule.to} ${rule.status ?? DEFAULT_STATUS}
|
|
217
|
+
`).join("");
|
|
218
|
+
return { path: OUTPUT_PATH, contents };
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// ../engine/src/content/loader.ts
|
|
222
|
+
var SORT_FILE = "_sort.json";
|
|
223
|
+
var REDIRECTS_FILE = "_redirects.json";
|
|
224
|
+
var SITE_CONFIG_FILE = "_site.json";
|
|
225
|
+
var ASSETS_DIR = "assets";
|
|
226
|
+
var ITEM_EXT = ".json";
|
|
227
|
+
var DEFAULT_DIRS = {
|
|
228
|
+
content: "content",
|
|
229
|
+
templates: "templates",
|
|
230
|
+
components: "components",
|
|
231
|
+
/** Static passthrough, copied verbatim to the published root (DESIGN §8). The
|
|
232
|
+
* engine never reads it; named here so hosts/editor share one source of truth. */
|
|
233
|
+
public: "public"
|
|
234
|
+
};
|
|
235
|
+
function join(...parts) {
|
|
236
|
+
return parts.filter((part) => part !== "").join("/");
|
|
237
|
+
}
|
|
238
|
+
function stripBom(text) {
|
|
239
|
+
return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
|
|
240
|
+
}
|
|
241
|
+
async function loadContentTree(source, contentDir = DEFAULT_DIRS.content) {
|
|
242
|
+
return loadDir(source, contentDir, "", "");
|
|
243
|
+
}
|
|
244
|
+
async function loadDir(source, dirPath, slug, treePath) {
|
|
245
|
+
const [entries, sort] = await Promise.all([source.list(dirPath), readSort(source, dirPath)]);
|
|
246
|
+
const childMap = /* @__PURE__ */ new Map();
|
|
247
|
+
for (const entry of entries) {
|
|
248
|
+
if (entry.kind === "file") {
|
|
249
|
+
if (entry.name === SORT_FILE || entry.name === REDIRECTS_FILE || entry.name === SITE_CONFIG_FILE || !entry.name.endsWith(ITEM_EXT))
|
|
250
|
+
continue;
|
|
251
|
+
const childSlug = entry.name.slice(0, -ITEM_EXT.length);
|
|
252
|
+
childMap.set(
|
|
253
|
+
childSlug,
|
|
254
|
+
await loadItem(source, join(dirPath, entry.name), childSlug, treePath)
|
|
255
|
+
);
|
|
256
|
+
} else {
|
|
257
|
+
if (entry.name === ASSETS_DIR) continue;
|
|
258
|
+
const childPath = join(treePath, entry.name);
|
|
259
|
+
childMap.set(
|
|
260
|
+
entry.name,
|
|
261
|
+
await loadDir(source, join(dirPath, entry.name), entry.name, childPath)
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
const name = sort.name ?? (slug === "" ? "" : humanize(slug));
|
|
266
|
+
return {
|
|
267
|
+
kind: "dir",
|
|
268
|
+
slug,
|
|
269
|
+
name,
|
|
270
|
+
path: treePath,
|
|
271
|
+
children: orderChildren(childMap, sort.order),
|
|
272
|
+
...sort.collection !== void 0 && { collection: sort.collection },
|
|
273
|
+
...sort.defaultTemplate !== void 0 && { defaultTemplate: sort.defaultTemplate }
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
async function loadItem(source, filePath, slug, parentPath2) {
|
|
277
|
+
const raw = await source.readText(filePath);
|
|
278
|
+
try {
|
|
279
|
+
const { item, diagnostics } = parseContentItemWithDiagnostics(JSON.parse(raw));
|
|
280
|
+
return {
|
|
281
|
+
kind: "item",
|
|
282
|
+
slug,
|
|
283
|
+
path: join(parentPath2, slug),
|
|
284
|
+
item,
|
|
285
|
+
...diagnostics.unknownTopLevelKeys.length > 0 && { parseDiagnostics: diagnostics }
|
|
286
|
+
};
|
|
287
|
+
} catch (error) {
|
|
288
|
+
throw new Error(`Failed to load ${filePath}: ${error.message}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
async function readSort(source, dirPath) {
|
|
292
|
+
const path = join(dirPath, SORT_FILE);
|
|
293
|
+
if (!await source.exists(path)) return { order: [] };
|
|
294
|
+
try {
|
|
295
|
+
return parseSortFile(JSON.parse(await source.readText(path)));
|
|
296
|
+
} catch {
|
|
297
|
+
return { order: [] };
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
async function loadRedirects(source, contentDir = DEFAULT_DIRS.content) {
|
|
301
|
+
const path = join(contentDir, REDIRECTS_FILE);
|
|
302
|
+
if (!await source.exists(path)) return [];
|
|
303
|
+
try {
|
|
304
|
+
return parseRedirects(JSON.parse(stripBom(await source.readText(path))));
|
|
305
|
+
} catch {
|
|
306
|
+
return [];
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
async function loadSiteConfig(source, contentDir = DEFAULT_DIRS.content) {
|
|
310
|
+
const path = join(contentDir, SITE_CONFIG_FILE);
|
|
311
|
+
if (!await source.exists(path)) return {};
|
|
312
|
+
try {
|
|
313
|
+
const raw = JSON.parse(stripBom(await source.readText(path)));
|
|
314
|
+
const baseUrl = typeof raw.baseUrl === "string" ? raw.baseUrl.trim() : "";
|
|
315
|
+
return baseUrl !== "" ? { baseUrl } : {};
|
|
316
|
+
} catch {
|
|
317
|
+
return {};
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
function orderChildren(map, order) {
|
|
321
|
+
const out = [];
|
|
322
|
+
const used = /* @__PURE__ */ new Set();
|
|
323
|
+
for (const slug of order) {
|
|
324
|
+
const node = map.get(slug);
|
|
325
|
+
if (node !== void 0) {
|
|
326
|
+
out.push(node);
|
|
327
|
+
used.add(slug);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
for (const [slug, node] of map) {
|
|
331
|
+
if (!used.has(slug)) out.push(node);
|
|
332
|
+
}
|
|
333
|
+
return out;
|
|
334
|
+
}
|
|
335
|
+
function loadComponents(source, componentsDir = DEFAULT_DIRS.components) {
|
|
336
|
+
return loadComponentFiles(source, componentsDir, "html");
|
|
337
|
+
}
|
|
338
|
+
function loadComponentStyles(source, componentsDir = DEFAULT_DIRS.components) {
|
|
339
|
+
return loadComponentFiles(source, componentsDir, "css");
|
|
340
|
+
}
|
|
341
|
+
function loadComponentScripts(source, componentsDir = DEFAULT_DIRS.components) {
|
|
342
|
+
return loadComponentFiles(source, componentsDir, "js");
|
|
343
|
+
}
|
|
344
|
+
async function loadComponentFiles(source, componentsDir, extension) {
|
|
345
|
+
const suffix = `.${extension}`;
|
|
346
|
+
const map = /* @__PURE__ */ new Map();
|
|
347
|
+
const walk = async (dir) => {
|
|
348
|
+
if (!await source.exists(dir)) return;
|
|
349
|
+
for (const entry of await source.list(dir)) {
|
|
350
|
+
const full = join(dir, entry.name);
|
|
351
|
+
if (entry.kind === "dir") {
|
|
352
|
+
await walk(full);
|
|
353
|
+
} else if (entry.name.endsWith(suffix)) {
|
|
354
|
+
const key = entry.name.slice(0, -suffix.length).toLowerCase();
|
|
355
|
+
map.set(key, await source.readText(full));
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
await walk(componentsDir);
|
|
360
|
+
return map;
|
|
361
|
+
}
|
|
362
|
+
async function loadTemplate(source, name, templatesDir = DEFAULT_DIRS.templates) {
|
|
363
|
+
return source.readText(join(templatesDir, `${name}.html`));
|
|
364
|
+
}
|
|
365
|
+
function loadTemplateStyle(source, name, templatesDir = DEFAULT_DIRS.templates) {
|
|
366
|
+
return tryReadText(source, join(templatesDir, `${name}.css`));
|
|
367
|
+
}
|
|
368
|
+
function loadTemplateScript(source, name, templatesDir = DEFAULT_DIRS.templates) {
|
|
369
|
+
return tryReadText(source, join(templatesDir, `${name}.js`));
|
|
370
|
+
}
|
|
371
|
+
var DOCUMENT_SHELL = "document";
|
|
372
|
+
function loadDocumentShell(source, templatesDir = DEFAULT_DIRS.templates) {
|
|
373
|
+
return tryReadText(source, join(templatesDir, `${DOCUMENT_SHELL}.html`));
|
|
374
|
+
}
|
|
375
|
+
async function tryReadText(source, path) {
|
|
376
|
+
try {
|
|
377
|
+
return await source.readText(path);
|
|
378
|
+
} catch {
|
|
379
|
+
return void 0;
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
171
383
|
// ../engine/src/html/dom.ts
|
|
172
384
|
import { parse, parseFragment, serialize } from "parse5";
|
|
173
385
|
function isElement(node) {
|
|
@@ -914,6 +1126,7 @@ function stampTargetOf(target) {
|
|
|
914
1126
|
if (dir === void 0) return void 0;
|
|
915
1127
|
const stem = target.slice(dir.length + 1, -".html".length);
|
|
916
1128
|
if (stem === "" || stem.includes("@v")) return void 0;
|
|
1129
|
+
if (dir === "templates" && stem === DOCUMENT_SHELL) return void 0;
|
|
917
1130
|
return { dir, name: stem };
|
|
918
1131
|
}
|
|
919
1132
|
function isContentItemPath(target) {
|
|
@@ -1006,218 +1219,6 @@ var InMemoryContentSource = class {
|
|
|
1006
1219
|
}
|
|
1007
1220
|
};
|
|
1008
1221
|
|
|
1009
|
-
// ../engine/src/url/redirects.ts
|
|
1010
|
-
var DEFAULT_STATUS = 301;
|
|
1011
|
-
var OUTPUT_PATH = "_redirects";
|
|
1012
|
-
function isRule(value) {
|
|
1013
|
-
if (typeof value !== "object" || value === null) return false;
|
|
1014
|
-
const record = value;
|
|
1015
|
-
return typeof record.from === "string" && typeof record.to === "string";
|
|
1016
|
-
}
|
|
1017
|
-
function parseRedirects(raw) {
|
|
1018
|
-
if (!Array.isArray(raw)) return [];
|
|
1019
|
-
const rules = [];
|
|
1020
|
-
for (const entry of raw) {
|
|
1021
|
-
if (!isRule(entry)) continue;
|
|
1022
|
-
const status = entry.status;
|
|
1023
|
-
rules.push(
|
|
1024
|
-
typeof status === "number" && Number.isInteger(status) ? { from: entry.from, to: entry.to, status } : { from: entry.from, to: entry.to }
|
|
1025
|
-
);
|
|
1026
|
-
}
|
|
1027
|
-
return rules;
|
|
1028
|
-
}
|
|
1029
|
-
function resolveTarget(from, exact) {
|
|
1030
|
-
const seen = /* @__PURE__ */ new Set([from]);
|
|
1031
|
-
let target = exact.get(from).to;
|
|
1032
|
-
while (exact.has(target) && !seen.has(target)) {
|
|
1033
|
-
seen.add(target);
|
|
1034
|
-
target = exact.get(target).to;
|
|
1035
|
-
}
|
|
1036
|
-
return target;
|
|
1037
|
-
}
|
|
1038
|
-
function buildRedirects(rules, liveUrls) {
|
|
1039
|
-
const exact = /* @__PURE__ */ new Map();
|
|
1040
|
-
const wildcard = /* @__PURE__ */ new Map();
|
|
1041
|
-
for (const rule of rules) {
|
|
1042
|
-
(rule.from.includes("*") ? wildcard : exact).set(rule.from, rule);
|
|
1043
|
-
}
|
|
1044
|
-
const resolved = [];
|
|
1045
|
-
for (const [from, rule] of exact) {
|
|
1046
|
-
if (liveUrls.has(from)) continue;
|
|
1047
|
-
const to = resolveTarget(from, exact);
|
|
1048
|
-
if (to === from) continue;
|
|
1049
|
-
resolved.push(rule.status !== void 0 ? { from, to, status: rule.status } : { from, to });
|
|
1050
|
-
}
|
|
1051
|
-
resolved.push(...wildcard.values());
|
|
1052
|
-
if (resolved.length === 0) return void 0;
|
|
1053
|
-
resolved.sort((a, b) => a.from.localeCompare(b.from) || a.to.localeCompare(b.to));
|
|
1054
|
-
const contents = resolved.map((rule) => `${rule.from} ${rule.to} ${rule.status ?? DEFAULT_STATUS}
|
|
1055
|
-
`).join("");
|
|
1056
|
-
return { path: OUTPUT_PATH, contents };
|
|
1057
|
-
}
|
|
1058
|
-
|
|
1059
|
-
// ../engine/src/content/loader.ts
|
|
1060
|
-
var SORT_FILE = "_sort.json";
|
|
1061
|
-
var REDIRECTS_FILE = "_redirects.json";
|
|
1062
|
-
var SITE_CONFIG_FILE = "_site.json";
|
|
1063
|
-
var ASSETS_DIR = "assets";
|
|
1064
|
-
var ITEM_EXT = ".json";
|
|
1065
|
-
var DEFAULT_DIRS = {
|
|
1066
|
-
content: "content",
|
|
1067
|
-
templates: "templates",
|
|
1068
|
-
components: "components",
|
|
1069
|
-
/** Static passthrough, copied verbatim to the published root (DESIGN §8). The
|
|
1070
|
-
* engine never reads it; named here so hosts/editor share one source of truth. */
|
|
1071
|
-
public: "public"
|
|
1072
|
-
};
|
|
1073
|
-
function join(...parts) {
|
|
1074
|
-
return parts.filter((part) => part !== "").join("/");
|
|
1075
|
-
}
|
|
1076
|
-
function stripBom(text) {
|
|
1077
|
-
return text.charCodeAt(0) === 65279 ? text.slice(1) : text;
|
|
1078
|
-
}
|
|
1079
|
-
async function loadContentTree(source, contentDir = DEFAULT_DIRS.content) {
|
|
1080
|
-
return loadDir(source, contentDir, "", "");
|
|
1081
|
-
}
|
|
1082
|
-
async function loadDir(source, dirPath, slug, treePath) {
|
|
1083
|
-
const [entries, sort] = await Promise.all([source.list(dirPath), readSort(source, dirPath)]);
|
|
1084
|
-
const childMap = /* @__PURE__ */ new Map();
|
|
1085
|
-
for (const entry of entries) {
|
|
1086
|
-
if (entry.kind === "file") {
|
|
1087
|
-
if (entry.name === SORT_FILE || entry.name === REDIRECTS_FILE || entry.name === SITE_CONFIG_FILE || !entry.name.endsWith(ITEM_EXT))
|
|
1088
|
-
continue;
|
|
1089
|
-
const childSlug = entry.name.slice(0, -ITEM_EXT.length);
|
|
1090
|
-
childMap.set(
|
|
1091
|
-
childSlug,
|
|
1092
|
-
await loadItem(source, join(dirPath, entry.name), childSlug, treePath)
|
|
1093
|
-
);
|
|
1094
|
-
} else {
|
|
1095
|
-
if (entry.name === ASSETS_DIR) continue;
|
|
1096
|
-
const childPath = join(treePath, entry.name);
|
|
1097
|
-
childMap.set(
|
|
1098
|
-
entry.name,
|
|
1099
|
-
await loadDir(source, join(dirPath, entry.name), entry.name, childPath)
|
|
1100
|
-
);
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
const name = sort.name ?? (slug === "" ? "" : humanize(slug));
|
|
1104
|
-
return {
|
|
1105
|
-
kind: "dir",
|
|
1106
|
-
slug,
|
|
1107
|
-
name,
|
|
1108
|
-
path: treePath,
|
|
1109
|
-
children: orderChildren(childMap, sort.order),
|
|
1110
|
-
...sort.collection !== void 0 && { collection: sort.collection },
|
|
1111
|
-
...sort.defaultTemplate !== void 0 && { defaultTemplate: sort.defaultTemplate }
|
|
1112
|
-
};
|
|
1113
|
-
}
|
|
1114
|
-
async function loadItem(source, filePath, slug, parentPath2) {
|
|
1115
|
-
const raw = await source.readText(filePath);
|
|
1116
|
-
try {
|
|
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
|
-
};
|
|
1125
|
-
} catch (error) {
|
|
1126
|
-
throw new Error(`Failed to load ${filePath}: ${error.message}`);
|
|
1127
|
-
}
|
|
1128
|
-
}
|
|
1129
|
-
async function readSort(source, dirPath) {
|
|
1130
|
-
const path = join(dirPath, SORT_FILE);
|
|
1131
|
-
if (!await source.exists(path)) return { order: [] };
|
|
1132
|
-
try {
|
|
1133
|
-
return parseSortFile(JSON.parse(await source.readText(path)));
|
|
1134
|
-
} catch {
|
|
1135
|
-
return { order: [] };
|
|
1136
|
-
}
|
|
1137
|
-
}
|
|
1138
|
-
async function loadRedirects(source, contentDir = DEFAULT_DIRS.content) {
|
|
1139
|
-
const path = join(contentDir, REDIRECTS_FILE);
|
|
1140
|
-
if (!await source.exists(path)) return [];
|
|
1141
|
-
try {
|
|
1142
|
-
return parseRedirects(JSON.parse(stripBom(await source.readText(path))));
|
|
1143
|
-
} catch {
|
|
1144
|
-
return [];
|
|
1145
|
-
}
|
|
1146
|
-
}
|
|
1147
|
-
async function loadSiteConfig(source, contentDir = DEFAULT_DIRS.content) {
|
|
1148
|
-
const path = join(contentDir, SITE_CONFIG_FILE);
|
|
1149
|
-
if (!await source.exists(path)) return {};
|
|
1150
|
-
try {
|
|
1151
|
-
const raw = JSON.parse(stripBom(await source.readText(path)));
|
|
1152
|
-
const baseUrl = typeof raw.baseUrl === "string" ? raw.baseUrl.trim() : "";
|
|
1153
|
-
return baseUrl !== "" ? { baseUrl } : {};
|
|
1154
|
-
} catch {
|
|
1155
|
-
return {};
|
|
1156
|
-
}
|
|
1157
|
-
}
|
|
1158
|
-
function orderChildren(map, order) {
|
|
1159
|
-
const out = [];
|
|
1160
|
-
const used = /* @__PURE__ */ new Set();
|
|
1161
|
-
for (const slug of order) {
|
|
1162
|
-
const node = map.get(slug);
|
|
1163
|
-
if (node !== void 0) {
|
|
1164
|
-
out.push(node);
|
|
1165
|
-
used.add(slug);
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
for (const [slug, node] of map) {
|
|
1169
|
-
if (!used.has(slug)) out.push(node);
|
|
1170
|
-
}
|
|
1171
|
-
return out;
|
|
1172
|
-
}
|
|
1173
|
-
function loadComponents(source, componentsDir = DEFAULT_DIRS.components) {
|
|
1174
|
-
return loadComponentFiles(source, componentsDir, "html");
|
|
1175
|
-
}
|
|
1176
|
-
function loadComponentStyles(source, componentsDir = DEFAULT_DIRS.components) {
|
|
1177
|
-
return loadComponentFiles(source, componentsDir, "css");
|
|
1178
|
-
}
|
|
1179
|
-
function loadComponentScripts(source, componentsDir = DEFAULT_DIRS.components) {
|
|
1180
|
-
return loadComponentFiles(source, componentsDir, "js");
|
|
1181
|
-
}
|
|
1182
|
-
async function loadComponentFiles(source, componentsDir, extension) {
|
|
1183
|
-
const suffix = `.${extension}`;
|
|
1184
|
-
const map = /* @__PURE__ */ new Map();
|
|
1185
|
-
const walk = async (dir) => {
|
|
1186
|
-
if (!await source.exists(dir)) return;
|
|
1187
|
-
for (const entry of await source.list(dir)) {
|
|
1188
|
-
const full = join(dir, entry.name);
|
|
1189
|
-
if (entry.kind === "dir") {
|
|
1190
|
-
await walk(full);
|
|
1191
|
-
} else if (entry.name.endsWith(suffix)) {
|
|
1192
|
-
const key = entry.name.slice(0, -suffix.length).toLowerCase();
|
|
1193
|
-
map.set(key, await source.readText(full));
|
|
1194
|
-
}
|
|
1195
|
-
}
|
|
1196
|
-
};
|
|
1197
|
-
await walk(componentsDir);
|
|
1198
|
-
return map;
|
|
1199
|
-
}
|
|
1200
|
-
async function loadTemplate(source, name, templatesDir = DEFAULT_DIRS.templates) {
|
|
1201
|
-
return source.readText(join(templatesDir, `${name}.html`));
|
|
1202
|
-
}
|
|
1203
|
-
function loadTemplateStyle(source, name, templatesDir = DEFAULT_DIRS.templates) {
|
|
1204
|
-
return tryReadText(source, join(templatesDir, `${name}.css`));
|
|
1205
|
-
}
|
|
1206
|
-
function loadTemplateScript(source, name, templatesDir = DEFAULT_DIRS.templates) {
|
|
1207
|
-
return tryReadText(source, join(templatesDir, `${name}.js`));
|
|
1208
|
-
}
|
|
1209
|
-
var DOCUMENT_SHELL = "document";
|
|
1210
|
-
function loadDocumentShell(source, templatesDir = DEFAULT_DIRS.templates) {
|
|
1211
|
-
return tryReadText(source, join(templatesDir, `${DOCUMENT_SHELL}.html`));
|
|
1212
|
-
}
|
|
1213
|
-
async function tryReadText(source, path) {
|
|
1214
|
-
try {
|
|
1215
|
-
return await source.readText(path);
|
|
1216
|
-
} catch {
|
|
1217
|
-
return void 0;
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
1222
|
// ../engine/src/url/references.ts
|
|
1222
1223
|
var REFERENCE_PREFIX = "ref:";
|
|
1223
1224
|
function referenceTarget(value) {
|
|
@@ -3307,6 +3308,18 @@ export {
|
|
|
3307
3308
|
parseContentItem,
|
|
3308
3309
|
parseSortFile,
|
|
3309
3310
|
InMemoryBlobStore,
|
|
3311
|
+
parseRedirects,
|
|
3312
|
+
buildRedirects,
|
|
3313
|
+
DEFAULT_DIRS,
|
|
3314
|
+
loadContentTree,
|
|
3315
|
+
loadRedirects,
|
|
3316
|
+
loadSiteConfig,
|
|
3317
|
+
loadComponents,
|
|
3318
|
+
loadComponentStyles,
|
|
3319
|
+
loadComponentScripts,
|
|
3320
|
+
loadTemplate,
|
|
3321
|
+
DOCUMENT_SHELL,
|
|
3322
|
+
loadDocumentShell,
|
|
3310
3323
|
FIELD_TYPES,
|
|
3311
3324
|
isFieldType,
|
|
3312
3325
|
valueKindOf,
|
|
@@ -3330,18 +3343,6 @@ export {
|
|
|
3330
3343
|
reconcileIndex,
|
|
3331
3344
|
IndexedStore,
|
|
3332
3345
|
InMemoryContentSource,
|
|
3333
|
-
parseRedirects,
|
|
3334
|
-
buildRedirects,
|
|
3335
|
-
DEFAULT_DIRS,
|
|
3336
|
-
loadContentTree,
|
|
3337
|
-
loadRedirects,
|
|
3338
|
-
loadSiteConfig,
|
|
3339
|
-
loadComponents,
|
|
3340
|
-
loadComponentStyles,
|
|
3341
|
-
loadComponentScripts,
|
|
3342
|
-
loadTemplate,
|
|
3343
|
-
DOCUMENT_SHELL,
|
|
3344
|
-
loadDocumentShell,
|
|
3345
3346
|
analyzeTemplate,
|
|
3346
3347
|
pendingMigrations,
|
|
3347
3348
|
bestFitSnapshot,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
renderReferenceMarkdown,
|
|
16
16
|
validateSite,
|
|
17
17
|
workingStoreRoundTripDiagnostic
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-CBLBQP27.js";
|
|
19
19
|
|
|
20
20
|
// ../editor-api/src/scaffold.ts
|
|
21
21
|
var HOME_HTML = `<!doctype html>
|
|
@@ -570,9 +570,6 @@ async function dispatchApi(deps, req) {
|
|
|
570
570
|
if (deps.reconcile === void 0) {
|
|
571
571
|
return json(404, { ok: false, error: "reconcile is not available on this host" });
|
|
572
572
|
}
|
|
573
|
-
if (!hasRole(principal, "admin")) {
|
|
574
|
-
return json(403, { ok: false, error: "admin role required" });
|
|
575
|
-
}
|
|
576
573
|
const result = await deps.reconcile();
|
|
577
574
|
return json(200, {
|
|
578
575
|
ok: true,
|
package/dist/editor-api.js
CHANGED
|
@@ -18,8 +18,8 @@ import {
|
|
|
18
18
|
recreateHomeTemplateRepair,
|
|
19
19
|
templateSnapshotIntegrityDiagnostic,
|
|
20
20
|
templateSuffixConflictDiagnostic
|
|
21
|
-
} from "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
} from "./chunk-PKCYTOHW.js";
|
|
22
|
+
import "./chunk-CBLBQP27.js";
|
|
23
23
|
export {
|
|
24
24
|
FileBrandingStore,
|
|
25
25
|
InMemoryBrandingStore,
|
package/dist/index.js
CHANGED
package/dist/mcp.js
CHANGED
|
@@ -3,8 +3,8 @@ import {
|
|
|
3
3
|
MCP_TOOLS,
|
|
4
4
|
callMcpTool,
|
|
5
5
|
readMcpResource
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-PKCYTOHW.js";
|
|
7
|
+
import "./chunk-CBLBQP27.js";
|
|
8
8
|
|
|
9
9
|
// ../../hosts/host-mcp/src/http.ts
|
|
10
10
|
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
@@ -56,7 +56,7 @@ function createMcpServer(deps, identity) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
// ../../hosts/host-mcp/src/http.ts
|
|
59
|
-
var DEFAULT_VERSION = true ? "0.1.
|
|
59
|
+
var DEFAULT_VERSION = true ? "0.1.14" : "0.0.0-workspace";
|
|
60
60
|
async function handleMcpRequest(deps, request, opts) {
|
|
61
61
|
const server = createMcpServer(deps, {
|
|
62
62
|
name: opts?.name ?? "nanoesis",
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{ae as Qe,aB as F,ac as Te,a6 as g,T as w,Q as e,f as n,a7 as Ue,o as a,N as H,aC as h,w as O,ax as o,O as _,ap as v,p as Ve,G as X,v as ze,g as He,aI as Xe,av as c,aD as A,ar as Y,as as _e,U as Ye,ao as Ze,a8 as ea}from"./index-CLUiygGJ.js";var aa=_('<p class="placeholder svelte-1lpfi31">Loading preview…</p>'),ta=_('<p class="error svelte-1lpfi31" role="alert"> </p>'),la=_("<option> </option>"),sa=_('<select class="svelte-1lpfi31"></select>'),ra=_('<li class="orphan svelte-1lpfi31"><div class="orphan-head svelte-1lpfi31"><code class="orphan-name svelte-1lpfi31"> </code> <span class="orphan-value svelte-1lpfi31"> </span></div> <div class="orphan-actions svelte-1lpfi31" role="radiogroup"><label class="svelte-1lpfi31"><input type="radio" value="drop"/> Drop</label> <label class="svelte-1lpfi31"><input type="radio" value="keep"/> Keep (unrendered)</label> <label class="svelte-1lpfi31"><input type="radio" value="rename"/> Rename to</label> <!></div></li>'),ia=_(`<section class="resolutions svelte-1lpfi31" aria-label="Orphan field resolutions"><h3 class="svelte-1lpfi31">Orphan fields</h3> <p class="hint svelte-1lpfi31">These fields exist in this item's JSON but the current template doesn't render them.
|
|
2
|
+
Pick what to do with each.</p> <ul class="orphans svelte-1lpfi31"></ul></section>`),na=_('<p class="error svelte-1lpfi31" role="alert"> </p>'),oa=_('<div class="diff svelte-1lpfi31"><section class="pane svelte-1lpfi31" aria-label="Previous version (left)"><header class="pane-head svelte-1lpfi31"><!></header> <pre class="source svelte-1lpfi31"> </pre></section> <section class="pane svelte-1lpfi31" aria-label="Current template (right)"><header class="pane-head svelte-1lpfi31"> </header> <pre class="source svelte-1lpfi31"> </pre></section></div> <!> <!> <div class="commit-bar svelte-1lpfi31"><button type="button" class="primary svelte-1lpfi31"> </button></div>',1),va=_('<header class="detail-head svelte-1lpfi31"><button type="button" class="back svelte-1lpfi31">← Back</button> <h2 class="svelte-1lpfi31"> </h2></header> <!>',1),pa=_('<p class="error svelte-1lpfi31" role="alert"> </p>'),ca=_('<p class="placeholder svelte-1lpfi31">Loading…</p>'),fa=_(`<div class="empty svelte-1lpfi31"><h3 class="svelte-1lpfi31">All caught up</h3> <p>Every content item's fields match its bound template. Migrations show up here when a
|
|
3
|
+
destructive template edit (or a manual hand-edit) leaves an item with orphan fields.</p></div>`),da=_('<li class="item"><button class="item-row svelte-1lpfi31" type="button"><span class="item-path svelte-1lpfi31"><code> </code></span> <span class="item-summary svelte-1lpfi31"><!> <!> <!></span> <span class="open-icon svelte-1lpfi31">→</span></button></li>'),ua=_('<section class="group svelte-1lpfi31"><h3 class="group-title svelte-1lpfi31"><code class="svelte-1lpfi31"> </code> <span class="count svelte-1lpfi31"> </span></h3> <ul class="items svelte-1lpfi31"></ul></section>'),ma=_('<header class="list-head svelte-1lpfi31"><h2>Migrations</h2> <button type="button" class="svelte-1lpfi31"> </button></header> <!>',1),_a=_('<div class="migrations svelte-1lpfi31"><!> <!></div>');function ga(Le,Re){Qe(Re,!0);let j=F(null),d=F(null),Z=F(!1),C=F(null),r=F(Te({})),he=F(Te({})),D=F(!1),I=F(null);g.ensureLoaded();async function Ce(s){v(j,s,!0),v(r,{},!0),v(he,{},!0),v(d,null),v(C,null),v(Z,!0);try{v(d,await ea(s),!0);const f={};for(const l of e(d).orphans){const u=Ee(l.name,e(d).currentTemplateFields);f[l.name]=u?{rename:u}:"keep"}v(r,f,!0)}catch(f){v(C,f instanceof Error?f.message:String(f),!0)}finally{v(Z,!1)}}function ge(){v(j,null),v(d,null),v(C,null)}function Ee(s,f){const l=s.toLowerCase();for(const u of f)if(u.toLowerCase().startsWith(l)||u.toLowerCase().endsWith(l))return u;return null}async function Se(){if(!(e(j)===null||e(d)===null)){v(D,!0),v(I,null);try{const s={drop:Object.entries(e(r)).filter(([,l])=>l==="drop").map(([l])=>l),keep:Object.entries(e(r)).filter(([,l])=>l==="keep").map(([l])=>l),rename:Object.fromEntries(Object.entries(e(r)).filter(([,l])=>typeof l=="object"&&l!==null&&"rename"in l).map(([l,u])=>[l,u.rename])),fill:{...e(he)}},f=await He(e(j),s);g.refresh().catch(()=>{}),ge()}catch(s){v(I,s instanceof Error?s.message:String(s),!0)}finally{v(D,!1)}}}function Pe(s){return typeof s=="string"?s:JSON.stringify(s)}const Be=Xe(()=>g.list===null?[]:Object.entries(g.list.byTemplate).map(([s,f])=>({template:s,items:[...f].sort((l,u)=>l.path.localeCompare(u.path))})));var be=_a(),xe=a(be);{var qe=s=>{var f=va(),l=H(f),u=a(l),ee=o(u,2),ae=a(ee),te=o(l,2);{var le=i=>{var m=aa();n(i,m)},se=i=>{var m=ta(),k=a(m);h(()=>c(k,e(C))),n(i,m)},re=i=>{var m=oa(),k=H(m),L=a(k),M=a(L),J=a(M);{var W=p=>{var x=A();h(()=>c(x,`Before — ${e(d).left.template??""}`)),n(p,x)},$=p=>{var x=A("Before — no snapshot available");n(p,x)};w(J,p=>{e(d).left?p(W):p($,-1)})}var ie=o(M,2),ne=a(ie),oe=o(L,2),G=a(oe),E=a(G),b=o(G,2),K=a(b),S=o(k,2);{var Q=p=>{var x=ia(),P=o(a(x),4);X(P,21,()=>e(d).orphans,B=>B.name,(B,t)=>{var y=ra(),V=a(y),ye=a(V),Ie=a(ye),Je=o(ye,2),We=a(Je),we=o(V,2),ke=a(we),fe=a(ke),Fe=o(ke,2),de=a(Fe),Oe=o(Fe,2),ue=a(Oe),$e=o(Oe,2);{var Ge=q=>{var T=sa();X(T,20,()=>e(d).currentTemplateFields,N=>N,(N,me)=>{var z=la(),Ke=a(z),Me={};h(()=>{c(Ke,me),Me!==(Me=me)&&(z.value=(z.__value=me)??"")}),n(N,z)});var je;Ye(T),h(()=>{je!==(je=e(r)[e(t).name].rename)&&(T.value=(T.__value=e(r)[e(t).name].rename)??"",Ze(T,e(r)[e(t).name].rename))}),O("change",T,N=>v(r,{...e(r),[e(t).name]:{rename:N.currentTarget.value}},!0)),n(q,T)};w($e,q=>{typeof e(r)[e(t).name]=="object"&&e(r)[e(t).name]!==null&&"rename"in e(r)[e(t).name]&&q(Ge)})}h(q=>{c(Ie,e(t).name),c(We,q),Y(we,"aria-label",`Resolution for ${e(t).name}`),Y(fe,"name",`d-${e(t).name}`),_e(fe,e(r)[e(t).name]==="drop"),Y(de,"name",`d-${e(t).name}`),_e(de,e(r)[e(t).name]==="keep"),Y(ue,"name",`d-${e(t).name}`),_e(ue,typeof e(r)[e(t).name]=="object"&&e(r)[e(t).name]!==null&&"rename"in e(r)[e(t).name])},[()=>Pe(e(t).value)]),O("change",fe,()=>v(r,{...e(r),[e(t).name]:"drop"},!0)),O("change",de,()=>v(r,{...e(r),[e(t).name]:"keep"},!0)),O("change",ue,()=>v(r,{...e(r),[e(t).name]:{rename:e(d).currentTemplateFields[0]??""}},!0)),n(B,y)}),n(p,x)};w(S,p=>{e(d).orphans.length>0&&p(Q)})}var U=o(S,2);{var ve=p=>{var x=na(),P=a(x);h(()=>c(P,e(I))),n(p,x)};w(U,p=>{e(I)&&p(ve)})}var pe=o(U,2),R=a(pe),ce=a(R);h(()=>{var p;c(ne,((p=e(d).left)==null?void 0:p.html)??"(no snapshot covers this item)"),c(E,`After — ${e(d).right.template??""}`),c(K,e(d).right.html),R.disabled=e(D)||e(d).orphans.length===0,c(ce,e(D)?"Migrating…":"Migrate item")}),O("click",R,Se),n(i,m)};w(te,i=>{e(Z)?i(le):e(C)?i(se,1):e(d)&&i(re,2)})}h(()=>c(ae,e(j))),O("click",u,ge),n(s,f)},Ne=s=>{var f=ma(),l=H(f),u=o(a(l),2),ee=a(u),ae=o(l,2);{var te=i=>{var m=pa(),k=a(m);h(()=>c(k,g.error)),n(i,m)},le=i=>{var m=ca();n(i,m)},se=i=>{var m=fa();n(i,m)},re=i=>{var m=Ve(),k=H(m);X(k,17,()=>e(Be),L=>L.template,(L,M)=>{var J=ua(),W=a(J),$=a(W),ie=a($),ne=o($,2),oe=a(ne),G=o(W,2);X(G,21,()=>e(M).items,E=>E.path,(E,b)=>{var K=da(),S=a(K),Q=a(S),U=a(Q),ve=a(U),pe=o(Q,2),R=a(pe);{var ce=t=>{var y=A();h(V=>c(y,`${e(b).orphanFields.length??""} orphan field${e(b).orphanFields.length===1?"":"s"}:
|
|
4
|
+
${V??""}`),[()=>e(b).orphanFields.join(", ")]),n(t,y)};w(R,t=>{e(b).orphanFields.length>0&&t(ce)})}var p=o(R,2);{var x=t=>{var y=A();h(()=>c(y,`· ${e(b).missingRequiredFields.length??""} missing required`)),n(t,y)};w(p,t=>{e(b).missingRequiredFields.length>0&&t(x)})}var P=o(p,2);{var B=t=>{var y=A();h(()=>c(y,`· best-fit: ${e(b).bestFitSnapshot??""}`)),n(t,y)};w(P,t=>{e(b).bestFitSnapshot&&t(B)})}h(()=>c(ve,e(b).path)),O("click",S,()=>Ce(e(b).path)),n(E,K)}),h(()=>{c(ie,e(M).template),c(oe,`${e(M).items.length??""} item${e(M).items.length===1?"":"s"}`)}),n(L,J)}),n(i,m)};w(ae,i=>{g.error?i(te):g.loading&&g.list===null?i(le,1):g.count===0?i(se,2):i(re,-1)})}h(()=>{u.disabled=g.loading,c(ee,g.loading?"Refreshing…":"Refresh")}),O("click",u,()=>g.refresh()),n(s,f)};w(xe,s=>{e(j)!==null?s(qe):s(Ne,-1)})}var Ae=o(xe,2);{var De=s=>{};w(Ae,s=>{!e(j)&&g.list===null&&s(De)})}n(Le,be),Ue()}ze(["click","change"]);export{ga as default};
|