@litelens/core 1.7.0 → 1.7.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.
- package/README.md +32 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# @litelens/core
|
|
2
|
+
|
|
3
|
+
React hooks for litelens plugin frontends. This is the frontend counterpart to the Go `packages/core` module — see `packages/core/README.md` for the plugin-host contract as a whole.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Plugin frontends run inside the host app's own module instances (React, React DOM, TanStack Query, `@litelens/design-system`) rather than bundling their own. `@litelens/core` is the host-level API surface plugins use to reach into that shared runtime — cluster context, navigation, resource links, the unified tray, etc.
|
|
8
|
+
|
|
9
|
+
## How it resolves at runtime
|
|
10
|
+
|
|
11
|
+
This package is a **type/documentation surface only** — every export in `src/index.ts` throws if actually called. The real implementations live in the host app (`frontend/src/expose/`) and are substituted at runtime:
|
|
12
|
+
|
|
13
|
+
1. The host's import map (`frontend/index.html`) resolves the bare specifier `@litelens/core` to a generated vendor shim (`frontend/public/vendor/litelens/core.js`), not to this package's `dist/`.
|
|
14
|
+
2. That shim reads off `window.__LITELENS_VENDOR__.core`, which `frontend/src/expose/index.tsx` populates with the host's real hook implementations before any plugin bundle is dynamically imported.
|
|
15
|
+
3. Plugin code imports `@litelens/core` normally (`import { useClusterWideAPI } from "@litelens/core"`) and, at runtime, transparently gets the host's implementation — never the stub in this package.
|
|
16
|
+
|
|
17
|
+
So this package exists to give plugin authors real types, JSDoc, and editor autocomplete during development, while the host controls the actual behavior. If a hook's signature changes on the host side (`frontend/src/expose/hooks/`), update the matching declaration here to keep them in sync — there is no automated check that they match.
|
|
18
|
+
|
|
19
|
+
## Contents
|
|
20
|
+
|
|
21
|
+
- **`src/index.ts`** — hook declarations (currently `useClusterWideAPI`), each a stub that throws if called outside a plugin context.
|
|
22
|
+
- **`src/types/`** — shared TypeScript types re-exported alongside the hooks (`api`, `nav`, `resources`, `tray`).
|
|
23
|
+
|
|
24
|
+
## Versioning
|
|
25
|
+
|
|
26
|
+
Versioned alongside the host app, not as a stable long-term SDK — expect breaking changes as the plugin host API evolves.
|
|
27
|
+
|
|
28
|
+
## Build
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pnpm --filter @litelens/core build # tsup, outputs to dist/
|
|
32
|
+
```
|