@checkstack/script-packages-frontend 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/src/index.tsx ADDED
@@ -0,0 +1,45 @@
1
+ import {
2
+ createFrontendPlugin,
3
+ createSlotExtension,
4
+ UserMenuItemsSlot,
5
+ } from "@checkstack/frontend-api";
6
+ import {
7
+ scriptPackagesRoutes,
8
+ scriptPackagesAccess,
9
+ pluginMetadata,
10
+ } from "@checkstack/script-packages-common";
11
+ import { ScriptPackagesSettingsPage } from "./pages/ScriptPackagesSettingsPage";
12
+ import { ScriptPackagesMenuItems } from "./components/ScriptPackagesMenuItems";
13
+
14
+ /**
15
+ * Frontend plugin for script-package management.
16
+ *
17
+ * Route: `/script-packages/` -> the admin settings page (allowlist,
18
+ * registry/storage summary, install state + size, satellite sync). Gated
19
+ * on `script-packages.manage`.
20
+ *
21
+ * The `useScriptPackageTypeAcquisition()` hook (exported below) gives editor
22
+ * pages a lazy ATA resolver + install reset-key to pass to `DynamicForm`'s
23
+ * `acquireTypes` / `acquireResetKey`, so a script editor fetches + registers
24
+ * the `.d.ts` of any npm package it imports (incl. `@types/*`) on demand.
25
+ */
26
+ export default createFrontendPlugin({
27
+ metadata: pluginMetadata,
28
+ routes: [
29
+ {
30
+ route: scriptPackagesRoutes.routes.settings,
31
+ element: <ScriptPackagesSettingsPage />,
32
+ title: "Script packages",
33
+ accessRule: scriptPackagesAccess.manage,
34
+ },
35
+ ],
36
+ extensions: [
37
+ createSlotExtension(UserMenuItemsSlot, {
38
+ id: "script-packages.user-menu.items",
39
+ component: ScriptPackagesMenuItems,
40
+ metadata: { group: "Configuration" },
41
+ }),
42
+ ],
43
+ });
44
+
45
+ export { useScriptPackageTypeAcquisition } from "./useScriptPackageTypeAcquisition";