fluxplugin 1.0.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.
Files changed (70) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +50 -0
  3. package/dist/browser/chunks/chunk-Q75AOCXD.js +2544 -0
  4. package/dist/browser/chunks/chunk-ZZ25CRMR.js +759 -0
  5. package/dist/browser/index.js +138 -0
  6. package/dist/browser/manager-ui.js +165 -0
  7. package/dist/browser/react.js +73 -0
  8. package/dist/cli.js +1635 -0
  9. package/dist/node/chunks/chunk-BZ7NZF7I.js +990 -0
  10. package/dist/node/chunks/chunk-XPLGAEBH.js +2623 -0
  11. package/dist/node/cli-api.js +843 -0
  12. package/dist/node/index.js +138 -0
  13. package/dist/node/main.js +61 -0
  14. package/dist/node/preload.js +56 -0
  15. package/dist/types/cli/bin.d.ts +1 -0
  16. package/dist/types/cli/build.d.ts +7 -0
  17. package/dist/types/cli/cli.d.ts +2 -0
  18. package/dist/types/cli/config.d.ts +9 -0
  19. package/dist/types/cli/host-templates.d.ts +6 -0
  20. package/dist/types/cli/host.d.ts +16 -0
  21. package/dist/types/cli/index.d.ts +6 -0
  22. package/dist/types/cli/shared-modules.d.ts +8 -0
  23. package/dist/types/cli/templates.d.ts +10 -0
  24. package/dist/types/core/api.d.ts +11 -0
  25. package/dist/types/core/common.d.ts +69 -0
  26. package/dist/types/core/deps.d.ts +34 -0
  27. package/dist/types/core/events.d.ts +58 -0
  28. package/dist/types/core/hooks.d.ts +55 -0
  29. package/dist/types/core/index.d.ts +18 -0
  30. package/dist/types/core/ipc.d.ts +148 -0
  31. package/dist/types/core/manager.d.ts +155 -0
  32. package/dist/types/core/manifest.d.ts +88 -0
  33. package/dist/types/core/permissions.d.ts +45 -0
  34. package/dist/types/core/plugin.d.ts +214 -0
  35. package/dist/types/core/protocol.d.ts +86 -0
  36. package/dist/types/core/registry.d.ts +88 -0
  37. package/dist/types/core/routes.d.ts +105 -0
  38. package/dist/types/core/schema.d.ts +99 -0
  39. package/dist/types/core/semver.d.ts +16 -0
  40. package/dist/types/core/slots.d.ts +75 -0
  41. package/dist/types/core/storage.d.ts +55 -0
  42. package/dist/types/core/styles.d.ts +34 -0
  43. package/dist/types/main/adapters.d.ts +81 -0
  44. package/dist/types/main/discover.d.ts +21 -0
  45. package/dist/types/main/framework.d.ts +78 -0
  46. package/dist/types/main/fs-storage.d.ts +33 -0
  47. package/dist/types/main/index.d.ts +8 -0
  48. package/dist/types/main/registry.d.ts +75 -0
  49. package/dist/types/main/security.d.ts +24 -0
  50. package/dist/types/main/serve-web.d.ts +14 -0
  51. package/dist/types/main/tar.d.ts +10 -0
  52. package/dist/types/manager-ui/index.d.ts +7 -0
  53. package/dist/types/preload/index.d.ts +27 -0
  54. package/dist/types/react/base-css.d.ts +2 -0
  55. package/dist/types/react/components.d.ts +89 -0
  56. package/dist/types/react/http-bridge.d.ts +10 -0
  57. package/dist/types/react/index.d.ts +6 -0
  58. package/dist/types/react/palette.d.ts +10 -0
  59. package/dist/types/react/router.d.ts +47 -0
  60. package/dist/types/react/runtime.d.ts +99 -0
  61. package/docs/ARCHITECTURE.md +31 -0
  62. package/docs/PLUGIN-AUTHORS.md +11 -0
  63. package/docs/RELEASE.md +20 -0
  64. package/docs/SECURITY.md +18 -0
  65. package/docs/screenshots/command-palette.png +0 -0
  66. package/docs/screenshots/dashboard.png +0 -0
  67. package/docs/screenshots/plugin-details.png +0 -0
  68. package/docs/screenshots/plugin-manager.png +0 -0
  69. package/docs/screenshots/stats.png +0 -0
  70. package/package.json +112 -0
