@openruntime/modern-plugin 0.1.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/README.md +334 -0
- package/dist/business/ready.d.ts +13 -0
- package/dist/business/ready.d.ts.map +1 -0
- package/dist/business/ready.js +48 -0
- package/dist/business/ready.js.map +1 -0
- package/dist/garfish/plugin.d.ts +5 -0
- package/dist/garfish/plugin.d.ts.map +1 -0
- package/dist/garfish/plugin.js +181 -0
- package/dist/garfish/plugin.js.map +1 -0
- package/dist/garfish/reporter.d.ts +6 -0
- package/dist/garfish/reporter.d.ts.map +1 -0
- package/dist/garfish/reporter.js +338 -0
- package/dist/garfish/reporter.js.map +1 -0
- package/dist/garfish/types.d.ts +111 -0
- package/dist/garfish/types.d.ts.map +1 -0
- package/dist/garfish/types.js +25 -0
- package/dist/garfish/types.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/modern/events.d.ts +124 -0
- package/dist/modern/events.d.ts.map +1 -0
- package/dist/modern/events.js +2 -0
- package/dist/modern/events.js.map +1 -0
- package/dist/modern/handlers.d.ts +10 -0
- package/dist/modern/handlers.d.ts.map +1 -0
- package/dist/modern/handlers.js +355 -0
- package/dist/modern/handlers.js.map +1 -0
- package/dist/modern/serialize.d.ts +9 -0
- package/dist/modern/serialize.d.ts.map +1 -0
- package/dist/modern/serialize.js +84 -0
- package/dist/modern/serialize.js.map +1 -0
- package/dist/modern/stream-ssr.d.ts +5 -0
- package/dist/modern/stream-ssr.d.ts.map +1 -0
- package/dist/modern/stream-ssr.js +90 -0
- package/dist/modern/stream-ssr.js.map +1 -0
- package/dist/plugin/create-plugin.d.ts +3 -0
- package/dist/plugin/create-plugin.d.ts.map +1 -0
- package/dist/plugin/create-plugin.js +32 -0
- package/dist/plugin/create-plugin.js.map +1 -0
- package/dist/plugin/runtime-state.d.ts +60 -0
- package/dist/plugin/runtime-state.d.ts.map +1 -0
- package/dist/plugin/runtime-state.js +453 -0
- package/dist/plugin/runtime-state.js.map +1 -0
- package/dist/plugin/types.d.ts +24 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin/types.js +2 -0
- package/dist/plugin/types.js.map +1 -0
- package/dist/runtime/render-context.d.ts +11 -0
- package/dist/runtime/render-context.d.ts.map +1 -0
- package/dist/runtime/render-context.js +51 -0
- package/dist/runtime/render-context.js.map +1 -0
- package/dist/runtime/resolve-runtime.d.ts +9 -0
- package/dist/runtime/resolve-runtime.d.ts.map +1 -0
- package/dist/runtime/resolve-runtime.js +31 -0
- package/dist/runtime/resolve-runtime.js.map +1 -0
- package/dist/runtime/targets.d.ts +51 -0
- package/dist/runtime/targets.d.ts.map +1 -0
- package/dist/runtime/targets.js +176 -0
- package/dist/runtime/targets.js.map +1 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
# @openruntime/modern-plugin
|
|
2
|
+
|
|
3
|
+
`@openruntime/modern-plugin` lets a Modern.js app expose framework runtime
|
|
4
|
+
state to OpenRuntime. It records information that Modern.js already knows:
|
|
5
|
+
application render state, current route state, SSR state, hydration state, and
|
|
6
|
+
optional business ready state.
|
|
7
|
+
|
|
8
|
+
The plugin does not decide whether a business page is usable. Framework targets
|
|
9
|
+
only describe framework lifecycle. Business readiness should use the business
|
|
10
|
+
ready helpers described below.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
Add the plugin in `src/modern.runtime.ts`:
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
import { openRuntimeModernPlugin } from "@openruntime/modern-plugin";
|
|
18
|
+
|
|
19
|
+
export default openRuntimeModernPlugin({
|
|
20
|
+
bridge: {
|
|
21
|
+
port: 17321,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then use the OpenRuntime CLI against the page:
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
pnpm exec openruntime targets --url http://localhost:19081/
|
|
30
|
+
pnpm exec openruntime snapshot --url http://localhost:19081/
|
|
31
|
+
pnpm exec openruntime wait-for modern:route ready --url http://localhost:19081/ --where pathname=/orders
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Targets
|
|
35
|
+
|
|
36
|
+
### `modern:app`
|
|
37
|
+
|
|
38
|
+
Type: `modern.app`
|
|
39
|
+
|
|
40
|
+
This is the top-level Modern.js runtime signal for the current page. Use it as
|
|
41
|
+
the quick "is the framework page currently healthy" check.
|
|
42
|
+
|
|
43
|
+
Statuses:
|
|
44
|
+
|
|
45
|
+
- `initializing`: the plugin has been installed, but rendering has not started.
|
|
46
|
+
- `rendering`: Modern.js is rendering or route work is still in progress.
|
|
47
|
+
- `ready`: the current framework route is ready and no hydration error is
|
|
48
|
+
active.
|
|
49
|
+
- `error`: a framework-level failure was observed. The snapshot data points to
|
|
50
|
+
the failed target, usually `modern:route` or `modern:hydration`.
|
|
51
|
+
|
|
52
|
+
Common snapshot data:
|
|
53
|
+
|
|
54
|
+
- `routeCount`: number of known Modern.js routes.
|
|
55
|
+
- `basename`: router basename when Modern.js provides it.
|
|
56
|
+
- `failedTargetId`: failed target id when the app is in `error`.
|
|
57
|
+
- `failedStatus`: failed target status, usually `error`.
|
|
58
|
+
- `reason`: short reason such as `route-loader-error`,
|
|
59
|
+
`route-component-error`, `route-error`, or hydration fallback reason.
|
|
60
|
+
- `pathname`: current pathname when the failure is route-related.
|
|
61
|
+
- `errorRouteIds`: route ids that currently carry route errors.
|
|
62
|
+
- `hydrationEventType`: hydration event type when hydration failed.
|
|
63
|
+
|
|
64
|
+
### `modern:route`
|
|
65
|
+
|
|
66
|
+
Type: `modern.route`
|
|
67
|
+
|
|
68
|
+
This is the single route target. It represents the current route state and keeps
|
|
69
|
+
the route manifest on the target definition.
|
|
70
|
+
|
|
71
|
+
Statuses:
|
|
72
|
+
|
|
73
|
+
- `idle`: no current route match has been observed yet.
|
|
74
|
+
- `loading`: navigation, loader, or redirect work is still in progress.
|
|
75
|
+
- `ready`: the current route match is stable and has no known route error.
|
|
76
|
+
- `error`: a route loader, route module, or router error was observed.
|
|
77
|
+
|
|
78
|
+
Target data from `targets`:
|
|
79
|
+
|
|
80
|
+
- `routes`: route manifest for known routes.
|
|
81
|
+
- `routes[].routeId`: stable OpenRuntime route id. When a pathname is known,
|
|
82
|
+
this is the pathname, such as `/orders`.
|
|
83
|
+
- `routes[].path`: Modern.js route path segment.
|
|
84
|
+
- `routes[].pathname`: resolved pathname when available.
|
|
85
|
+
- `routes[].modernRouteId`: original Modern.js route id.
|
|
86
|
+
- `routes[].parentRouteId`: parent route id for nested routes.
|
|
87
|
+
- `routes[].index`: whether this is an index route.
|
|
88
|
+
- `routes[].hasLoader`: whether the route has a real data loader.
|
|
89
|
+
- `routes[].hasRouteComponent`: whether the route declares a route component or
|
|
90
|
+
lazy module.
|
|
91
|
+
- `routes[].hasLazyModule`: whether the route uses a lazy module.
|
|
92
|
+
|
|
93
|
+
Snapshot data from `snapshot`:
|
|
94
|
+
|
|
95
|
+
- `pathname`: current browser pathname.
|
|
96
|
+
- `navigation`: current router navigation state.
|
|
97
|
+
- `matches`: current matched route chain only. Old route matches are not kept
|
|
98
|
+
after navigation.
|
|
99
|
+
- `matches[].loader`: real data loader state when known:
|
|
100
|
+
`loading`, `success`, `redirect`, or `error`.
|
|
101
|
+
- `matches[].routeComponent`: shown only when the route component module failed;
|
|
102
|
+
the value is `error`.
|
|
103
|
+
- `matches[].error`: route-specific error details.
|
|
104
|
+
- `errorRouteIds`: route ids that currently have errors.
|
|
105
|
+
|
|
106
|
+
`modern:route` does not create separate loader or route component targets.
|
|
107
|
+
Loader and route component details stay inside the current `matches` array so a
|
|
108
|
+
snapshot describes the current route instead of a history of every visited
|
|
109
|
+
route.
|
|
110
|
+
|
|
111
|
+
Common waits:
|
|
112
|
+
|
|
113
|
+
```sh
|
|
114
|
+
pnpm exec openruntime wait-for modern:route ready --where pathname=/orders
|
|
115
|
+
pnpm exec openruntime wait-for modern:route error --where pathname=/broken
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Optional Route Actions
|
|
119
|
+
|
|
120
|
+
The Modern.js plugin does not register route actions by default. Enable them
|
|
121
|
+
explicitly when the page should expose route list and route navigation actions
|
|
122
|
+
to Agents:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
openRuntimeModernPlugin({
|
|
126
|
+
injectRouteListAction: true,
|
|
127
|
+
injectRouteNavigateAction: true,
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### `modern.route.list`
|
|
132
|
+
|
|
133
|
+
Enabled by `injectRouteListAction`.
|
|
134
|
+
|
|
135
|
+
This safe action returns the same known route manifest stored on the
|
|
136
|
+
`modern:route` target.
|
|
137
|
+
|
|
138
|
+
```sh
|
|
139
|
+
pnpm exec openruntime run-action modern.route.list
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### `modern.route.navigate`
|
|
143
|
+
|
|
144
|
+
Enabled by `injectRouteNavigateAction`.
|
|
145
|
+
|
|
146
|
+
This state-changing action navigates through the Modern.js router. The `to`
|
|
147
|
+
input only accepts routes known by the current `modern:route` route manifest.
|
|
148
|
+
Use input options to read the current candidate route pathnames:
|
|
149
|
+
|
|
150
|
+
```sh
|
|
151
|
+
pnpm exec openruntime input-options --action modern.route.navigate --input to
|
|
152
|
+
pnpm exec openruntime run-action modern.route.navigate --payload '{"to":"/orders"}'
|
|
153
|
+
pnpm exec openruntime wait-for modern:route ready --where pathname=/orders
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### `modern:ssr`
|
|
157
|
+
|
|
158
|
+
Type: `modern.ssr`
|
|
159
|
+
|
|
160
|
+
This target is registered only when SSR data exists or SSR work is observed. A
|
|
161
|
+
CSR-only page normally does not have `modern:ssr`.
|
|
162
|
+
|
|
163
|
+
Statuses:
|
|
164
|
+
|
|
165
|
+
- `unknown`: SSR target was registered before detailed state was available.
|
|
166
|
+
- `rendering`: the server render has started and has not finished yet.
|
|
167
|
+
- `server-rendered`: server render completed and produced SSR payload.
|
|
168
|
+
- `fallback`: Modern.js fell back to client render.
|
|
169
|
+
- `invalidated`: browser hydration showed the SSR result could not be reused.
|
|
170
|
+
- `error`: SSR output is not usable because the server-rendered route failed.
|
|
171
|
+
|
|
172
|
+
Common snapshot data:
|
|
173
|
+
|
|
174
|
+
- `environment`: `server` or `browser`.
|
|
175
|
+
- `runtimeId`: OpenRuntime runtime id injected during SSR.
|
|
176
|
+
- `renderId`: render id injected during SSR.
|
|
177
|
+
- `requestPathname`: pathname for the SSR request when available.
|
|
178
|
+
- `requestUrl`: full SSR request URL when available.
|
|
179
|
+
- `renderMode`: Modern.js render mode, such as `string` or `stream`.
|
|
180
|
+
- `renderLevel`: Modern.js hydration/render level when available.
|
|
181
|
+
- `reason`: fallback or invalidation reason when available.
|
|
182
|
+
- `failedTargetId`: failed target id when SSR becomes `error`.
|
|
183
|
+
- `failedStatus`: failed target status.
|
|
184
|
+
|
|
185
|
+
Common wait:
|
|
186
|
+
|
|
187
|
+
```sh
|
|
188
|
+
pnpm exec openruntime wait-for modern:ssr server-rendered --where environment=server
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### `modern:hydration`
|
|
192
|
+
|
|
193
|
+
Type: `modern.hydration`
|
|
194
|
+
|
|
195
|
+
This target is registered only when Modern.js emits hydration events. A CSR-only
|
|
196
|
+
page normally does not have `modern:hydration`. If SSR failed before hydration,
|
|
197
|
+
the plugin suppresses this target so a failed SSR page is not shown as
|
|
198
|
+
hydration success.
|
|
199
|
+
|
|
200
|
+
Statuses:
|
|
201
|
+
|
|
202
|
+
- `running`: client hydration has started.
|
|
203
|
+
- `success`: client hydration completed successfully.
|
|
204
|
+
- `fallback`: Modern.js downgraded to client render.
|
|
205
|
+
- `error`: hydration failed or emitted a recoverable hydration error.
|
|
206
|
+
|
|
207
|
+
Common snapshot data:
|
|
208
|
+
|
|
209
|
+
- `type`: Modern.js hydration event type.
|
|
210
|
+
- `renderLevel`: Modern.js render level when available.
|
|
211
|
+
- `renderMode`: Modern.js render mode when available.
|
|
212
|
+
- `reason`: hydration fallback or recoverable-error reason.
|
|
213
|
+
|
|
214
|
+
When hydration enters `error`, `modern:ssr` becomes `invalidated` and
|
|
215
|
+
`modern:app` becomes `error`. Later hydration success events do not overwrite
|
|
216
|
+
the earlier hydration failure.
|
|
217
|
+
|
|
218
|
+
## Garfish Targets
|
|
219
|
+
|
|
220
|
+
The package also exports Garfish helpers for Modern.js / EdenX host
|
|
221
|
+
applications that use Garfish:
|
|
222
|
+
|
|
223
|
+
- `createOpenRuntimeGarfishReporter`
|
|
224
|
+
- `createOpenRuntimeGarfishPlugin`
|
|
225
|
+
- `createOpenRuntimeGarfishCustomLoader`
|
|
226
|
+
|
|
227
|
+
Garfish is a singleton in the host page. Register the OpenRuntime Garfish
|
|
228
|
+
plugin in the host application before `Garfish.run()` or before the first
|
|
229
|
+
`Garfish.loadApp()`:
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
import {
|
|
233
|
+
createOpenRuntimeGarfishCustomLoader,
|
|
234
|
+
createOpenRuntimeGarfishPlugin,
|
|
235
|
+
createOpenRuntimeGarfishReporter,
|
|
236
|
+
} from "@openruntime/modern-plugin";
|
|
237
|
+
|
|
238
|
+
const reporter = createOpenRuntimeGarfishReporter();
|
|
239
|
+
|
|
240
|
+
export const garfishOptions = {
|
|
241
|
+
plugins: [createOpenRuntimeGarfishPlugin({ reporter })],
|
|
242
|
+
customLoader: createOpenRuntimeGarfishCustomLoader({ reporter }),
|
|
243
|
+
};
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
If the host already has a `customLoader`, pass it through `loader` so
|
|
247
|
+
OpenRuntime can wrap it instead of replacing it.
|
|
248
|
+
|
|
249
|
+
### `modern:garfish`
|
|
250
|
+
|
|
251
|
+
Type: `modern.garfish`
|
|
252
|
+
|
|
253
|
+
Aggregate Garfish sub-application state for the current page.
|
|
254
|
+
|
|
255
|
+
### `modern:garfish:app:<name>`
|
|
256
|
+
|
|
257
|
+
Type: `modern.garfish.app`
|
|
258
|
+
|
|
259
|
+
Per-sub-application state. The target records Garfish lifecycle state and
|
|
260
|
+
whether `provider.render` / `provider.destroy` was called through the
|
|
261
|
+
OpenRuntime custom loader.
|
|
262
|
+
|
|
263
|
+
Statuses:
|
|
264
|
+
|
|
265
|
+
- `idle`: no Garfish app has been observed yet.
|
|
266
|
+
- `registered`: the app was registered.
|
|
267
|
+
- `loading`: Garfish started loading the app.
|
|
268
|
+
- `loaded`: Garfish loaded the app instance.
|
|
269
|
+
- `evaluating`: a sub-application script started executing.
|
|
270
|
+
- `evaluated`: a sub-application script executed.
|
|
271
|
+
- `mounting`: Garfish started mounting the app.
|
|
272
|
+
- `rendering`: `provider.render` was called through the OpenRuntime custom
|
|
273
|
+
loader.
|
|
274
|
+
- `mounted`: Garfish mount completed.
|
|
275
|
+
- `unmounting`: Garfish started unmounting or `provider.destroy` was called.
|
|
276
|
+
- `unmounted`: Garfish unmount completed.
|
|
277
|
+
- `error`: load, script execution, mount, or unmount failed.
|
|
278
|
+
|
|
279
|
+
Common waits:
|
|
280
|
+
|
|
281
|
+
```sh
|
|
282
|
+
pnpm exec openruntime wait-for modern:garfish:app:orders mounted
|
|
283
|
+
pnpm exec openruntime events --target-id modern:garfish:app:orders --limit 50
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Business Ready Target
|
|
287
|
+
|
|
288
|
+
The package also exports helpers for business-owned readiness:
|
|
289
|
+
|
|
290
|
+
- `registerOpenRuntimeReady`
|
|
291
|
+
- `markOpenRuntimeReady`
|
|
292
|
+
- `markOpenRuntimeReadyError`
|
|
293
|
+
- `unregisterOpenRuntimeReady`
|
|
294
|
+
|
|
295
|
+
These helpers use target ids shaped as `business:ready:<id>` and type
|
|
296
|
+
`business.ready`.
|
|
297
|
+
|
|
298
|
+
Statuses:
|
|
299
|
+
|
|
300
|
+
- `pending`: business target is registered but not ready yet.
|
|
301
|
+
- `ready`: business code marked the target as ready.
|
|
302
|
+
- `error`: business code marked the target as failed.
|
|
303
|
+
|
|
304
|
+
Business targets are owned by business code. If a route unmounts the business
|
|
305
|
+
component, the component should call `unregisterOpenRuntimeReady` so stale
|
|
306
|
+
business targets do not stay in later route snapshots.
|
|
307
|
+
|
|
308
|
+
Example:
|
|
309
|
+
|
|
310
|
+
```ts
|
|
311
|
+
import {
|
|
312
|
+
markOpenRuntimeReady,
|
|
313
|
+
registerOpenRuntimeReady,
|
|
314
|
+
unregisterOpenRuntimeReady,
|
|
315
|
+
} from "@openruntime/modern-plugin";
|
|
316
|
+
import { getOpenRuntimeFromWindow } from "@openruntime/core";
|
|
317
|
+
|
|
318
|
+
const runtime = getOpenRuntimeFromWindow();
|
|
319
|
+
|
|
320
|
+
if (runtime) {
|
|
321
|
+
registerOpenRuntimeReady({
|
|
322
|
+
runtime,
|
|
323
|
+
id: "checkout",
|
|
324
|
+
});
|
|
325
|
+
markOpenRuntimeReady(runtime, "checkout", {
|
|
326
|
+
screen: "checkout",
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// When the owning page or component unmounts:
|
|
331
|
+
if (runtime) {
|
|
332
|
+
unregisterOpenRuntimeReady(runtime, "checkout");
|
|
333
|
+
}
|
|
334
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OpenRuntimeCore } from "@openruntime/core";
|
|
2
|
+
export interface RegisterOpenRuntimeReadyOptions {
|
|
3
|
+
runtime: OpenRuntimeCore;
|
|
4
|
+
id?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
source?: string;
|
|
7
|
+
data?: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare function registerOpenRuntimeReady(options: RegisterOpenRuntimeReadyOptions): string;
|
|
10
|
+
export declare function markOpenRuntimeReady(runtime: OpenRuntimeCore, id?: string, data?: unknown): void;
|
|
11
|
+
export declare function markOpenRuntimeReadyError(runtime: OpenRuntimeCore, error: Error | string, id?: string): void;
|
|
12
|
+
export declare function unregisterOpenRuntimeReady(runtime: OpenRuntimeCore, id?: string): void;
|
|
13
|
+
//# sourceMappingURL=ready.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ready.d.ts","sourceRoot":"","sources":["../../src/business/ready.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAIzD,MAAM,WAAW,+BAA+B;IAC9C,OAAO,EAAE,eAAe,CAAC;IACzB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,+BAA+B,GAAG,MAAM,CAsBzF;AAED,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,eAAe,EACxB,EAAE,CAAC,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,OAAO,GACb,IAAI,CAON;AAED,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE,KAAK,GAAG,MAAM,EACrB,EAAE,CAAC,EAAE,MAAM,GACV,IAAI,CAUN;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAEtF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
const businessReadyStatuses = ["pending", "ready", "error"];
|
|
2
|
+
export function registerOpenRuntimeReady(options) {
|
|
3
|
+
const targetId = getBusinessReadyTargetId(options.id);
|
|
4
|
+
const source = options.source ?? "business";
|
|
5
|
+
options.runtime.registerTarget({
|
|
6
|
+
id: targetId,
|
|
7
|
+
type: "business.ready",
|
|
8
|
+
source,
|
|
9
|
+
label: options.label ?? targetId,
|
|
10
|
+
statuses: [...businessReadyStatuses],
|
|
11
|
+
...(options.data === undefined ? {} : { data: options.data })
|
|
12
|
+
});
|
|
13
|
+
if (options.runtime.getSnapshot({ id: targetId }).targets[targetId] === undefined) {
|
|
14
|
+
options.runtime.updateSnapshot({
|
|
15
|
+
id: targetId,
|
|
16
|
+
status: "pending",
|
|
17
|
+
source,
|
|
18
|
+
...(options.data === undefined ? {} : { data: options.data })
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return targetId;
|
|
22
|
+
}
|
|
23
|
+
export function markOpenRuntimeReady(runtime, id, data) {
|
|
24
|
+
runtime.updateSnapshot({
|
|
25
|
+
id: getBusinessReadyTargetId(id),
|
|
26
|
+
status: "ready",
|
|
27
|
+
source: "business",
|
|
28
|
+
...(data === undefined ? {} : { data })
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export function markOpenRuntimeReadyError(runtime, error, id) {
|
|
32
|
+
runtime.updateSnapshot({
|
|
33
|
+
id: getBusinessReadyTargetId(id),
|
|
34
|
+
status: "error",
|
|
35
|
+
source: "business",
|
|
36
|
+
error: {
|
|
37
|
+
message: typeof error === "string" ? error : error.message,
|
|
38
|
+
...(typeof error === "string" || error.stack === undefined ? {} : { stack: error.stack })
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export function unregisterOpenRuntimeReady(runtime, id) {
|
|
43
|
+
runtime.unregisterTarget(getBusinessReadyTargetId(id));
|
|
44
|
+
}
|
|
45
|
+
function getBusinessReadyTargetId(id = "app") {
|
|
46
|
+
return `business:ready:${id}`;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=ready.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ready.js","sourceRoot":"","sources":["../../src/business/ready.ts"],"names":[],"mappings":"AAEA,MAAM,qBAAqB,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAU,CAAC;AAUrE,MAAM,UAAU,wB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AAE,CAAC;KACxC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,yBAAyB,CACvC,OAAwB,EACxB,KAAqB,EACrB,EAAW;IAEX,OAAO,CAAC,cAAc,CAAC;QACrB,EAAE,EAAE,wBAAwB,CAAC,EAAE,CAAC;QAChC,MAAM,EAAE,OAAO;QACf,MAAM,EAAE,UAAU;QAClB,KAAK,EAAE;YACL,OAAO,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO;YAC1D,GAAG,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,CAAC;SAC1F;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,0BAA0B,CAAC,OAAwB,EAAE,EAAW;IAC9E,OAAO,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,EAAE,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,wBAAwB,CAAC,EAAE,GAAG,KAAK;IAC1C,OAAO,kBAAkB,EAAE,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { GarfishCustomLoader, OpenRuntimeGarfishCustomLoaderOptions, OpenRuntimeGarfishPluginFactory, OpenRuntimeGarfishPluginOptions } from "./types.js";
|
|
2
|
+
export declare function createOpenRuntimeGarfishPlugin(options?: OpenRuntimeGarfishPluginOptions): OpenRuntimeGarfishPluginFactory;
|
|
3
|
+
export declare function createOpenRuntimeGarfishCustomLoader(options?: OpenRuntimeGarfishCustomLoaderOptions): GarfishCustomLoader;
|
|
4
|
+
export type { GarfishAppInfoLike, GarfishAppInstanceLike, GarfishCustomLoader, GarfishExecOptionsLike, GarfishLoaderResult, GarfishProviderLike, OpenRuntimeGarfishCustomLoaderOptions, OpenRuntimeGarfishPlugin, OpenRuntimeGarfishPluginFactory, OpenRuntimeGarfishPluginOptions, OpenRuntimeGarfishReporter } from "./types.js";
|
|
5
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../src/garfish/plugin.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAGV,mBAAmB,EAMnB,qCAAqC,EAErC,+BAA+B,EAC/B,+BAA+B,EAEhC,MAAM,YAAY,CAAC;AAEpB,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,+BAAoC,GAC5C,+BAA+B,CAsHjC;AAED,wBAAgB,oCAAoC,CAClD,OAAO,GAAE,qCAA0C,GAClD,mBAAmB,CASrB;AAsED,YAAY,EACV,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,qCAAqC,EACrC,wBAAwB,EACxB,+BAA+B,EAC/B,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { createOpenRuntimeGarfishReporter, resolveRenderPayloadAppInfo, toGarfishRuntimeError } from "./reporter.js";
|
|
2
|
+
export function createOpenRuntimeGarfishPlugin(options = {}) {
|
|
3
|
+
const reporter = resolveReporter(options);
|
|
4
|
+
return () => ({
|
|
5
|
+
name: "@openruntime/garfish-plugin",
|
|
6
|
+
version: "0.1.0",
|
|
7
|
+
beforeRegisterApp(appInfo) {
|
|
8
|
+
for (const info of normalizeAppInfos(appInfo)) {
|
|
9
|
+
reporter.registerApp(info);
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
registerApp(apps) {
|
|
13
|
+
for (const info of normalizeAppInfos(apps)) {
|
|
14
|
+
reporter.registerApp(info);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
beforeLoad(appInfo) {
|
|
18
|
+
reporter.updateApp(appInfo, "loading", {
|
|
19
|
+
lifecycle: "beforeLoad",
|
|
20
|
+
phase: "load"
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
afterLoad(appInfo, appInstance) {
|
|
24
|
+
const details = {
|
|
25
|
+
lifecycle: "afterLoad",
|
|
26
|
+
phase: "load"
|
|
27
|
+
};
|
|
28
|
+
reporter.updateApp(appInfo, "loaded", appInstance === undefined
|
|
29
|
+
? details
|
|
30
|
+
: { ...details, appInstance });
|
|
31
|
+
},
|
|
32
|
+
errorLoadApp(error, appInfo) {
|
|
33
|
+
reporter.updateApp(appInfo, "error", {
|
|
34
|
+
lifecycle: "errorLoadApp",
|
|
35
|
+
phase: "load",
|
|
36
|
+
error: toGarfishRuntimeError(error, "garfish_load_error")
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
beforeEval(appInfo, _code, _env, scriptUrl, execOptions) {
|
|
40
|
+
reporter.updateApp(appInfo, "evaluating", {
|
|
41
|
+
lifecycle: "beforeEval",
|
|
42
|
+
phase: "eval",
|
|
43
|
+
...(scriptUrl === undefined ? {} : { scriptUrl }),
|
|
44
|
+
...(execOptions === undefined ? {} : { execOptions })
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
afterEval(appInfo, _code, _env, scriptUrl, execOptions) {
|
|
48
|
+
reporter.updateApp(appInfo, "evaluated", {
|
|
49
|
+
lifecycle: "afterEval",
|
|
50
|
+
phase: "eval",
|
|
51
|
+
...(scriptUrl === undefined ? {} : { scriptUrl }),
|
|
52
|
+
...(execOptions === undefined ? {} : { execOptions })
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
errorExecCode(error, appInfo, _code, _env, scriptUrl, execOptions) {
|
|
56
|
+
reporter.updateApp(appInfo, "error", {
|
|
57
|
+
lifecycle: "errorExecCode",
|
|
58
|
+
phase: "eval",
|
|
59
|
+
...(scriptUrl === undefined ? {} : { scriptUrl }),
|
|
60
|
+
...(execOptions === undefined ? {} : { execOptions }),
|
|
61
|
+
error: toGarfishRuntimeError(error, "garfish_exec_error")
|
|
62
|
+
});
|
|
63
|
+
},
|
|
64
|
+
beforeMount(appInfo, appInstance, cacheMode) {
|
|
65
|
+
const details = {
|
|
66
|
+
lifecycle: "beforeMount",
|
|
67
|
+
phase: "mount",
|
|
68
|
+
payload: { cacheMode }
|
|
69
|
+
};
|
|
70
|
+
reporter.updateApp(appInfo, "mounting", appInstance === undefined
|
|
71
|
+
? details
|
|
72
|
+
: { ...details, appInstance });
|
|
73
|
+
},
|
|
74
|
+
afterMount(appInfo, appInstance, cacheMode) {
|
|
75
|
+
const details = {
|
|
76
|
+
lifecycle: "afterMount",
|
|
77
|
+
phase: "mount",
|
|
78
|
+
payload: { cacheMode }
|
|
79
|
+
};
|
|
80
|
+
reporter.updateApp(appInfo, "mounted", appInstance === undefined
|
|
81
|
+
? details
|
|
82
|
+
: { ...details, appInstance });
|
|
83
|
+
},
|
|
84
|
+
errorMountApp(error, appInfo) {
|
|
85
|
+
reporter.updateApp(appInfo, "error", {
|
|
86
|
+
lifecycle: "errorMountApp",
|
|
87
|
+
phase: "mount",
|
|
88
|
+
error: toGarfishRuntimeError(error, "garfish_mount_error")
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
beforeUnmount(appInfo, appInstance, cacheMode) {
|
|
92
|
+
const details = {
|
|
93
|
+
lifecycle: "beforeUnmount",
|
|
94
|
+
phase: "unmount",
|
|
95
|
+
payload: { cacheMode }
|
|
96
|
+
};
|
|
97
|
+
reporter.updateApp(appInfo, "unmounting", appInstance === undefined
|
|
98
|
+
? details
|
|
99
|
+
: { ...details, appInstance });
|
|
100
|
+
},
|
|
101
|
+
afterUnmount(appInfo, appInstance, cacheMode) {
|
|
102
|
+
const details = {
|
|
103
|
+
lifecycle: "afterUnmount",
|
|
104
|
+
phase: "unmount",
|
|
105
|
+
payload: { cacheMode }
|
|
106
|
+
};
|
|
107
|
+
reporter.updateApp(appInfo, "unmounted", appInstance === undefined
|
|
108
|
+
? details
|
|
109
|
+
: { ...details, appInstance });
|
|
110
|
+
},
|
|
111
|
+
errorUnmountApp(error, appInfo) {
|
|
112
|
+
reporter.updateApp(appInfo, "error", {
|
|
113
|
+
lifecycle: "errorUnmountApp",
|
|
114
|
+
phase: "unmount",
|
|
115
|
+
error: toGarfishRuntimeError(error, "garfish_unmount_error")
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
export function createOpenRuntimeGarfishCustomLoader(options = {}) {
|
|
121
|
+
const reporter = resolveReporter(options);
|
|
122
|
+
return async (provider, appInfo, basename) => {
|
|
123
|
+
const baseResult = await options.loader?.(provider, appInfo, basename);
|
|
124
|
+
const targetResult = baseResult ?? createDefaultLoaderResult(provider);
|
|
125
|
+
return wrapLoaderResult(targetResult, appInfo, reporter);
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function resolveReporter(options) {
|
|
129
|
+
return options.reporter ?? createOpenRuntimeGarfishReporter(options);
|
|
130
|
+
}
|
|
131
|
+
function wrapLoaderResult(result, appInfo, reporter) {
|
|
132
|
+
return {
|
|
133
|
+
...(result.mount === undefined
|
|
134
|
+
? {}
|
|
135
|
+
: {
|
|
136
|
+
mount(payload) {
|
|
137
|
+
reporter.markProviderRenderCalled(resolveRenderPayloadAppInfo(appInfo, payload), payload);
|
|
138
|
+
return result.mount?.(payload);
|
|
139
|
+
}
|
|
140
|
+
}),
|
|
141
|
+
...(result.unmount === undefined
|
|
142
|
+
? {}
|
|
143
|
+
: {
|
|
144
|
+
unmount(payload) {
|
|
145
|
+
reporter.markProviderDestroyCalled(resolveRenderPayloadAppInfo(appInfo, payload), payload);
|
|
146
|
+
return result.unmount?.(payload);
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
function createDefaultLoaderResult(provider) {
|
|
152
|
+
return {
|
|
153
|
+
...(provider.render === undefined
|
|
154
|
+
? {}
|
|
155
|
+
: {
|
|
156
|
+
mount(payload) {
|
|
157
|
+
return provider.render?.(payload);
|
|
158
|
+
}
|
|
159
|
+
}),
|
|
160
|
+
...(provider.destroy === undefined
|
|
161
|
+
? {}
|
|
162
|
+
: {
|
|
163
|
+
unmount(payload) {
|
|
164
|
+
return provider.destroy?.(payload);
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function normalizeAppInfos(input) {
|
|
170
|
+
if (Array.isArray(input)) {
|
|
171
|
+
return input;
|
|
172
|
+
}
|
|
173
|
+
if (isAppInfo(input)) {
|
|
174
|
+
return [input];
|
|
175
|
+
}
|
|
176
|
+
return Object.values(input).filter(isAppInfo);
|
|
177
|
+
}
|
|
178
|
+
function isAppInfo(value) {
|
|
179
|
+
return typeof value === "object" && value !== null && "name" in value;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../src/garfish/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAiBvB,MAAM,UAAU,8BAA8B,CAC5C,UAA2C,EAAE;IAE7C,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAE1C,OAAO,GAAG,EAAE,CAAC,CAAC;QACZ,IAAI,EAAE,6BAA6B;QACnC,OAAO,EAAE,OAAO;QAChB,iBAAiB,CAAC,OAAO;YACvB,KAAK,MAAM,IAAI,IAAI,iBAAiB,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC9C,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC7B,CAAC;QACH,CAAC;QACD,WAAW,CAAC,IAAI;YACd,KAAK,MAAM,IAAI,IAAI,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3C,QAAQ,CAAC,WAAW,CAAC,IAA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runtime/core";
|
|
2
|
+
import { type GarfishAppInfoLike, type GarfishProviderDestroyPayload, type GarfishProviderRenderPayload, type OpenRuntimeGarfishReporter, type OpenRuntimeGarfishReporterOptions } from "./types.js";
|
|
3
|
+
export declare function createOpenRuntimeGarfishReporter(options?: OpenRuntimeGarfishReporterOptions): OpenRuntimeGarfishReporter;
|
|
4
|
+
export declare function toGarfishRuntimeError(error: unknown, code: string): RuntimeError;
|
|
5
|
+
export declare function resolveRenderPayloadAppInfo(appInfo: GarfishAppInfoLike, payload: GarfishProviderRenderPayload | GarfishProviderDestroyPayload): GarfishAppInfoLike;
|
|
6
|
+
//# sourceMappingURL=reporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reporter.d.ts","sourceRoot":"","sources":["../../src/garfish/reporter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAIL,KAAK,kBAAkB,EAGvB,KAAK,6BAA6B,EAClC,KAAK,4BAA4B,EAEjC,KAAK,0BAA0B,EAC/B,KAAK,iCAAiC,EAEvC,MAAM,YAAY,CAAC;AAkDpB,wBAAgB,gCAAgC,CAC9C,OAAO,GAAE,iCAAsC,GAC9C,0BAA0B,CAE5B;AA8KD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,YAAY,CA4BhF;AAqLD,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,kBAAkB,EAC3B,OAAO,EAAE,4BAA4B,GAAG,6BAA6B,GACpE,kBAAkB,CAEpB"}
|