sourcey 3.3.9 → 3.3.10
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/cli.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { defineCommand, runMain } from "citty";
|
|
3
|
-
import { readFileSync } from "node:fs";
|
|
4
|
-
import { dirname, join } from "node:path";
|
|
5
|
-
import { fileURLToPath } from "node:url";
|
|
6
3
|
import { buildDocs, buildSiteDocs } from "./index.js";
|
|
7
4
|
import { loadConfig } from "./config.js";
|
|
8
5
|
import { init } from "./init.js";
|
|
9
|
-
|
|
10
|
-
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf8"));
|
|
6
|
+
import pkg from "../package.json" with { type: "json" };
|
|
11
7
|
const build = defineCommand({
|
|
12
8
|
meta: {
|
|
13
9
|
name: "build",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Head.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Head.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Head.d.ts","sourceRoot":"","sources":["../../../src/components/layout/Head.tsx"],"names":[],"mappings":"AAKA,wBAAgB,IAAI,iCA8EnB"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "preact/jsx-ru
|
|
|
2
2
|
import { useContext } from "preact/hooks";
|
|
3
3
|
import { SpecContext, OptionsContext, PageContext, SiteContext, NavigationContext } from "../../renderer/context.js";
|
|
4
4
|
import { langIconCSS } from "../../utils/lang-icons.js";
|
|
5
|
+
import pkg from "../../../package.json" with { type: "json" };
|
|
5
6
|
export function Head() {
|
|
6
7
|
const site = useContext(SiteContext);
|
|
7
8
|
const spec = useContext(SpecContext);
|
|
@@ -51,5 +52,5 @@ export function Head() {
|
|
|
51
52
|
body { margin: 0; background: rgb(var(--color-background-light)); }
|
|
52
53
|
.dark body { background: rgb(var(--color-background-dark)); }
|
|
53
54
|
`;
|
|
54
|
-
return (_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: pageTitle }), _jsx("meta", { name: "description", content: pageDescription }), _jsx("meta", { name: "sourcey-search", content: `${options.assetBase}search-index.json` }), _jsx("style", { dangerouslySetInnerHTML: { __html: themeCSS } }), _jsx("style", { dangerouslySetInnerHTML: { __html: langIconCSS() } }), site.customCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: site.customCSS } }), _jsx("script", { dangerouslySetInnerHTML: { __html: `(function(){var t=localStorage.getItem('sourcey-theme');if(t==='dark')document.documentElement.classList.add('dark')})()` } }), googleFontsUrl && (_jsxs(_Fragment, { children: [_jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "anonymous" }), _jsx("link", { rel: "stylesheet", href: googleFontsUrl })] })), _jsx("link", { rel: "stylesheet", href: `${options.assetBase}sourcey.css` }), site.favicon && _jsx("link", { rel: "icon", href: site.favicon })] }));
|
|
55
|
+
return (_jsxs("head", { children: [_jsx("meta", { charset: "utf-8" }), _jsx("meta", { name: "viewport", content: "width=device-width, initial-scale=1" }), _jsx("title", { children: pageTitle }), _jsx("meta", { name: "description", content: pageDescription }), _jsx("meta", { name: "generator", content: `Sourcey ${pkg.version}` }), _jsx("meta", { name: "sourcey-search", content: `${options.assetBase}search-index.json` }), _jsx("style", { dangerouslySetInnerHTML: { __html: themeCSS } }), _jsx("style", { dangerouslySetInnerHTML: { __html: langIconCSS() } }), site.customCSS && _jsx("style", { dangerouslySetInnerHTML: { __html: site.customCSS } }), _jsx("script", { dangerouslySetInnerHTML: { __html: `(function(){var t=localStorage.getItem('sourcey-theme');if(t==='dark')document.documentElement.classList.add('dark')})()` } }), googleFontsUrl && (_jsxs(_Fragment, { children: [_jsx("link", { rel: "preconnect", href: "https://fonts.googleapis.com" }), _jsx("link", { rel: "preconnect", href: "https://fonts.gstatic.com", crossOrigin: "anonymous" }), _jsx("link", { rel: "stylesheet", href: googleFontsUrl })] })), _jsx("link", { rel: "stylesheet", href: `${options.assetBase}sourcey.css` }), site.favicon && _jsx("link", { rel: "icon", href: site.favicon })] }));
|
|
55
56
|
}
|
|
@@ -108,18 +108,18 @@ function resolveIndexStyle(configured, groupMap, pages) {
|
|
|
108
108
|
/**
|
|
109
109
|
* Build index page HTML using sourcey's existing component markup.
|
|
110
110
|
*/
|
|
111
|
-
function buildIndexHtml(style,
|
|
111
|
+
function buildIndexHtml(style, _tabSlug, _tabLabel, groupMap, pages) {
|
|
112
112
|
if (style === "rich")
|
|
113
|
-
return buildRichIndex(
|
|
113
|
+
return buildRichIndex(groupMap, pages);
|
|
114
114
|
if (style === "structured")
|
|
115
|
-
return buildStructuredIndex(
|
|
116
|
-
return buildFlatIndex(
|
|
115
|
+
return buildStructuredIndex(groupMap, pages);
|
|
116
|
+
return buildFlatIndex(groupMap);
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* Rich: card grid with module name, description, and type count.
|
|
120
120
|
* Uses sourcey's card-group/card-item CSS.
|
|
121
121
|
*/
|
|
122
|
-
function buildRichIndex(
|
|
122
|
+
function buildRichIndex(groupMap, pages) {
|
|
123
123
|
const cards = [];
|
|
124
124
|
for (const [, items] of groupMap) {
|
|
125
125
|
const groupEntry = items.find((i) => i.kind === "group");
|
|
@@ -129,7 +129,7 @@ function buildRichIndex(tabSlug, groupMap, pages) {
|
|
|
129
129
|
if (!page)
|
|
130
130
|
continue;
|
|
131
131
|
const typeCount = items.filter((i) => i.kind !== "group" && i.kind !== "namespace").length;
|
|
132
|
-
const href = `${
|
|
132
|
+
const href = `${groupEntry.slug}.html`;
|
|
133
133
|
const desc = page.description || "";
|
|
134
134
|
const meta = typeCount > 0
|
|
135
135
|
? `<p style="margin:0.5rem 0 0;font-size:0.8rem;opacity:0.5">${typeCount} type${typeCount !== 1 ? "s" : ""}</p>`
|
|
@@ -149,7 +149,7 @@ function buildRichIndex(tabSlug, groupMap, pages) {
|
|
|
149
149
|
if (typeCount === 0)
|
|
150
150
|
continue;
|
|
151
151
|
const firstItem = items[0];
|
|
152
|
-
const href = `${
|
|
152
|
+
const href = `${firstItem.slug}.html`;
|
|
153
153
|
cards.push(`<a href="${href}" class="card-item">` +
|
|
154
154
|
`<div class="card-item-inner">` +
|
|
155
155
|
`<h3 class="card-item-title">${escHtml(key)}</h3>` +
|
|
@@ -165,7 +165,7 @@ function buildRichIndex(tabSlug, groupMap, pages) {
|
|
|
165
165
|
* Structured: grouped list of types by module/namespace.
|
|
166
166
|
* Rendered as markdown headings with link lists.
|
|
167
167
|
*/
|
|
168
|
-
function buildStructuredIndex(
|
|
168
|
+
function buildStructuredIndex(groupMap, pages) {
|
|
169
169
|
const sections = [];
|
|
170
170
|
for (const [key, items] of groupMap) {
|
|
171
171
|
const groupEntry = items.find((i) => i.kind === "group");
|
|
@@ -175,10 +175,10 @@ function buildStructuredIndex(tabSlug, groupMap, pages) {
|
|
|
175
175
|
continue;
|
|
176
176
|
const links = [];
|
|
177
177
|
if (groupEntry) {
|
|
178
|
-
links.push(`- [Overview](${
|
|
178
|
+
links.push(`- [Overview](${groupEntry.slug}.html)`);
|
|
179
179
|
}
|
|
180
180
|
for (const t of types) {
|
|
181
|
-
links.push(`- [${t.title}](${
|
|
181
|
+
links.push(`- [${t.title}](${t.slug}.html)`);
|
|
182
182
|
}
|
|
183
183
|
sections.push(`### ${title}\n\n${links.join("\n")}`);
|
|
184
184
|
}
|
|
@@ -187,7 +187,7 @@ function buildStructuredIndex(tabSlug, groupMap, pages) {
|
|
|
187
187
|
/**
|
|
188
188
|
* Flat: alphabetical list categorized by kind.
|
|
189
189
|
*/
|
|
190
|
-
function buildFlatIndex(
|
|
190
|
+
function buildFlatIndex(groupMap) {
|
|
191
191
|
const byKind = new Map();
|
|
192
192
|
for (const [, items] of groupMap) {
|
|
193
193
|
for (const item of items) {
|
|
@@ -202,7 +202,7 @@ function buildFlatIndex(tabSlug, groupMap) {
|
|
|
202
202
|
const sections = [];
|
|
203
203
|
for (const [label, items] of byKind) {
|
|
204
204
|
const sorted = items.sort((a, b) => a.title.localeCompare(b.title));
|
|
205
|
-
const links = sorted.map((i) => `- [${i.title}](${
|
|
205
|
+
const links = sorted.map((i) => `- [${i.title}](${i.slug}.html)`).join("\n");
|
|
206
206
|
sections.push(`### ${label}\n\n${links}`);
|
|
207
207
|
}
|
|
208
208
|
return renderMarkdown(sections.join("\n\n"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sourcey",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.10",
|
|
4
4
|
"description": "Open source documentation platform. API references, guides, static output.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -63,16 +63,20 @@
|
|
|
63
63
|
"api",
|
|
64
64
|
"documentation",
|
|
65
65
|
"static-site-generator",
|
|
66
|
-
"docs"
|
|
66
|
+
"docs",
|
|
67
|
+
"markdown",
|
|
68
|
+
"api-docs",
|
|
69
|
+
"developer-documentation",
|
|
70
|
+
"doxygen"
|
|
67
71
|
],
|
|
68
|
-
"author": "Kam Low <
|
|
72
|
+
"author": "Kam Low <oss@0state.com> (https://sourcey.com)",
|
|
69
73
|
"license": "AGPL-3.0-only",
|
|
70
74
|
"repository": {
|
|
71
75
|
"type": "git",
|
|
72
|
-
"url": "git+https://github.com/
|
|
76
|
+
"url": "git+https://github.com/sourcey/sourcey.git"
|
|
73
77
|
},
|
|
74
78
|
"bugs": {
|
|
75
|
-
"url": "https://github.com/
|
|
79
|
+
"url": "https://github.com/sourcey/sourcey/issues"
|
|
76
80
|
},
|
|
77
|
-
"homepage": "https://
|
|
81
|
+
"homepage": "https://sourcey.com"
|
|
78
82
|
}
|