@grimoire-rs/indexer 0.1.9 → 0.2.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/README.md +38 -0
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/config.d.ts +21 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -2
- package/dist/config.js.map +1 -1
- package/dist/enrich/index.d.ts.map +1 -1
- package/dist/enrich/index.js +62 -0
- package/dist/enrich/index.js.map +1 -1
- package/dist/renderer/astro/components/BrandMark.d.ts +14 -0
- package/dist/renderer/astro/components/BrandMark.d.ts.map +1 -0
- package/dist/renderer/astro/components/BrandMark.js +16 -0
- package/dist/renderer/astro/components/BrandMark.js.map +1 -0
- package/dist/renderer/astro/components/BrandMark.tsx +19 -0
- package/dist/renderer/astro/components/Catalog.d.ts.map +1 -1
- package/dist/renderer/astro/components/Catalog.js +310 -18
- package/dist/renderer/astro/components/Catalog.js.map +1 -1
- package/dist/renderer/astro/components/Catalog.tsx +445 -63
- package/dist/renderer/astro/components/CommandField.astro +43 -0
- package/dist/renderer/astro/components/PickerMenu.astro +68 -0
- package/dist/renderer/astro/components/VersionMenu.astro +6 -2
- package/dist/renderer/astro/content.config.ts +23 -5
- package/dist/renderer/astro/layouts/Base.astro +790 -76
- package/dist/renderer/astro/lib/catalog.d.ts +10 -0
- package/dist/renderer/astro/lib/catalog.d.ts.map +1 -1
- package/dist/renderer/astro/lib/catalog.js +28 -0
- package/dist/renderer/astro/lib/catalog.js.map +1 -1
- package/dist/renderer/astro/lib/catalog.ts +27 -0
- package/dist/renderer/astro/lib/code.d.ts +22 -0
- package/dist/renderer/astro/lib/code.d.ts.map +1 -0
- package/dist/renderer/astro/lib/code.js +21 -0
- package/dist/renderer/astro/lib/code.js.map +1 -0
- package/dist/renderer/astro/lib/code.ts +21 -0
- package/dist/renderer/astro/pages/index.astro +137 -43
- package/dist/renderer/astro/pages/p/[...slug].astro +403 -55
- package/dist/renderer/index.d.ts +23 -0
- package/dist/renderer/index.d.ts.map +1 -1
- package/dist/renderer/index.js +117 -30
- package/dist/renderer/index.js.map +1 -1
- package/package.json +5 -1
- package/dist/renderer/astro/components/CopyButton.astro +0 -24
package/dist/renderer/index.js
CHANGED
|
@@ -6,9 +6,10 @@
|
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
|
-
import { build } from "astro";
|
|
9
|
+
import { build, dev } from "astro";
|
|
10
10
|
import preact from "@astrojs/preact";
|
|
11
11
|
import { resolveConfig } from "../config.js";
|
|
12
|
+
import { SHIKI_THEMES } from "./astro/lib/code.js";
|
|
12
13
|
/** Thrown when `<outDir>/all.json` is missing or malformed. */
|
|
13
14
|
export class RenderInputError extends Error {
|
|
14
15
|
constructor(message) {
|
|
@@ -101,10 +102,30 @@ async function readCustomCss(root, customCss) {
|
|
|
101
102
|
* the staged root gets a `node_modules/` of symlinks to wherever *this*
|
|
102
103
|
* package's copies actually live.
|
|
103
104
|
*/
|
|
104
|
-
const RUNTIME_DEPS = ["astro", "@astrojs/preact", "preact"];
|
|
105
|
+
const RUNTIME_DEPS = ["astro", "@astrojs/preact", "preact", "lucide-preact", "@mdi/js"];
|
|
105
106
|
// Node refuses to create a directory symlink on Windows without elevation;
|
|
106
107
|
// a junction needs no privilege and behaves the same for resolution.
|
|
107
108
|
const LINK_TYPE = process.platform === "win32" ? "junction" : "dir";
|
|
109
|
+
/**
|
|
110
|
+
* Locate a dependency's installed directory, to symlink into the staged root.
|
|
111
|
+
*
|
|
112
|
+
* Resolving `<dep>/package.json` would be the obvious probe, and it is what
|
|
113
|
+
* this used to do — but a package with an `exports` map is entitled to keep
|
|
114
|
+
* its manifest private, and `lucide-preact` does. Resolving the package's
|
|
115
|
+
* own entry point always works, so walk up from there to the directory the
|
|
116
|
+
* specifier names.
|
|
117
|
+
*/
|
|
118
|
+
function packageRoot(dep) {
|
|
119
|
+
const suffix = path.sep + dep.split("/").join(path.sep);
|
|
120
|
+
let dir = path.dirname(fileURLToPath(import.meta.resolve(dep)));
|
|
121
|
+
while (!dir.endsWith(suffix)) {
|
|
122
|
+
const parent = path.dirname(dir);
|
|
123
|
+
if (parent === dir)
|
|
124
|
+
throw new Error(`cannot locate the installed root of ${dep}`);
|
|
125
|
+
dir = parent;
|
|
126
|
+
}
|
|
127
|
+
return dir;
|
|
128
|
+
}
|
|
108
129
|
/**
|
|
109
130
|
* Build the directory Astro treats as its project root, for one build.
|
|
110
131
|
*
|
|
@@ -128,15 +149,18 @@ const LINK_TYPE = process.platform === "win32" ? "junction" : "dir";
|
|
|
128
149
|
* `outDir`. That last layer is the point — Astro empties `outDir` before it
|
|
129
150
|
* builds, and `/all.json` is a frozen public URL that must survive.
|
|
130
151
|
*/
|
|
131
|
-
async function stage(root, outDir) {
|
|
152
|
+
async function stage(root, outDir, srcDir) {
|
|
132
153
|
const dir = await fs.mkdtemp(path.join(root, ".index-"));
|
|
133
|
-
|
|
134
|
-
|
|
154
|
+
// A caller-supplied `srcDir` is used in place of the staged copy: Vite
|
|
155
|
+
// watches `srcDir` directly, so dev edits in the working tree hot-reload.
|
|
156
|
+
// A copy would freeze the templates at server start.
|
|
157
|
+
const src = srcDir ?? path.join(dir, "src");
|
|
158
|
+
if (!srcDir)
|
|
159
|
+
await fs.cp(ASTRO_SRC_DIR, src, { recursive: true });
|
|
135
160
|
for (const dep of RUNTIME_DEPS) {
|
|
136
|
-
const real = path.dirname(fileURLToPath(import.meta.resolve(`${dep}/package.json`)));
|
|
137
161
|
const link = path.join(dir, "node_modules", dep);
|
|
138
162
|
await fs.mkdir(path.dirname(link), { recursive: true }); // `@scope/` needs its dir
|
|
139
|
-
await fs.symlink(
|
|
163
|
+
await fs.symlink(packageRoot(dep), link, LINK_TYPE);
|
|
140
164
|
}
|
|
141
165
|
// `content.config.ts` globs `./enrich` relative to the Astro root, so the
|
|
142
166
|
// index repo's tree has to appear there. Absent is fine: the glob loader
|
|
@@ -153,8 +177,14 @@ async function stage(root, outDir) {
|
|
|
153
177
|
}
|
|
154
178
|
return { dir, src };
|
|
155
179
|
}
|
|
156
|
-
/**
|
|
157
|
-
|
|
180
|
+
/**
|
|
181
|
+
* Read and validate every input Astro will be handed.
|
|
182
|
+
*
|
|
183
|
+
* Runs **before** `stage`, and must keep doing so: a bad `all.json` or an
|
|
184
|
+
* escaping `customCss` has to fail with its own error and leave no scratch
|
|
185
|
+
* directory behind.
|
|
186
|
+
*/
|
|
187
|
+
async function resolveInputs(opts) {
|
|
158
188
|
const config = resolveConfig(opts.config);
|
|
159
189
|
const packages = await readPackages(opts.outDir);
|
|
160
190
|
const css = await readCustomCss(opts.root, config.customCss);
|
|
@@ -163,8 +193,47 @@ export async function buildSite(opts) {
|
|
|
163
193
|
// `base` — which covers everything Astro emits itself — and the same value
|
|
164
194
|
// reaches the hand-written URLs through `astro/lib/base.ts`. Domain-rooted
|
|
165
195
|
// sites yield "/", Astro's own default, so nothing about them moves.
|
|
166
|
-
|
|
196
|
+
return { config, packages, css, base: new URL(config.site).pathname };
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Everything Astro is told, for one run. Build and dev share it verbatim —
|
|
200
|
+
* a preview rendered from a different config would be a preview of nothing.
|
|
201
|
+
*/
|
|
202
|
+
function inlineConfig(opts, staged, { config, packages, css, base }) {
|
|
203
|
+
return {
|
|
204
|
+
// The staged dir, never the index repo — see `stage`.
|
|
205
|
+
root: staged.dir,
|
|
206
|
+
// The index repo owns no Astro config; picking one up would let a
|
|
207
|
+
// stray file silently change the frozen routes.
|
|
208
|
+
configFile: false,
|
|
209
|
+
srcDir: staged.src,
|
|
210
|
+
publicDir: path.join(staged.dir, "public"),
|
|
211
|
+
outDir: opts.outDir,
|
|
212
|
+
site: config.site,
|
|
213
|
+
base,
|
|
214
|
+
integrations: [preact()],
|
|
215
|
+
// Shiki is what Astro already ships (and what VS Code renders with), so
|
|
216
|
+
// this configures it rather than adding a highlighter. Dual themes make
|
|
217
|
+
// it follow the page: Shiki emits both colours per token, one as an
|
|
218
|
+
// inline style and one as `--shiki-dark`, and Base.astro's stylesheet
|
|
219
|
+
// picks between them. A single theme was dark on a light page.
|
|
220
|
+
markdown: {
|
|
221
|
+
shikiConfig: { themes: SHIKI_THEMES, wrap: false },
|
|
222
|
+
},
|
|
223
|
+
vite: {
|
|
224
|
+
define: {
|
|
225
|
+
__GRIMOIRE_DATA__: JSON.stringify({ config, packages, css }),
|
|
226
|
+
__GRIMOIRE_BASE__: JSON.stringify(base),
|
|
227
|
+
},
|
|
228
|
+
plugins: [bundlePreactRenderer],
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/** Render the catalog site from `<outDir>/all.json` into `outDir`. */
|
|
233
|
+
export async function buildSite(opts) {
|
|
234
|
+
const inputs = await resolveInputs(opts);
|
|
167
235
|
const staged = await stage(opts.root, opts.outDir);
|
|
236
|
+
const astro = inlineConfig(opts, staged, inputs);
|
|
168
237
|
// Astro routes its server build through `<cwd>/.astro/` whenever `outDir`
|
|
169
238
|
// is not under `process.cwd()` (`getOutDirWithinCwd`). That fallback is
|
|
170
239
|
// wanted here: the built prerender entry is imported by plain Node, so it
|
|
@@ -173,30 +242,48 @@ export async function buildSite(opts) {
|
|
|
173
242
|
const cwd = process.cwd();
|
|
174
243
|
process.chdir(staged.dir);
|
|
175
244
|
try {
|
|
176
|
-
await build(
|
|
177
|
-
// The staged dir, never the index repo — see `stage`.
|
|
178
|
-
root: staged.dir,
|
|
179
|
-
// The index repo owns no Astro config; picking one up would let a
|
|
180
|
-
// stray file silently change the frozen routes.
|
|
181
|
-
configFile: false,
|
|
182
|
-
srcDir: staged.src,
|
|
183
|
-
publicDir: path.join(staged.dir, "public"),
|
|
184
|
-
outDir: opts.outDir,
|
|
185
|
-
site: config.site,
|
|
186
|
-
base,
|
|
187
|
-
integrations: [preact()],
|
|
188
|
-
vite: {
|
|
189
|
-
define: {
|
|
190
|
-
__GRIMOIRE_DATA__: JSON.stringify({ config, packages, css }),
|
|
191
|
-
__GRIMOIRE_BASE__: JSON.stringify(base),
|
|
192
|
-
},
|
|
193
|
-
plugins: [bundlePreactRenderer],
|
|
194
|
-
},
|
|
195
|
-
});
|
|
245
|
+
await build(astro);
|
|
196
246
|
}
|
|
197
247
|
finally {
|
|
198
248
|
process.chdir(cwd);
|
|
199
249
|
await fs.rm(staged.dir, { recursive: true, force: true });
|
|
200
250
|
}
|
|
201
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Serve the same site `buildSite` would emit, with HMR — the review loop for
|
|
254
|
+
* a rendering change, so the look can be judged without cutting a release.
|
|
255
|
+
*
|
|
256
|
+
* The staged dir and the chdir both outlive the call, because the server
|
|
257
|
+
* does: Vite resolves the staged `node_modules` on every request. `stop()`
|
|
258
|
+
* undoes both.
|
|
259
|
+
*/
|
|
260
|
+
export async function devSite(opts) {
|
|
261
|
+
const inputs = await resolveInputs(opts);
|
|
262
|
+
const staged = await stage(opts.root, opts.outDir, opts.srcDir);
|
|
263
|
+
const astro = inlineConfig(opts, staged, inputs);
|
|
264
|
+
const cwd = process.cwd();
|
|
265
|
+
process.chdir(staged.dir);
|
|
266
|
+
try {
|
|
267
|
+
const server = await dev({ ...astro, server: { port: opts.port } });
|
|
268
|
+
const { address, port } = server.address;
|
|
269
|
+
const host = address === "::" || address === "0.0.0.0" ? "localhost" : address;
|
|
270
|
+
// No trailing slash on a subpath base: Astro's dev router registers the
|
|
271
|
+
// base itself as the landing route, and `/index-repo/` 404s where
|
|
272
|
+
// `/index-repo` renders. (`base` is already "/" for a domain-rooted
|
|
273
|
+
// site, which is why it is interpolated rather than joined.)
|
|
274
|
+
return {
|
|
275
|
+
url: `http://${host}:${port}${astro.base}`,
|
|
276
|
+
async stop() {
|
|
277
|
+
await server.stop();
|
|
278
|
+
process.chdir(cwd);
|
|
279
|
+
await fs.rm(staged.dir, { recursive: true, force: true });
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
catch (err) {
|
|
284
|
+
process.chdir(cwd);
|
|
285
|
+
await fs.rm(staged.dir, { recursive: true, force: true });
|
|
286
|
+
throw err;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
202
289
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/renderer/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC;AAEtC,uEAAuE;AACvE,uEAAuE;AACvE,iEAAiE;AACjE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/renderer/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC;AAEtC,uEAAuE;AACvE,uEAAuE;AACvE,iEAAiE;AACjE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,aAAa,EAAmB,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA0BnD,+DAA+D;AAC/D,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,oBAAoB,GAA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QAC1D,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grimoire-rs/indexer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "CLI + Astro integration for running your own grim package index",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,6 +26,8 @@
|
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsc -p tsconfig.json && mkdir -p dist/renderer/astro dist/renderer/public && cp -r src/renderer/astro/. dist/renderer/astro/ && cp -r src/renderer/public/. dist/renderer/public/",
|
|
29
|
+
"dev": "npm run build && node scripts/dev.mjs",
|
|
30
|
+
"dev:smoke": "npm run build && node scripts/dev.mjs --smoke",
|
|
29
31
|
"test": "vitest run",
|
|
30
32
|
"lint": "eslint .",
|
|
31
33
|
"typecheck": "tsc --noEmit"
|
|
@@ -43,8 +45,10 @@
|
|
|
43
45
|
"dependencies": {
|
|
44
46
|
"@astrojs/preact": "^6.0.1",
|
|
45
47
|
"@clack/prompts": "^1.7.0",
|
|
48
|
+
"@mdi/js": "^7.4.47",
|
|
46
49
|
"astro": "^7.1.4",
|
|
47
50
|
"commander": "^15.0.0",
|
|
51
|
+
"lucide-preact": "^1.27.0",
|
|
48
52
|
"preact": "^10.29.7"
|
|
49
53
|
},
|
|
50
54
|
"repository": {
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
// Labelled copy button. The click handler is the shared `[data-copy]`
|
|
3
|
-
// listener in Base.astro — this component only renders the markup that
|
|
4
|
-
// listener expects (a `<span>` label it can swap to "copied").
|
|
5
|
-
interface Props {
|
|
6
|
-
value: string;
|
|
7
|
-
label: string;
|
|
8
|
-
}
|
|
9
|
-
const { value, label } = Astro.props;
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
<button type="button" class="copy" data-copy={value} aria-label={label}>
|
|
13
|
-
<svg viewBox="0 0 16 16" width="13" height="13" aria-hidden="true">
|
|
14
|
-
<path
|
|
15
|
-
fill="currentColor"
|
|
16
|
-
d="M0 6.75C0 5.784.784 5 1.75 5h1.5a.75.75 0 0 1 0 1.5h-1.5a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-1.5a.75.75 0 0 1 1.5 0v1.5A1.75 1.75 0 0 1 9.25 16h-7.5A1.75 1.75 0 0 1 0 14.25Z"
|
|
17
|
-
></path>
|
|
18
|
-
<path
|
|
19
|
-
fill="currentColor"
|
|
20
|
-
d="M5 1.75C5 .784 5.784 0 6.75 0h7.5C15.216 0 16 .784 16 1.75v7.5A1.75 1.75 0 0 1 14.25 11h-7.5A1.75 1.75 0 0 1 5 9.25Zm1.75-.25a.25.25 0 0 0-.25.25v7.5c0 .138.112.25.25.25h7.5a.25.25 0 0 0 .25-.25v-7.5a.25.25 0 0 0-.25-.25Z"
|
|
21
|
-
></path>
|
|
22
|
-
</svg>
|
|
23
|
-
<span>copy</span>
|
|
24
|
-
</button>
|