@karaoke-cms/module-search 0.6.3 → 0.9.1

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.
Files changed (2) hide show
  1. package/README.md +40 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,40 @@
1
+ # @karaoke-cms/module-search
2
+
3
+ Pagefind search module for karaoke-cms. Adds full-text client-side search to any karaoke-cms site.
4
+
5
+ ## Where it belongs
6
+
7
+ `packages/module-search/` in the monorepo. Enabled via `karaoke.config.ts`:
8
+
9
+ ```ts
10
+ export default {
11
+ vault: KARAOKE_VAULT,
12
+ theme: '@karaoke-cms/theme-default',
13
+ modules: {
14
+ search: { enabled: true },
15
+ },
16
+ };
17
+ ```
18
+
19
+ When enabled, `resolvedModules.search.enabled` is `true` in the virtual module and `Base.astro` renders a `Search.astro` component in the configured region.
20
+
21
+ ## What it does
22
+
23
+ Integrates [Pagefind](https://pagefind.app/) — a static search library that indexes built HTML at the end of `astro build` and serves a zero-dependency search UI from the CDN.
24
+
25
+ - Build step: runs `pagefind --source dist` after the Astro build, writing the search index to `dist/pagefind/`
26
+ - Runtime: `Search.astro` loads `pagefind-ui.js` from `/pagefind/` and renders a search input. In dev mode (before a build has run), it probes with a HEAD request and silently no-ops if the index does not exist yet.
27
+
28
+ No server required — the index is static files served alongside the site.
29
+
30
+ ## Status
31
+
32
+ **Stub** — the package structure exists but `src/` is empty. The current implementation lives directly inside `@karaoke-cms/astro` (`src/modules/search/Search.astro`). This package will be split out as a standalone module in a future release.
33
+
34
+ To enable search today: set `modules: { search: { enabled: true } }` in `karaoke.config.ts`. No separate package install needed.
35
+
36
+ ## How it changes the behavior of the system
37
+
38
+ - When enabled, a search input appears in whichever region includes `'search'` in its `components` list (typically the left sidebar in `theme-default`).
39
+ - Adds a `pagefind/` directory to the build output — increases deploy size by ~50–200 KB depending on content volume.
40
+ - Does not affect the dev server — the search UI silently disables itself until a production build has been run.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@karaoke-cms/module-search",
3
3
  "type": "module",
4
- "version": "0.6.3",
4
+ "version": "0.9.1",
5
5
  "description": "Pagefind search module for karaoke-cms",
6
6
  "keywords": [
7
7
  "astro",