Gathering detailed insights and metrics for @xstate/inspect
Gathering detailed insights and metrics for @xstate/inspect
Gathering detailed insights and metrics for @xstate/inspect
Gathering detailed insights and metrics for @xstate/inspect
expo-xstate-inspect
Inspect your xstate machines
flipper-plugin-react-native-xstate-inspect
xstate-inspect-cli
I wanted a quick way to open an `@xstate/inspect` panel targeting a local file. By running a quick CLI command, you can target a single file with `vite`, build it with `esbuild`, and open it in the browser.
storybook-xstate-addon
Storybook addon for displaying xstate inspector inside storybook
Actor-based state management & orchestration for complex app logic.
npm install @xstate/inspect
Typescript
Module System
Node Version
NPM Version
98.5
Supply Chain
99.6
Quality
80
Maintenance
100
Vulnerability
100
License
@xstate/store@3.8.0
Updated on Jun 29, 2025
@xstate/store@3.7.1
Updated on Jun 26, 2025
@xstate/store@3.7.0
Updated on Jun 21, 2025
@xstate/react@6.0.0
Updated on Jun 19, 2025
@xstate/vue@5.0.0
Updated on Jun 19, 2025
@xstate/svelte@5.0.0
Updated on Jun 19, 2025
TypeScript (97.98%)
Vue (0.78%)
JavaScript (0.48%)
Svelte (0.42%)
CSS (0.26%)
HTML (0.08%)
Total Downloads
21,104,050
Last Day
3,817
Last Week
149,806
Last Month
650,321
Last Year
6,380,923
MIT License
28,421 Stars
6,806 Commits
1,315 Forks
191 Watchers
296 Branches
346 Contributors
Updated on Jul 04, 2025
Minified
Minified + Gzipped
Latest Version
0.8.0
Package Id
@xstate/inspect@0.8.0
Unpacked Size
70.56 kB
Size
13.32 kB
File Count
30
NPM Version
8.19.3
Node Version
16.19.1
Published on
Mar 02, 2023
Cumulative downloads
Total Downloads
1
This package contains inspection tools for XState.
Check out the XState + Vue Minute Timer + Viz example on CodeSandbox
1npm install @xstate/inspect 2# or yarn add @xstate/inspect
Via CDN
1<script src="https://unpkg.com/@xstate/inspect/dist/xstate-inspect.umd.min.js"></script>
By using the global variable XStateInspect
1import { inspect } from '@xstate/inspect'; 2 3inspect({ 4 // options 5 // url: 'https://stately.ai/viz?inspect', // (default) 6 iframe: false // open in new window 7});
{ devTools: true }
to any interpreted machines you want to visualize:1import { interpret } from 'xstate'; 2import { inspect } from '@xstate/inspect'; 3// ... 4 5const service = interpret(someMachine, { devTools: true }); 6service.start();
url
(optional) - The endpoint that the Inspector sends events to. Default: https://stately.ai/viz?inspectiframe
(optional) - The iframe that loads the provided URL. If iframe is set to false
, then a new tab is opened instead.devTools
(optional) - Allows custom implementation for lifecycle hooks.serialize
(optional) - A custom serializer for messages sent to the URL endpoint. Useful for sanitizing sensitive information, such as credentials, from leaving your application.targetWindow
(optional) - Provide a pre-existing window location that will be used instead of opening a new window etc. When using this option, you must still provide the url
value due to security checks in browser APIs, and the iframe
option is ignored in such a case.When is this useful?
credentials
1// Remove credentials from being forwarded 2inspect({ 3 serialize: (key: string, value: any) => { 4 return key === "credentials" && typeof value === "object" ? {} : value; 5 }, 6}); 7 8// Add a custom local log 9inspect({ 10 serialize: (key: string, value: any) => { 11 if (key === "ready") { 12 console.log("Detected ready key"); 13 } 14 return value; 15 }, 16});
When is this useful?
console.log
statements to your machine definitions1// The URL and port of your local project (ex. Vite, Webpack, etc). 2const url = "http://127.0.0.1:5174/" 3 4const inspector = inspect({ 5 url, 6 iframe: undefined, 7 targetWindow: window 8}); 9 10// In the same window, subsribe to messages from @xstate/inspector 11createWindowReceiver({}).subscribe(console.log); 12 13// Start your machine, and all events generated are logged to the console 14interpret(machine, { devTools: true }).start({}); 15
When is this useful?
1// In your client application 2const url = "http://127.0.0.1:8443/" 3const targetWindow = window.open(url); 4 5const inspector = inspect({ 6 // The URL must still be provided. This is used by postMessage, as it's 7 // not possible to do targetWindow.location for security reasons 8 url, 9 targetWindow 10}); 11 12 13// In the second, hosted application 14createWindowReceiver({}).subscribe((event) => { 15 if (event.type === "service.register") { 16 // Do something when a new machine is started 17 18 } else if (event.type === "service.stop") { 19 // Do something when a machine enters a terminal state 20 21 } else if (event.type === "service.event") { 22 // Do something when a machine recieves an event 23 24 } else if (event.type === "service.state") { 25 // Do something when a machine enters to a new state 26 // Note: Does not handle transitional states. 27 } 28});
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
30 commit(s) and 9 issue activity found in the last 90 days -- score normalized to 10
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 17/20 approved changesets -- score normalized to 8
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
101 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreLast Day
88.3%
3,817
Compared to previous day
Last Week
-12.8%
149,806
Compared to previous week
Last Month
4.5%
650,321
Compared to previous month
Last Year
5.8%
6,380,923
Compared to previous year