package/LICENSE ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) fluxplugin contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # fluxplugin
2
+
3
+ Plugin architecture for **Electron + React + TypeScript**. Build an app that others can extend — pages, menus,
4
+ commands, UI slots, IPC, hooks, permissions, hot reload — and manage plugins with a CLI. One package, like `react`.
5
+
6
+ ```bash
7
+ npm create fluxplugin@latest my-app # or: npx fluxplugin init my-app
8
+ cd my-app && npm install
9
+ npm run dev:web # browser mode, no Electron needed
10
+ npm run dev # Electron, plugins hot-reload
11
+ npm run plugin:new orders -- -t backend # scaffold a plugin in ./plugins
12
+ npm run build && npm start
13
+ ```
14
+
15
+ ## Package map (one install: `npm i fluxplugin`)
16
+ | import | runs in | contents |
17
+ |---|---|---|
18
+ | `fluxplugin` | main + renderer | `definePlugin`, `defineIPC`, `s` schemas, `PluginManager`, registries, types |
19
+ | `fluxplugin/main` | Electron main | `MainFramework`, discovery, signatures, installer/registries, `attachElectron`, `serveWeb` |
20
+ | `fluxplugin/preload` | preload | `exposeFluxBridge` (sandbox-safe) |
21
+ | `fluxplugin/react` | renderer | `PluginProvider`, `PluginSlot`, `PluginRoutes`, hooks, `StyleHost`, `CommandPalette` |
22
+ | `fluxplugin/manager-ui` | renderer | ready-made Plugin Manager screen |
23
+ | `fluxplugin/cli` | node | programmatic CLI (`run`, `buildHost`, scaffolds) |
24
+
25
+ CLI (`npx fluxplugin`): `init`, `dev [--web]`, `build`, `start`, `plugin new`, `validate`, `package [--sign-key]`,
26
+ `install`, `uninstall`, `enable`, `disable`, `list`, `keygen`, `tailwind`.
27
+
28
+ ## A plugin in 20 lines
29
+ ```ts
30
+ // src/main.ts // src/renderer.tsx
31
+ import { definePlugin, defineIPC, s } from "fluxplugin"; import { definePlugin } from "fluxplugin";
32
+ export default definePlugin({ import { usePluginIPC } from "fluxplugin/react";
33
+ ipc: [defineIPC({ name: "orders.count", const Page = () => { const { data, call } = usePluginIPC("orders.count");
34
+ output: s.object({ n: s.number() }), return <button onClick={() => call()}>{data?.n ?? "load"}</button>; };
35
+ handler: () => ({ n: 3 }) })], export default definePlugin({ routes: [{ path: "/orders", component: Page,
36
+ preload: { orders: { count: "orders.count" } }, meta: { title: "Orders", menu: { label: "Orders" } } }] });
37
+ });
38
+ ```
39
+ More: [ARCHITECTURE](docs/ARCHITECTURE.md) · [SECURITY](docs/SECURITY.md) · [PLUGIN-AUTHORS](docs/PLUGIN-AUTHORS.md) · [RELEASE](docs/RELEASE.md)
40
+
41
+ ## Status — read this
42
+ * **Verified:** 121 automated tests; typecheck strict; the packed tarball installed into a *freshly generated app*
43
+ (`init` → `npm install` → typecheck → `build` → run in browser mode); a Playwright E2E against that app with
44
+ 3 plugins (menus, slots, extension points, hooks, validated IPC, push events, live enable/disable, palette, manager UI);
45
+ `plugin new` + `build` hot-loads into a running app.
46
+ * **Not verified:** a real Electron binary (unavailable in the build sandbox). `main.ts`/`preload.ts` templates and
47
+ `attachElectron` follow the Electron API and are tested against fakes — expect small adjustments on first `npm run dev`.
48
+ * **Not published:** the package is not on npm. Run the steps in `docs/RELEASE.md`; check the name is free first.
49
+ * **Security:** plugin `main` code is not sandboxed (permissions are an API contract). Read `docs/SECURITY.md`.
50
+ * **Not done:** per-plugin process isolation, hosted marketplace (only the `PluginRegistry` abstraction + local/HTTP), Tailwind wiring in the starter.