@xstate-devtools/adapter 0.1.2 → 0.1.4
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 +49 -0
- package/dist/chunk-3GM2SFT4.js +680 -0
- package/dist/chunk-3GM2SFT4.js.map +1 -0
- package/dist/chunk-MHHRMHW5.js +62 -0
- package/dist/chunk-MHHRMHW5.js.map +1 -0
- package/dist/index.cjs +753 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/react.cjs +790 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +12 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.js +43 -0
- package/dist/react.js.map +1 -0
- package/dist/server.cjs +936 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.cts +29 -0
- package/dist/server.d.ts +29 -0
- package/dist/server.js +235 -0
- package/dist/server.js.map +1 -0
- package/package.json +46 -6
- package/src/core.test.ts +0 -287
- package/src/core.ts +0 -667
- package/src/index.ts +0 -73
- package/src/logging.test.ts +0 -39
- package/src/logging.ts +0 -40
- package/src/react.tsx +0 -50
- package/src/sanitize.test.ts +0 -68
- package/src/sanitize.ts +0 -70
- package/src/serialize.test.ts +0 -170
- package/src/serialize.ts +0 -148
- package/src/server.ts +0 -272
- package/tsconfig.json +0 -14
package/README.md
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# @xstate-devtools/adapter
|
|
2
|
+
|
|
3
|
+
Inspect [XState v5](https://stately.ai/docs/xstate) actors from a running app and
|
|
4
|
+
stream them to the [XState DevTools](https://github.com/mjbeswick/xstate-devtools)
|
|
5
|
+
panel / VS Code live debugger. Three entry points — pick the one that matches
|
|
6
|
+
where your actors run.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
npm install @xstate-devtools/adapter
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
`xstate` is a peer dependency. `ws` is required only for the server adapter;
|
|
13
|
+
`react` + `@xstate/react` only for the React hooks.
|
|
14
|
+
|
|
15
|
+
## Browser — `@xstate-devtools/adapter`
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { createAdapter } from '@xstate-devtools/adapter'
|
|
19
|
+
|
|
20
|
+
export const adapter = createAdapter()
|
|
21
|
+
useMachine(machine, { inspect: adapter.inspect })
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
In a non-browser environment `createAdapter()` returns a no-op, so the import is
|
|
25
|
+
safe in SSR bundles.
|
|
26
|
+
|
|
27
|
+
## Node / SSR — `@xstate-devtools/adapter/server`
|
|
28
|
+
|
|
29
|
+
Opens a local WebSocket bridge (default `ws://127.0.0.1:9301`) the debugger
|
|
30
|
+
connects to. Requires `ws`.
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { createServerAdapter } from '@xstate-devtools/adapter/server'
|
|
34
|
+
|
|
35
|
+
const adapter = createServerAdapter() // { port?, host?, bufferSize? }
|
|
36
|
+
createActor(machine, { inspect: adapter.inspect }).start()
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## React — `@xstate-devtools/adapter/react`
|
|
40
|
+
|
|
41
|
+
Requires `react` and `@xstate/react`.
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { InspectorProvider, useInspectedMachine } from '@xstate-devtools/adapter/react'
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## License
|
|
48
|
+
|
|
49
|
+
MIT
|