@onlook/storybook-plugin 0.3.0 → 0.3.2

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 (3) hide show
  1. package/README.md +7 -10
  2. package/dist/index.js +16 -9
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -57,20 +57,17 @@ storybookOnlookPlugin({
57
57
 
58
58
  ## CLI
59
59
 
60
- Generate screenshots for all stories:
60
+ The binary is named `onlook-storybook`. Since it differs from the package name, use `-p` with `bunx`:
61
61
 
62
62
  ```bash
63
- # With Storybook already running
64
- npx generate-screenshots
63
+ # bun
64
+ bunx -p @onlook/storybook-plugin onlook-storybook generate-screenshots
65
65
 
66
- # Start Storybook automatically
67
- npx generate-screenshots --start
66
+ # npm
67
+ npx onlook-storybook generate-screenshots
68
68
 
69
- # Custom Storybook URL
70
- npx generate-screenshots --url http://localhost:9009
71
-
72
- # Custom start command
73
- npx generate-screenshots --start --cmd "bun run storybook"
69
+ # With options
70
+ bunx -p @onlook/storybook-plugin onlook-storybook generate-screenshots -c 10 -t 30000
74
71
  ```
75
72
 
76
73
  Screenshots are saved to `.storybook-cache/screenshots/`.
package/dist/index.js CHANGED
@@ -496,16 +496,17 @@ function storybookOnlookPlugin(options = {}) {
496
496
  const mainPlugin = {
497
497
  name: "storybook-onlook-plugin",
498
498
  config() {
499
+ const isE2B = !!process.env.E2B_SANDBOX;
499
500
  return {
500
501
  server: {
501
- // E2B sandbox HMR configuration
502
- hmr: {
503
- // E2B sandboxes use HTTPS, so we need secure WebSocket
504
- protocol: "wss",
505
- // E2B routes through standard HTTPS port 443
506
- clientPort: 443,
507
- // The actual Storybook server port inside the sandbox
508
- port
502
+ // Only override HMR for E2B sandboxes (wss + port 443)
503
+ // Local dev uses Vite's default HMR which works out of the box
504
+ ...isE2B && {
505
+ hmr: {
506
+ protocol: "wss",
507
+ clientPort: 443,
508
+ port
509
+ }
509
510
  },
510
511
  cors: {
511
512
  origin: allowedOrigins
@@ -527,7 +528,13 @@ function storybookOnlookPlugin(options = {}) {
527
528
  console.log("[STORYBOOK_PLUGIN] Configuring preview server middleware");
528
529
  server.middlewares.use(serveMetadataAndScreenshots);
529
530
  },
530
- handleHotUpdate: handleStoryFileChange
531
+ // Only auto-regenerate screenshots in E2B sandboxes where Onbook
532
+ // consumes them. In local dev this blocks HMR with 36 Playwright
533
+ // page loads per save. Screenshots are still available on-demand
534
+ // via /api/capture-screenshot and the CLI.
535
+ ...process.env.E2B_SANDBOX && {
536
+ handleHotUpdate: handleStoryFileChange
537
+ }
531
538
  };
532
539
  return [componentLocPlugin(), mainPlugin];
533
540
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlook/storybook-plugin",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "onlook-storybook": "./dist/cli/index.js"
@@ -8,15 +8,15 @@
8
8
  "exports": {
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
- "import": "./dist/index.js"
11
+ "default": "./dist/index.js"
12
12
  },
13
13
  "./screenshot-service": {
14
14
  "types": "./dist/screenshot-service/index.d.ts",
15
- "import": "./dist/screenshot-service/index.js"
15
+ "default": "./dist/screenshot-service/index.js"
16
16
  },
17
17
  "./screenshot-service/browser": {
18
18
  "types": "./dist/screenshot-service/utils/browser/index.d.ts",
19
- "import": "./dist/screenshot-service/utils/browser/index.js"
19
+ "default": "./dist/screenshot-service/utils/browser/index.js"
20
20
  }
21
21
  },
22
22
  "files": [