devframe 0.6.0 → 0.6.1
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/adapters/cli.mjs +1 -1
- package/dist/adapters/dev.mjs +1 -1
- package/dist/{dev-zC5542OV.mjs → dev-DE51PeJc.mjs} +2 -2
- package/dist/helpers/vite.mjs +1 -1
- package/dist/node/index.d.mts +5 -1
- package/dist/node/index.mjs +2 -11
- package/dist/{server-CAsvfJNK.mjs → server-CRFYfRqK.mjs} +29 -3
- package/package.json +1 -1
package/dist/adapters/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
|
|
2
2
|
import { createBuild } from "./build.mjs";
|
|
3
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
3
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-DE51PeJc.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import cac from "cac";
|
|
6
6
|
import { safeParse } from "valibot";
|
package/dist/adapters/dev.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
1
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-DE51PeJc.mjs";
|
|
2
2
|
export { createDevServer, resolveDevServerPort };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
|
|
2
2
|
import { a as diagnostics } from "./storage-yrUZaiib.mjs";
|
|
3
3
|
import { n as createHostContext, t as createH3DevframeHost } from "./host-h3-Dsf-Tgwx.mjs";
|
|
4
|
-
import { t as startHttpAndWs } from "./server-
|
|
4
|
+
import { i as normalizeHttpServerUrl, t as startHttpAndWs } from "./server-CRFYfRqK.mjs";
|
|
5
5
|
import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-bWRzeSa0.mjs";
|
|
6
6
|
import { t as open } from "./open-Deb5xmIT.mjs";
|
|
7
7
|
import { mountStaticHandler } from "./utils/serve-static.mjs";
|
|
@@ -272,7 +272,7 @@ async function createDevServer(def, options = {}) {
|
|
|
272
272
|
const basePath = options.basePath ? normalizeBasePath(options.basePath) : resolveBasePath(def, "standalone");
|
|
273
273
|
const app = options.app ?? new H3();
|
|
274
274
|
const h3Host = createH3DevframeHost({
|
|
275
|
-
origin:
|
|
275
|
+
origin: normalizeHttpServerUrl(host, port),
|
|
276
276
|
appName: def.id,
|
|
277
277
|
mount: (base, dir) => {
|
|
278
278
|
mountStaticHandler(app, base, dir);
|
package/dist/helpers/vite.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_WS_ROUTE } from "../constan
|
|
|
2
2
|
import { a as diagnostics } from "../storage-yrUZaiib.mjs";
|
|
3
3
|
import { n as resolveBasePath, t as normalizeBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
4
4
|
import { serveStaticNodeMiddleware } from "../utils/serve-static.mjs";
|
|
5
|
-
import { n as resolveDevServerPort, t as createDevServer } from "../dev-
|
|
5
|
+
import { n as resolveDevServerPort, t as createDevServer } from "../dev-DE51PeJc.mjs";
|
|
6
6
|
import { resolve } from "pathe";
|
|
7
7
|
//#region src/helpers/vite.ts
|
|
8
8
|
/**
|
package/dist/node/index.d.mts
CHANGED
|
@@ -183,6 +183,10 @@ declare function createStorage<T extends object>(options: CreateStorageOptions<T
|
|
|
183
183
|
//#endregion
|
|
184
184
|
//#region src/node/utils.d.ts
|
|
185
185
|
declare function isObject(value: unknown): value is Record<string, any>;
|
|
186
|
+
/** Map a bind host to a host a client can actually connect to. */
|
|
187
|
+
declare function toDialableHost(host: string): string;
|
|
188
|
+
/** Format a bind host for use in a URL authority (dialable, IPv6-bracketed). */
|
|
189
|
+
declare function formatHostForUrl(host: string): string;
|
|
186
190
|
declare function normalizeHttpServerUrl(host: string, port: number | string): string;
|
|
187
191
|
//#endregion
|
|
188
|
-
export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, isObject, normalizeHttpServerUrl, startHttpAndWs };
|
|
192
|
+
export { CreateH3DevframeHostOptions, CreateHostContextOptions, CreateStorageOptions, DevframeAgentHost, DevframeDiagnosticsHost, DevframeViewHost, RpcFunctionsHost, StartHttpAndWsOptions, StartedServer, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import { t as createStorage } from "../storage-yrUZaiib.mjs";
|
|
2
2
|
import { a as DevframeViewHost, c as createRpcSharedStateServerHost, i as createNodeSettings, l as DevframeDiagnosticsHost, n as createHostContext, o as RpcFunctionsHost, r as createScopedNodeContext, s as createRpcStreamingServerHost, t as createH3DevframeHost, u as DevframeAgentHost } from "../host-h3-Dsf-Tgwx.mjs";
|
|
3
|
-
import { t as startHttpAndWs } from "../server-
|
|
4
|
-
|
|
5
|
-
//#region src/node/utils.ts
|
|
6
|
-
function isObject(value) {
|
|
7
|
-
return Object.prototype.toString.call(value) === "[object Object]";
|
|
8
|
-
}
|
|
9
|
-
function normalizeHttpServerUrl(host, port) {
|
|
10
|
-
return `http://${host === "127.0.0.1" ? "localhost" : isIP(host) === 6 ? `[${host}]` : host}:${port}`;
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeViewHost, RpcFunctionsHost, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, isObject, normalizeHttpServerUrl, startHttpAndWs };
|
|
3
|
+
import { a as toDialableHost, i as normalizeHttpServerUrl, n as formatHostForUrl, r as isObject, t as startHttpAndWs } from "../server-CRFYfRqK.mjs";
|
|
4
|
+
export { DevframeAgentHost, DevframeDiagnosticsHost, DevframeViewHost, RpcFunctionsHost, createH3DevframeHost, createHostContext, createNodeSettings, createRpcSharedStateServerHost, createRpcStreamingServerHost, createScopedNodeContext, createStorage, formatHostForUrl, isObject, normalizeHttpServerUrl, startHttpAndWs, toDialableHost };
|
|
@@ -5,6 +5,31 @@ import { t as getInternalContext } from "./context-CKJheEtf.mjs";
|
|
|
5
5
|
import { createServer } from "node:http";
|
|
6
6
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
7
7
|
import { H3, toNodeHandler } from "h3";
|
|
8
|
+
import { isIP } from "node:net";
|
|
9
|
+
//#region src/node/utils.ts
|
|
10
|
+
function isObject(value) {
|
|
11
|
+
return Object.prototype.toString.call(value) === "[object Object]";
|
|
12
|
+
}
|
|
13
|
+
const NON_DIALABLE_HOSTS = /* @__PURE__ */ new Set([
|
|
14
|
+
"0.0.0.0",
|
|
15
|
+
"127.0.0.1",
|
|
16
|
+
"::",
|
|
17
|
+
"0000:0000:0000:0000:0000:0000:0000:0000",
|
|
18
|
+
""
|
|
19
|
+
]);
|
|
20
|
+
/** Map a bind host to a host a client can actually connect to. */
|
|
21
|
+
function toDialableHost(host) {
|
|
22
|
+
return NON_DIALABLE_HOSTS.has(host) ? "localhost" : host;
|
|
23
|
+
}
|
|
24
|
+
/** Format a bind host for use in a URL authority (dialable, IPv6-bracketed). */
|
|
25
|
+
function formatHostForUrl(host) {
|
|
26
|
+
const dialable = toDialableHost(host);
|
|
27
|
+
return isIP(dialable) === 6 ? `[${dialable}]` : dialable;
|
|
28
|
+
}
|
|
29
|
+
function normalizeHttpServerUrl(host, port) {
|
|
30
|
+
return `http://${formatHostForUrl(host)}:${port}`;
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
8
33
|
//#region src/node/server.ts
|
|
9
34
|
/**
|
|
10
35
|
* Compose an h3 + WebSocket server for a devframe context. The RPC
|
|
@@ -83,9 +108,10 @@ async function startHttpAndWs(options) {
|
|
|
83
108
|
});
|
|
84
109
|
const address = httpServer.address();
|
|
85
110
|
const resolvedPort = typeof address === "object" && address ? address.port : port;
|
|
86
|
-
const origin =
|
|
111
|
+
const origin = normalizeHttpServerUrl(bindHost, resolvedPort);
|
|
87
112
|
const internal = getInternalContext(context);
|
|
88
|
-
const
|
|
113
|
+
const wsPortForUrl = separateWsPort ?? resolvedPort;
|
|
114
|
+
const wsUrl = `ws://${formatHostForUrl(bindHost)}:${wsPortForUrl}${options.path ?? ""}`;
|
|
89
115
|
internal.wsEndpoint = { url: wsUrl };
|
|
90
116
|
if (options.onReady) await options.onReady({
|
|
91
117
|
origin,
|
|
@@ -119,4 +145,4 @@ async function startHttpAndWs(options) {
|
|
|
119
145
|
};
|
|
120
146
|
}
|
|
121
147
|
//#endregion
|
|
122
|
-
export { startHttpAndWs as t };
|
|
148
|
+
export { toDialableHost as a, normalizeHttpServerUrl as i, formatHostForUrl as n, isObject as r, startHttpAndWs as t };
|