@runcontext/site 0.4.3 → 0.4.4
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/astro/astro.config.mjs +13 -0
- package/astro/node_modules/.astro/data-store.json +1 -0
- package/astro/node_modules/.vite/deps/_metadata.json +31 -0
- package/astro/node_modules/.vite/deps/astro___aria-query.js +6776 -0
- package/astro/node_modules/.vite/deps/astro___aria-query.js.map +7 -0
- package/astro/node_modules/.vite/deps/astro___axobject-query.js +3754 -0
- package/astro/node_modules/.vite/deps/astro___axobject-query.js.map +7 -0
- package/astro/node_modules/.vite/deps/astro___cssesc.js +99 -0
- package/astro/node_modules/.vite/deps/astro___cssesc.js.map +7 -0
- package/astro/node_modules/.vite/deps/chunk-BUSYA2B4.js +8 -0
- package/astro/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +7 -0
- package/astro/node_modules/.vite/deps/package.json +3 -0
- package/astro/src/components/Sidebar.astro +71 -0
- package/astro/src/components/TierBadge.astro +9 -0
- package/astro/src/components/Topbar.astro +42 -0
- package/astro/src/data/manifest.json +10839 -0
- package/astro/src/data/site-config.json +1 -0
- package/astro/src/layouts/Base.astro +461 -0
- package/astro/src/pages/glossary.astro +37 -0
- package/astro/src/pages/index.astro +98 -0
- package/astro/src/pages/models/[name]/rules.astro +87 -0
- package/astro/src/pages/models/[name]/schema.astro +82 -0
- package/astro/src/pages/models/[name].astro +181 -0
- package/astro/src/pages/owners/[id].astro +65 -0
- package/astro/src/pages/search.astro +108 -0
- package/astro/tsconfig.json +3 -0
- package/dist/build-index-MSTAYUC3.cjs +7 -0
- package/dist/build-index-MSTAYUC3.cjs.map +1 -0
- package/dist/build-index-UCDMZJZP.mjs +7 -0
- package/dist/build-index-UCDMZJZP.mjs.map +1 -0
- package/dist/chunk-BBC5HGNQ.cjs +65 -0
- package/dist/chunk-BBC5HGNQ.cjs.map +1 -0
- package/dist/chunk-WM73L4RO.mjs +65 -0
- package/dist/chunk-WM73L4RO.mjs.map +1 -0
- package/dist/index.cjs +83 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -8
- package/dist/index.d.ts +20 -8
- package/dist/index.mjs +80 -65
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// src/search/build-index.ts
|
|
2
|
+
import MiniSearch from "minisearch";
|
|
3
|
+
var MINISEARCH_OPTIONS = {
|
|
4
|
+
fields: ["title", "description", "type"],
|
|
5
|
+
storeFields: ["title", "description", "type", "url"],
|
|
6
|
+
idField: "id"
|
|
7
|
+
};
|
|
8
|
+
function buildSearchIndex(manifest, basePath) {
|
|
9
|
+
const docs = [];
|
|
10
|
+
let idCounter = 0;
|
|
11
|
+
for (const [name, model] of Object.entries(manifest.models)) {
|
|
12
|
+
docs.push({
|
|
13
|
+
id: String(idCounter++),
|
|
14
|
+
type: "model",
|
|
15
|
+
title: name,
|
|
16
|
+
description: model.description ?? "",
|
|
17
|
+
url: `${basePath}/models/${name}.html`
|
|
18
|
+
});
|
|
19
|
+
if (model.datasets) {
|
|
20
|
+
for (const ds of model.datasets) {
|
|
21
|
+
docs.push({
|
|
22
|
+
id: String(idCounter++),
|
|
23
|
+
type: "dataset",
|
|
24
|
+
title: `${name} / ${ds.name}`,
|
|
25
|
+
description: ds.description ?? "",
|
|
26
|
+
url: `${basePath}/models/${name}/schema.html`
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
for (const [termId, term] of Object.entries(manifest.terms)) {
|
|
32
|
+
docs.push({
|
|
33
|
+
id: String(idCounter++),
|
|
34
|
+
type: "term",
|
|
35
|
+
title: termId,
|
|
36
|
+
description: term.definition,
|
|
37
|
+
url: `${basePath}/glossary.html#term-${termId}`
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
for (const [oid, owner] of Object.entries(manifest.owners)) {
|
|
41
|
+
docs.push({
|
|
42
|
+
id: String(idCounter++),
|
|
43
|
+
type: "owner",
|
|
44
|
+
title: owner.display_name,
|
|
45
|
+
description: owner.description ?? "",
|
|
46
|
+
url: `${basePath}/owners/${oid}.html`
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
const miniSearch = new MiniSearch(MINISEARCH_OPTIONS);
|
|
50
|
+
miniSearch.addAll(docs);
|
|
51
|
+
const documentsMap = {};
|
|
52
|
+
for (const doc of docs) {
|
|
53
|
+
documentsMap[doc.id] = doc;
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
index: JSON.parse(JSON.stringify(miniSearch)),
|
|
57
|
+
options: MINISEARCH_OPTIONS,
|
|
58
|
+
documents: documentsMap
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
buildSearchIndex
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=chunk-WM73L4RO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/search/build-index.ts"],"sourcesContent":["/**\n * Builds a MiniSearch index from a Manifest for client-side search.\n *\n * The index is serialized to JSON so it can be embedded in the search page\n * and loaded by MiniSearch on the client side.\n */\n\nimport MiniSearch from 'minisearch';\nimport type { Manifest } from '@runcontext/core';\n\nexport interface SearchDocument {\n id: string;\n type: string;\n title: string;\n description: string;\n url: string;\n}\n\nexport interface SearchIndex {\n /** Serialized MiniSearch index (JSON-parsed object). */\n index: unknown;\n /** MiniSearch constructor options needed to reload the index. */\n options: {\n fields: string[];\n storeFields: string[];\n idField: string;\n };\n /** Map of document ID to document metadata for rendering results. */\n documents: Record<string, SearchDocument>;\n}\n\nconst MINISEARCH_OPTIONS = {\n fields: ['title', 'description', 'type'],\n storeFields: ['title', 'description', 'type', 'url'],\n idField: 'id',\n};\n\n/**\n * Build a search index from a manifest.\n *\n * @param manifest - The compiled ContextKit manifest\n * @param basePath - The base URL path for links (e.g. '' or '/docs')\n * @returns A SearchIndex object ready for JSON serialization\n */\nexport function buildSearchIndex(manifest: Manifest, basePath: string): SearchIndex {\n const docs: SearchDocument[] = [];\n let idCounter = 0;\n\n // Index models\n for (const [name, model] of Object.entries(manifest.models)) {\n docs.push({\n id: String(idCounter++),\n type: 'model',\n title: name,\n description: model.description ?? '',\n url: `${basePath}/models/${name}.html`,\n });\n\n // Index datasets within each model\n if (model.datasets) {\n for (const ds of model.datasets) {\n docs.push({\n id: String(idCounter++),\n type: 'dataset',\n title: `${name} / ${ds.name}`,\n description: ds.description ?? '',\n url: `${basePath}/models/${name}/schema.html`,\n });\n }\n }\n }\n\n // Index glossary terms\n for (const [termId, term] of Object.entries(manifest.terms)) {\n docs.push({\n id: String(idCounter++),\n type: 'term',\n title: termId,\n description: term.definition,\n url: `${basePath}/glossary.html#term-${termId}`,\n });\n }\n\n // Index owners\n for (const [oid, owner] of Object.entries(manifest.owners)) {\n docs.push({\n id: String(idCounter++),\n type: 'owner',\n title: owner.display_name,\n description: owner.description ?? '',\n url: `${basePath}/owners/${oid}.html`,\n });\n }\n\n // Build MiniSearch index\n const miniSearch = new MiniSearch(MINISEARCH_OPTIONS);\n miniSearch.addAll(docs);\n\n // Create document lookup map by id\n const documentsMap: Record<string, SearchDocument> = {};\n for (const doc of docs) {\n documentsMap[doc.id] = doc;\n }\n\n return {\n index: JSON.parse(JSON.stringify(miniSearch)),\n options: MINISEARCH_OPTIONS,\n documents: documentsMap,\n };\n}\n"],"mappings":";AAOA,OAAO,gBAAgB;AAwBvB,IAAM,qBAAqB;AAAA,EACzB,QAAQ,CAAC,SAAS,eAAe,MAAM;AAAA,EACvC,aAAa,CAAC,SAAS,eAAe,QAAQ,KAAK;AAAA,EACnD,SAAS;AACX;AASO,SAAS,iBAAiB,UAAoB,UAA+B;AAClF,QAAM,OAAyB,CAAC;AAChC,MAAI,YAAY;AAGhB,aAAW,CAAC,MAAM,KAAK,KAAK,OAAO,QAAQ,SAAS,MAAM,GAAG;AAC3D,SAAK,KAAK;AAAA,MACR,IAAI,OAAO,WAAW;AAAA,MACtB,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa,MAAM,eAAe;AAAA,MAClC,KAAK,GAAG,QAAQ,WAAW,IAAI;AAAA,IACjC,CAAC;AAGD,QAAI,MAAM,UAAU;AAClB,iBAAW,MAAM,MAAM,UAAU;AAC/B,aAAK,KAAK;AAAA,UACR,IAAI,OAAO,WAAW;AAAA,UACtB,MAAM;AAAA,UACN,OAAO,GAAG,IAAI,MAAM,GAAG,IAAI;AAAA,UAC3B,aAAa,GAAG,eAAe;AAAA,UAC/B,KAAK,GAAG,QAAQ,WAAW,IAAI;AAAA,QACjC,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EACF;AAGA,aAAW,CAAC,QAAQ,IAAI,KAAK,OAAO,QAAQ,SAAS,KAAK,GAAG;AAC3D,SAAK,KAAK;AAAA,MACR,IAAI,OAAO,WAAW;AAAA,MACtB,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa,KAAK;AAAA,MAClB,KAAK,GAAG,QAAQ,uBAAuB,MAAM;AAAA,IAC/C,CAAC;AAAA,EACH;AAGA,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,SAAS,MAAM,GAAG;AAC1D,SAAK,KAAK;AAAA,MACR,IAAI,OAAO,WAAW;AAAA,MACtB,MAAM;AAAA,MACN,OAAO,MAAM;AAAA,MACb,aAAa,MAAM,eAAe;AAAA,MAClC,KAAK,GAAG,QAAQ,WAAW,GAAG;AAAA,IAChC,CAAC;AAAA,EACH;AAGA,QAAM,aAAa,IAAI,WAAW,kBAAkB;AACpD,aAAW,OAAO,IAAI;AAGtB,QAAM,eAA+C,CAAC;AACtD,aAAW,OAAO,MAAM;AACtB,iBAAa,IAAI,EAAE,IAAI;AAAA,EACzB;AAEA,SAAO;AAAA,IACL,OAAO,KAAK,MAAM,KAAK,UAAU,UAAU,CAAC;AAAA,IAC5C,SAAS;AAAA,IACT,WAAW;AAAA,EACb;AACF;","names":[]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkBBC5HGNQcjs = require('./chunk-BBC5HGNQ.cjs');
|
|
4
|
+
|
|
5
|
+
// src/generator.ts
|
|
2
6
|
var _ejs = require('ejs'); var _ejs2 = _interopRequireDefault(_ejs);
|
|
3
7
|
var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
|
|
4
8
|
var _path = require('path'); var path = _interopRequireWildcard(_path);
|
|
9
|
+
var _url = require('url');
|
|
5
10
|
|
|
6
11
|
// src/templates/shared.ts
|
|
7
12
|
var HEAD = `<!DOCTYPE html>
|
|
@@ -709,6 +714,8 @@ var HEAD = `<!DOCTYPE html>
|
|
|
709
714
|
@keyframes toast-in { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
710
715
|
.studio-add-btn { background: none; border: 1px dashed #c9a55a60; color: #c9a55a; border-radius: 8px; padding: 12px; width: 100%; cursor: pointer; font-size: 14px; transition: all 0.2s; }
|
|
711
716
|
.studio-add-btn:hover { border-color: #c9a55a; background: #c9a55a10; }
|
|
717
|
+
.rename-btn { background: none; border: 1px solid var(--accent-border, #c9a55a40); color: var(--accent, #c9a55a); border-radius: 5px; padding: 0.2rem 0.6rem; font-size: 0.72rem; cursor: pointer; opacity: 0.7; transition: opacity 0.2s, background 0.2s; font-family: var(--sans, sans-serif); }
|
|
718
|
+
.rename-btn:hover { opacity: 1; background: var(--accent-dim, #c9a55a12); }
|
|
712
719
|
</style>
|
|
713
720
|
<% } %>
|
|
714
721
|
</head>`;
|
|
@@ -725,7 +732,7 @@ var TOPBAR = `<div class="topbar">
|
|
|
725
732
|
</div>
|
|
726
733
|
<div class="topbar-right">
|
|
727
734
|
<a href="<%= basePath %>/search.html" class="topbar-link">Search</a>
|
|
728
|
-
<a href="https://
|
|
735
|
+
<a href="https://github.com/erickittelson/ContextKit#readme" class="topbar-docs" target="_blank" rel="noopener">Docs ↗</a>
|
|
729
736
|
</div>
|
|
730
737
|
</div>`;
|
|
731
738
|
var SIDEBAR = `<div class="overlay" id="sidebar-overlay" onclick="toggleSidebar()"></div>
|
|
@@ -759,7 +766,7 @@ var SIDEBAR = `<div class="overlay" id="sidebar-overlay" onclick="toggleSidebar(
|
|
|
759
766
|
var FOOTER = `<footer class="site-footer">
|
|
760
767
|
Generated by <a href="https://github.com/erickittelson/ContextKit">ContextKit</a>
|
|
761
768
|
·
|
|
762
|
-
<a href="https://
|
|
769
|
+
<a href="https://github.com/erickittelson/ContextKit#readme" target="_blank" rel="noopener">Documentation</a>
|
|
763
770
|
</footer>`;
|
|
764
771
|
var TIER_BADGE = `<% function tierBadge(tier) {
|
|
765
772
|
var cls = { none: '', bronze: 'tag-bronze', silver: 'tag-silver', gold: 'tag-gold' };
|
|
@@ -883,7 +890,11 @@ async function previewAndSave() {
|
|
|
883
890
|
body: JSON.stringify({ file: fileEdits[0].file, path: fileEdits[0].path, value: fileEdits[0].value }),
|
|
884
891
|
});
|
|
885
892
|
const data = await res.json();
|
|
886
|
-
|
|
893
|
+
if (data.error) {
|
|
894
|
+
previews.push({ file, edits: fileEdits, error: data.error });
|
|
895
|
+
} else {
|
|
896
|
+
previews.push({ file, edits: fileEdits, ...data });
|
|
897
|
+
}
|
|
887
898
|
} catch (err) {
|
|
888
899
|
previews.push({ file, edits: fileEdits, error: err.message });
|
|
889
900
|
}
|
|
@@ -1024,6 +1035,27 @@ function makeDropdown(el) {
|
|
|
1024
1035
|
});
|
|
1025
1036
|
}
|
|
1026
1037
|
|
|
1038
|
+
async function renameModel(currentName) {
|
|
1039
|
+
var newName = prompt('Rename model "' + currentName + '" to:', currentName);
|
|
1040
|
+
if (!newName || newName.trim() === currentName) return;
|
|
1041
|
+
try {
|
|
1042
|
+
var res = await fetch('/api/rename-model', {
|
|
1043
|
+
method: 'POST',
|
|
1044
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1045
|
+
body: JSON.stringify({ oldName: currentName, newName: newName.trim() }),
|
|
1046
|
+
});
|
|
1047
|
+
var data = await res.json();
|
|
1048
|
+
if (data.ok) {
|
|
1049
|
+
showToast('Renamed to "' + data.newName + '" \u2014 ' + data.renamed.length + ' file(s) updated');
|
|
1050
|
+
setTimeout(function() { window.location.href = '/models/' + data.newName + '.html'; }, 800);
|
|
1051
|
+
} else {
|
|
1052
|
+
showToast('Rename failed');
|
|
1053
|
+
}
|
|
1054
|
+
} catch (err) {
|
|
1055
|
+
showToast('Rename failed: ' + err.message);
|
|
1056
|
+
}
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1027
1059
|
document.addEventListener('DOMContentLoaded', function() {
|
|
1028
1060
|
document.querySelectorAll('.editable').forEach(makeEditable);
|
|
1029
1061
|
document.querySelectorAll('.dropdown-editable').forEach(makeDropdown);
|
|
@@ -1165,8 +1197,11 @@ ${TIER_BADGE}
|
|
|
1165
1197
|
|
|
1166
1198
|
<div class="page-header">
|
|
1167
1199
|
<div style="display:flex;align-items:center;gap:0.6rem;">
|
|
1168
|
-
<h1><%= model.name %></h1>
|
|
1200
|
+
<h1 id="model-name"><%= model.name %></h1>
|
|
1169
1201
|
<% if (tier) { %><%- tierBadge(tier.tier) %><% } %>
|
|
1202
|
+
<% if (typeof studioMode !== 'undefined' && studioMode) { %>
|
|
1203
|
+
<button class="rename-btn" onclick="renameModel('<%= model.name %>')" title="Rename this model">✎ Rename</button>
|
|
1204
|
+
<% } %>
|
|
1170
1205
|
</div>
|
|
1171
1206
|
<% if (typeof studioMode !== 'undefined' && studioMode) { %>
|
|
1172
1207
|
<p class="subtitle"><span class="editable" data-file="context/models/<%= model.name %>.osi.yaml" data-path="semantic_model.0.description" data-label="Model description"><%= model.description || 'Add description...' %></span></p>
|
|
@@ -2275,67 +2310,6 @@ ${SCRIPTS}
|
|
|
2275
2310
|
</body>
|
|
2276
2311
|
</html>`;
|
|
2277
2312
|
|
|
2278
|
-
// src/search/build-index.ts
|
|
2279
|
-
var _minisearch = require('minisearch'); var _minisearch2 = _interopRequireDefault(_minisearch);
|
|
2280
|
-
var MINISEARCH_OPTIONS = {
|
|
2281
|
-
fields: ["title", "description", "type"],
|
|
2282
|
-
storeFields: ["title", "description", "type", "url"],
|
|
2283
|
-
idField: "id"
|
|
2284
|
-
};
|
|
2285
|
-
function buildSearchIndex(manifest, basePath) {
|
|
2286
|
-
const docs = [];
|
|
2287
|
-
let idCounter = 0;
|
|
2288
|
-
for (const [name, model] of Object.entries(manifest.models)) {
|
|
2289
|
-
docs.push({
|
|
2290
|
-
id: String(idCounter++),
|
|
2291
|
-
type: "model",
|
|
2292
|
-
title: name,
|
|
2293
|
-
description: _nullishCoalesce(model.description, () => ( "")),
|
|
2294
|
-
url: `${basePath}/models/${name}.html`
|
|
2295
|
-
});
|
|
2296
|
-
if (model.datasets) {
|
|
2297
|
-
for (const ds of model.datasets) {
|
|
2298
|
-
docs.push({
|
|
2299
|
-
id: String(idCounter++),
|
|
2300
|
-
type: "dataset",
|
|
2301
|
-
title: `${name} / ${ds.name}`,
|
|
2302
|
-
description: _nullishCoalesce(ds.description, () => ( "")),
|
|
2303
|
-
url: `${basePath}/models/${name}/schema.html`
|
|
2304
|
-
});
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
for (const [termId, term] of Object.entries(manifest.terms)) {
|
|
2309
|
-
docs.push({
|
|
2310
|
-
id: String(idCounter++),
|
|
2311
|
-
type: "term",
|
|
2312
|
-
title: termId,
|
|
2313
|
-
description: term.definition,
|
|
2314
|
-
url: `${basePath}/glossary.html#term-${termId}`
|
|
2315
|
-
});
|
|
2316
|
-
}
|
|
2317
|
-
for (const [oid, owner] of Object.entries(manifest.owners)) {
|
|
2318
|
-
docs.push({
|
|
2319
|
-
id: String(idCounter++),
|
|
2320
|
-
type: "owner",
|
|
2321
|
-
title: owner.display_name,
|
|
2322
|
-
description: _nullishCoalesce(owner.description, () => ( "")),
|
|
2323
|
-
url: `${basePath}/owners/${oid}.html`
|
|
2324
|
-
});
|
|
2325
|
-
}
|
|
2326
|
-
const miniSearch = new (0, _minisearch2.default)(MINISEARCH_OPTIONS);
|
|
2327
|
-
miniSearch.addAll(docs);
|
|
2328
|
-
const documentsMap = {};
|
|
2329
|
-
for (const doc of docs) {
|
|
2330
|
-
documentsMap[doc.id] = doc;
|
|
2331
|
-
}
|
|
2332
|
-
return {
|
|
2333
|
-
index: JSON.parse(JSON.stringify(miniSearch)),
|
|
2334
|
-
options: MINISEARCH_OPTIONS,
|
|
2335
|
-
documents: documentsMap
|
|
2336
|
-
};
|
|
2337
|
-
}
|
|
2338
|
-
|
|
2339
2313
|
// src/generator.ts
|
|
2340
2314
|
function generateSite(manifest, config, options) {
|
|
2341
2315
|
const files = /* @__PURE__ */ new Map();
|
|
@@ -2425,7 +2399,7 @@ function generateSite(manifest, config, options) {
|
|
|
2425
2399
|
})
|
|
2426
2400
|
);
|
|
2427
2401
|
}
|
|
2428
|
-
const searchIndex = buildSearchIndex(manifest, basePath);
|
|
2402
|
+
const searchIndex = _chunkBBC5HGNQcjs.buildSearchIndex.call(void 0, manifest, basePath);
|
|
2429
2403
|
files.set(
|
|
2430
2404
|
"search.html",
|
|
2431
2405
|
_ejs2.default.render(searchTemplate, {
|
|
@@ -2449,6 +2423,47 @@ async function buildSite(manifest, config, outputDir) {
|
|
|
2449
2423
|
fs.writeFileSync(fullPath, content, "utf-8");
|
|
2450
2424
|
}
|
|
2451
2425
|
}
|
|
2426
|
+
function getAstroProjectDir() {
|
|
2427
|
+
const thisFile = _url.fileURLToPath.call(void 0, import.meta.url);
|
|
2428
|
+
const thisDir = path.dirname(thisFile);
|
|
2429
|
+
const astroDir = path.resolve(thisDir, "..", "astro");
|
|
2430
|
+
if (fs.existsSync(astroDir)) return astroDir;
|
|
2431
|
+
const pkgRoot = path.resolve(thisDir, "..", "..");
|
|
2432
|
+
return path.join(pkgRoot, "astro");
|
|
2433
|
+
}
|
|
2434
|
+
async function buildAstroSite(manifest, config, outputDir) {
|
|
2435
|
+
const astroDir = getAstroProjectDir();
|
|
2436
|
+
const dataDir = path.join(astroDir, "src", "data");
|
|
2437
|
+
fs.mkdirSync(dataDir, { recursive: true });
|
|
2438
|
+
fs.writeFileSync(
|
|
2439
|
+
path.join(dataDir, "manifest.json"),
|
|
2440
|
+
JSON.stringify(manifest, null, 2),
|
|
2441
|
+
"utf-8"
|
|
2442
|
+
);
|
|
2443
|
+
fs.writeFileSync(
|
|
2444
|
+
path.join(dataDir, "site-config.json"),
|
|
2445
|
+
JSON.stringify({
|
|
2446
|
+
title: _nullishCoalesce(_optionalChain([config, 'access', _5 => _5.site, 'optionalAccess', _6 => _6.title]), () => ( "ContextKit")),
|
|
2447
|
+
studioMode: false
|
|
2448
|
+
}),
|
|
2449
|
+
"utf-8"
|
|
2450
|
+
);
|
|
2451
|
+
const { buildSearchIndex: buildSearchIndex2 } = await Promise.resolve().then(() => _interopRequireWildcard(require("./build-index-MSTAYUC3.cjs")));
|
|
2452
|
+
const searchIndex = buildSearchIndex2(manifest, "");
|
|
2453
|
+
fs.writeFileSync(
|
|
2454
|
+
path.join(astroDir, "public", "search-index.json"),
|
|
2455
|
+
JSON.stringify(searchIndex, null, 2),
|
|
2456
|
+
"utf-8"
|
|
2457
|
+
);
|
|
2458
|
+
const { execFileSync } = await Promise.resolve().then(() => _interopRequireWildcard(require("child_process")));
|
|
2459
|
+
const npx = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
2460
|
+
execFileSync(npx, ["astro", "build", "--outDir", path.resolve(outputDir)], {
|
|
2461
|
+
cwd: astroDir,
|
|
2462
|
+
stdio: "inherit"
|
|
2463
|
+
});
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
|
|
2452
2467
|
|
|
2453
2468
|
|
|
2454
2469
|
|
|
@@ -2460,5 +2475,5 @@ async function buildSite(manifest, config, outputDir) {
|
|
|
2460
2475
|
|
|
2461
2476
|
|
|
2462
2477
|
|
|
2463
|
-
exports.buildSearchIndex = buildSearchIndex; exports.buildSite = buildSite; exports.generateSite = generateSite; exports.glossaryTemplate = glossaryTemplate; exports.indexTemplate = indexTemplate; exports.modelTemplate = modelTemplate; exports.ownerTemplate = ownerTemplate; exports.rulesTemplate = rulesTemplate; exports.schemaTemplate = schemaTemplate; exports.searchTemplate = searchTemplate;
|
|
2478
|
+
exports.buildAstroSite = buildAstroSite; exports.buildSearchIndex = _chunkBBC5HGNQcjs.buildSearchIndex; exports.buildSite = buildSite; exports.generateSite = generateSite; exports.getAstroProjectDir = getAstroProjectDir; exports.glossaryTemplate = glossaryTemplate; exports.indexTemplate = indexTemplate; exports.modelTemplate = modelTemplate; exports.ownerTemplate = ownerTemplate; exports.rulesTemplate = rulesTemplate; exports.schemaTemplate = schemaTemplate; exports.searchTemplate = searchTemplate;
|
|
2464
2479
|
//# sourceMappingURL=index.cjs.map
|