@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 +10 -5
- package/dist/index.js +7 -8
- package/package.json +1 -1
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
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
|
17208
|
-
// Storybook over HTTPS
|
|
17209
|
-
//
|
|
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
|
-
...
|
|
17211
|
+
...hmrOverride && {
|
|
17212
17212
|
hmr: {
|
|
17213
|
-
|
|
17214
|
-
clientPort: 443,
|
|
17213
|
+
...hmrOverride,
|
|
17215
17214
|
port
|
|
17216
17215
|
}
|
|
17217
17216
|
},
|