poveste 0.18.2 → 0.18.3
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/node/commands/port.d.ts +18 -6
- package/dist/node/commands/port.js +18 -8
- package/dist/node/server.js +14 -9
- package/package.json +5 -5
|
@@ -7,11 +7,23 @@
|
|
|
7
7
|
* neither the flag nor the mistake. A non-numeric value fails the same way.
|
|
8
8
|
*/
|
|
9
9
|
export declare function resolvePort(value: unknown, command: string): number | undefined;
|
|
10
|
+
type SocketOptions = Record<string, unknown>;
|
|
10
11
|
/**
|
|
11
|
-
* The HMR socket
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
12
|
+
* The book server's HMR socket settings: whatever the merged config asked for,
|
|
13
|
+
* minus a port or server of its own, so Vite serves the socket on the book's port
|
|
14
|
+
* and the browser dials the page's own origin. Vite takes these from `server.ws`
|
|
15
|
+
* and from the deprecated `server.hmr` alike, so both are cleared.
|
|
16
|
+
*
|
|
17
|
+
* A socket on a second port was never routed on StackBlitz, which previews each
|
|
18
|
+
* port on its own hostname, so a page opened before collection ended waited for
|
|
19
|
+
* the list on a socket that never connected, and stayed blank (#1245). It is
|
|
20
|
+
* also how `@nuxt/vite-builder`'s 24678 default made two books collide (#221).
|
|
16
21
|
*/
|
|
17
|
-
export declare function
|
|
22
|
+
export declare function socketOnBookPort(server: {
|
|
23
|
+
hmr?: unknown;
|
|
24
|
+
ws?: unknown;
|
|
25
|
+
}): {
|
|
26
|
+
hmr: SocketOptions;
|
|
27
|
+
ws: SocketOptions;
|
|
28
|
+
};
|
|
29
|
+
export {};
|
|
@@ -22,14 +22,24 @@ export function resolvePort(value, command) {
|
|
|
22
22
|
}
|
|
23
23
|
return port;
|
|
24
24
|
}
|
|
25
|
+
function withoutOwnPort(options) {
|
|
26
|
+
if (options === null || typeof options !== 'object') {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
const { port: _port, server: _server, ...rest } = options;
|
|
30
|
+
return rest;
|
|
31
|
+
}
|
|
25
32
|
/**
|
|
26
|
-
* The HMR socket
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
33
|
+
* The book server's HMR socket settings: whatever the merged config asked for,
|
|
34
|
+
* minus a port or server of its own, so Vite serves the socket on the book's port
|
|
35
|
+
* and the browser dials the page's own origin. Vite takes these from `server.ws`
|
|
36
|
+
* and from the deprecated `server.hmr` alike, so both are cleared.
|
|
37
|
+
*
|
|
38
|
+
* A socket on a second port was never routed on StackBlitz, which previews each
|
|
39
|
+
* port on its own hostname, so a page opened before collection ended waited for
|
|
40
|
+
* the list on a socket that never connected, and stayed blank (#1245). It is
|
|
41
|
+
* also how `@nuxt/vite-builder`'s 24678 default made two books collide (#221).
|
|
31
42
|
*/
|
|
32
|
-
export function
|
|
33
|
-
|
|
34
|
-
return base < 45536 ? base + 20000 : base - 20000;
|
|
43
|
+
export function socketOnBookPort(server) {
|
|
44
|
+
return { hmr: withoutOwnPort(server.hmr), ws: withoutOwnPort(server.ws) };
|
|
35
45
|
}
|
package/dist/node/server.js
CHANGED
|
@@ -2,7 +2,7 @@ import { performance } from 'node:perf_hooks';
|
|
|
2
2
|
import pc from 'picocolors';
|
|
3
3
|
import { createServer as createViteServer, mergeConfig as mergeViteConfig } from 'vite';
|
|
4
4
|
import { useCollectStories } from './collect/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { socketOnBookPort } from './commands/port.js';
|
|
6
6
|
import { useModuleLoader } from './load.js';
|
|
7
7
|
import { createMarkdownFilesWatcher, onMarkdownFileChange, onMarkdownListChange } from './markdown.js';
|
|
8
8
|
import { DevEventPluginApi, DevPluginApi } from './plugin.js';
|
|
@@ -42,14 +42,19 @@ async function startServer(ctx, options, onOpen, close) {
|
|
|
42
42
|
serverConfig.hmr = false;
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
|
-
//
|
|
46
|
-
//
|
|
47
|
-
//
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
// On the book's own port, never a second one: StackBlitz does not route
|
|
46
|
+
// it, and `@nuxt/vite-builder`'s default collides between books (#1245,
|
|
47
|
+
// #221). Post-ordered, because that default is filled in by Nuxt's own
|
|
48
|
+
// `config` hook.
|
|
49
|
+
viteConfig.plugins = [...viteConfig.plugins ?? [], {
|
|
50
|
+
name: 'poveste:socket-on-book-port',
|
|
51
|
+
config: {
|
|
52
|
+
order: 'post',
|
|
53
|
+
handler(config) {
|
|
54
|
+
config.server = { ...config.server, ...socketOnBookPort(config.server ?? {}) };
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
}];
|
|
53
58
|
if (options.open) {
|
|
54
59
|
serverConfig.open = true;
|
|
55
60
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poveste",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.18.
|
|
4
|
+
"version": "0.18.3",
|
|
5
5
|
"description": "Interactive component playgrounds for Vue, Nuxt, Svelte, SvelteKit and Quasar, plus Solid (renderer only) — a drop-in fork of histoire, with Quasar support histoire does not ship.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Sorin Gitlan",
|
|
@@ -77,10 +77,10 @@
|
|
|
77
77
|
},
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@11ty/gray-matter": "^3.0.0",
|
|
80
|
-
"@poveste/app": "^0.18.
|
|
81
|
-
"@poveste/controls": "^0.18.
|
|
82
|
-
"@poveste/shared": "^0.18.
|
|
83
|
-
"@poveste/vendors": "^0.18.
|
|
80
|
+
"@poveste/app": "^0.18.3",
|
|
81
|
+
"@poveste/controls": "^0.18.3",
|
|
82
|
+
"@poveste/shared": "^0.18.3",
|
|
83
|
+
"@poveste/vendors": "^0.18.3",
|
|
84
84
|
"change-case": "^5.4.4",
|
|
85
85
|
"chokidar": "^5.0.0",
|
|
86
86
|
"defu": "^6.1.4",
|