@onlook/storybook-plugin 0.3.2-beta.1 → 0.3.2-beta.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.
package/dist/index.d.ts CHANGED
@@ -7,12 +7,17 @@ type OnlookPluginOptions = {
7
7
  /** Additional allowed origins for CORS (merged with defaults) */
8
8
  allowedOrigins?: string[];
9
9
  /**
10
- * Set when this plugin runs inside an E2B sandbox. Enables the
11
- * WSS:443 HMR override required for Vite's HMR client to talk back
12
- * through E2B's HTTPS port-proxy. Leave false (default) for local
13
- * `bun dev:storybook` so HMR uses Vite defaults and actually fires.
10
+ * Override Vite's HMR client config. Set when Storybook is fronted by
11
+ * an HTTPS reverse proxy (sandbox runtime, ngrok, Cloudflare tunnel,
12
+ * etc.) so the in-page HMR client connects via WSS on the public port
13
+ * instead of `ws://localhost:<port>`. Plugin fills in the internal
14
+ * `port` so callers only specify what changes (`protocol`, `clientPort`).
15
+ * Leave undefined locally so Vite defaults apply and HMR fires.
14
16
  */
15
- e2b?: boolean;
17
+ hmr?: {
18
+ protocol?: 'ws' | 'wss';
19
+ clientPort?: number;
20
+ };
16
21
  };
17
22
  declare function storybookOnlookPlugin(options?: OnlookPluginOptions): PluginOption[];
18
23
 
package/dist/index.js CHANGED
@@ -17191,27 +17191,26 @@ function storybookOnlookPlugin(options = {}) {
17191
17191
  }
17192
17192
  const port = options.port ?? 6006;
17193
17193
  const allowedOrigins = [...DEFAULT_ALLOWED_ORIGINS, ...options.allowedOrigins ?? []];
17194
- const isE2B = options.e2b === true;
17194
+ const hmrOverride = options.hmr;
17195
17195
  console.log("[STORYBOOK_PLUGIN] Plugin initialized", {
17196
17196
  port,
17197
17197
  allowedOrigins,
17198
17198
  storybookLocation,
17199
17199
  repoRoot,
17200
- e2b: isE2B
17200
+ hmr: hmrOverride ?? null
17201
17201
  });
17202
17202
  const mainPlugin = {
17203
17203
  name: "storybook-onlook-plugin",
17204
17204
  config() {
17205
17205
  return {
17206
17206
  server: {
17207
- // HMR override only applies inside E2B sandboxes they front
17208
- // Storybook over HTTPS:443, so the Vite HMR client must connect
17209
- // via WSS:443. Locally, omitting this lets Vite use defaults
17207
+ // HMR override applies only when the caller explicitly opts in
17208
+ // (typically: Storybook fronted over HTTPS by a reverse proxy).
17209
+ // Locally, omitting this lets Vite use defaults
17210
17210
  // (ws://localhost:<port>) and HMR works as expected.
17211
- ...isE2B && {
17211
+ ...hmrOverride && {
17212
17212
  hmr: {
17213
- protocol: "wss",
17214
- clientPort: 443,
17213
+ ...hmrOverride,
17215
17214
  port
17216
17215
  }
17217
17216
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlook/storybook-plugin",
3
- "version": "0.3.2-beta.1",
3
+ "version": "0.3.2-beta.2",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "onlook-storybook": "./dist/cli/index.js"