Commit 5116dfb
authored
# Middleware Plugin Infrastructure for Widget Chaining
## Summary
Adds middleware plugin support so plugins can wrap existing widgets
without replacing them, cross-plugin dependency loading via manifest
`package`/`dependencies` fields, and shared plugin-loading utilities in
`@deephaven/plugin`.
## What Changed
**Middleware chaining** — New `WidgetMiddlewarePlugin` type, identified
by its own `PluginType.MIDDLEWARE_PLUGIN` discriminator. Middleware
receives a `Component` prop and wraps the next layer. Multiple
middleware compose in registration order. Applied in both
`WidgetLoaderPlugin` (dashboard panels) and `WidgetView` (inline
widgets) via `createChainedComponent`/`createChainedPanelComponent`. The
chaining functions automatically filter middleware by `supportedTypes`
at render time, so middleware only activates for matching widget types.
**Cross-plugin dependencies** — Manifest entries can declare `package`
(makes the plugin's exports available to other plugins) and
`dependencies` (topological sort so deps load first). Plugins load
sequentially so each plugin's exports are available to subsequent
plugins via standard `import` statements.
**Shared loading utilities** — `getPluginModuleValue`, `registerPlugin`,
`processLoadedModule`, `sortPluginsByDependency`, and manifest types
moved from `@deephaven/app-utils` into `@deephaven/plugin`. Both
web-client-ui and gplus consume these instead of duplicating the logic.
~80 lines removed from app-utils.
**Behavior change — duplicate plugin names.** When two plugins in the
manifest are loaded under the same name, the shared `registerPlugin` now
**skips the duplicate** and keeps the first registration (with a
warning). Previously the duplicate **replaced** the existing entry. This
applies to plugin-name collisions in the plugin map; widget-type
resolution in `WidgetLoaderPlugin` is unaffected (last base plugin still
wins for a given widget type).
## Key Files
| File | Change |
|---|---|
| `packages/plugin/src/PluginTypes.ts` | Middleware types, type guard |
| `packages/plugin/src/PluginUtils.tsx` | Chaining functions, loader
utils, manifest types |
| `packages/plugin/src/sortPluginsByDependency.ts` | Topological sort
for plugin dependencies |
| `packages/plugin/src/WidgetView.tsx` | Middleware-aware inline
rendering |
| `packages/dashboard-core-plugins/src/WidgetLoaderPlugin.tsx` |
Middleware-aware panel loading |
| `packages/app-utils/src/plugins/PluginUtils.tsx` | Simplified to use
shared utils |
| `packages/plugin/docs/middleware-architecture.md` | Architecture
reference |
1 parent ada1e36 commit 5116dfb
13 files changed
Lines changed: 2312 additions & 267 deletions
File tree
- packages
- app-utils/src/plugins
- dashboard-core-plugins/src
- plugin
- docs
- src
- redux/src
Large diffs are not rendered by default.
Lines changed: 44 additions & 86 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
28 | 37 | | |
29 | 38 | | |
30 | 39 | | |
| |||
55 | 64 | | |
56 | 65 | | |
57 | 66 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | 67 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
108 | 72 | | |
109 | 73 | | |
110 | 74 | | |
| |||
120 | 84 | | |
121 | 85 | | |
122 | 86 | | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | 87 | | |
130 | | - | |
| 88 | + | |
131 | 89 | | |
132 | 90 | | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
153 | 111 | | |
154 | 112 | | |
155 | 113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| |||
0 commit comments