devframe 0.7.3 → 0.7.5
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/build.d.mts +1 -1
- package/dist/adapters/build.mjs +1 -1
- package/dist/adapters/cac.d.mts +1 -1
- package/dist/adapters/cac.mjs +1 -1
- package/dist/adapters/cli.d.mts +1 -1
- package/dist/adapters/cli.mjs +1 -1
- package/dist/adapters/dev.d.mts +2 -2
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +1 -1
- package/dist/adapters/mcp.mjs +1 -1
- package/dist/{build-server-Bo0G5XcS.mjs → build-server-D5-9okV6.mjs} +7 -3
- package/dist/{cac-BFCgKymz.mjs → cac-Dr-qCdgQ.mjs} +2 -2
- package/dist/client/index.d.mts +18 -2
- package/dist/client/index.mjs +27 -4
- package/dist/{context-CKJheEtf.mjs → context-ClRdkpJ7.mjs} +1 -1
- package/dist/{context-B1sekkgB.d.mts → context-DxFsOWkc.d.mts} +1 -1
- package/dist/{dev-Bs4oRVnI.mjs → dev-D6Hcv4v8.mjs} +20 -7
- package/dist/{devframe-CnTVuGw9.d.mts → devframe-WHtcqYlZ.d.mts} +705 -554
- package/dist/helpers/vite.d.mts +1 -1
- package/dist/helpers/vite.mjs +2 -2
- package/dist/{host-h3-Dsf-Tgwx.mjs → host-h3-A8CXZoS5.mjs} +62 -6
- package/dist/{http-BirzlyE9.mjs → http-Fxm-0_V7.mjs} +1 -1
- package/dist/{index-Dpsr-8dD.d.mts → index-Cj0M3G3F.d.mts} +3 -47
- package/dist/index.d.mts +3 -3
- package/dist/node/auth.d.mts +2 -1
- package/dist/node/hub-internals.d.mts +2 -2
- package/dist/node/hub-internals.mjs +1 -1
- package/dist/node/index.d.mts +25 -33
- package/dist/node/index.mjs +4 -4
- package/dist/recipes/interactive-auth.d.mts +2 -2
- package/dist/recipes/interactive-auth.mjs +1 -1
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/{server-4QH37sb-.d.mts → server-BRxA2OAh.d.mts} +3 -3
- package/dist/{server-CRFYfRqK.mjs → server-DvrOR1LG.mjs} +2 -2
- package/dist/{storage-yrUZaiib.mjs → storage-E9KrCsLr.mjs} +4 -0
- package/dist/types/index.d.mts +3 -3
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/serve-static.d.mts +4 -6
- package/dist/utils/serve-static.mjs +8 -14
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/{ws-server-CceOy6He.d.mts → ws-server-9-wn7MNQ.d.mts} +1 -1
- package/package.json +2 -2
package/dist/adapters/build.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { n as colors } from "../diagnostics-reporter-CsIG85Q5.mjs";
|
|
|
3
3
|
import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_RPC_DUMP_DIRNAME, DEVFRAME_RPC_DUMP_MANIFEST_FILENAME } from "../constants.mjs";
|
|
4
4
|
import { n as strictJsonStringify } from "../serialization-DpLXCy13.mjs";
|
|
5
5
|
import { n as structuredCloneStringify } from "../structured-clone-XpHLZ8nr.mjs";
|
|
6
|
-
import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-
|
|
6
|
+
import { n as createHostContext, t as createH3DevframeHost } from "../host-h3-A8CXZoS5.mjs";
|
|
7
7
|
import { n as resolveBasePath } from "../_shared-bWRzeSa0.mjs";
|
|
8
8
|
import { existsSync } from "node:fs";
|
|
9
9
|
import { dirname, resolve } from "pathe";
|
package/dist/adapters/cac.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as InferCliFlags, Nt as defineCliFlags, Pt as parseCliFlags, jt as CliFlagsSchema, r as DevframeDefinition } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
import { CAC } from "cac";
|
|
3
3
|
import { H3 } from "h3";
|
|
4
4
|
//#region src/adapters/cac.d.ts
|
package/dist/adapters/cac.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-
|
|
1
|
+
import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-Dr-qCdgQ.mjs";
|
|
2
2
|
export { createCac, defineCliFlags, parseCliFlags };
|
package/dist/adapters/cli.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Mt as InferCliFlags, Nt as defineCliFlags, Pt as parseCliFlags, jt as CliFlagsSchema } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
import { CacHandle, CreateCacOptions, createCac } from "./cac.mjs";
|
|
3
3
|
//#region src/adapters/cli.d.ts
|
|
4
4
|
/** @deprecated Use `createCac` from `devframe/adapters/cac` instead. */
|
package/dist/adapters/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-
|
|
1
|
+
import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-Dr-qCdgQ.mjs";
|
|
2
2
|
//#region src/adapters/cli.ts
|
|
3
3
|
/** @deprecated Use `createCac` from `devframe/adapters/cac` instead. */
|
|
4
4
|
const createCli = createCac;
|
package/dist/adapters/dev.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as McpRouteOptions, r as DevframeDefinition, u as DevframeWsOptions } from "../devframe-
|
|
2
|
-
import { n as StartedServer } from "../server-
|
|
1
|
+
import { d as McpRouteOptions, r as DevframeDefinition, u as DevframeWsOptions } from "../devframe-WHtcqYlZ.mjs";
|
|
2
|
+
import { n as StartedServer } from "../server-BRxA2OAh.mjs";
|
|
3
3
|
import { H3 } from "h3";
|
|
4
4
|
//#region src/adapters/dev.d.ts
|
|
5
5
|
interface CreateDevServerOptions {
|
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-D6Hcv4v8.mjs";
|
|
2
2
|
export { createDevServer, resolveDevServerPort };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as DevframeNodeContext, r as DevframeDefinition } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
//#region src/adapters/embedded.d.ts
|
|
3
3
|
interface CreateEmbeddedOptions {
|
|
4
4
|
/** Target context the devframe is registered into. Required. */
|
package/dist/adapters/mcp.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as DevframeDefinition } from "../devframe-
|
|
1
|
+
import { r as DevframeDefinition } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
import "@modelcontextprotocol/sdk/server/index.js";
|
|
3
3
|
//#region src/adapters/mcp/build-server.d.ts
|
|
4
4
|
interface CreateMcpServerOptions {
|
package/dist/adapters/mcp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as createMcpServer } from "../build-server-
|
|
1
|
+
import { n as createMcpServer } from "../build-server-D5-9okV6.mjs";
|
|
2
2
|
export { createMcpServer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as diagnostics } from "./storage-
|
|
2
|
-
import { n as createHostContext } from "./host-h3-
|
|
1
|
+
import { a as diagnostics } from "./storage-E9KrCsLr.mjs";
|
|
2
|
+
import { n as createHostContext } from "./host-h3-A8CXZoS5.mjs";
|
|
3
3
|
import { join } from "pathe";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import { homedir } from "node:os";
|
|
@@ -195,7 +195,11 @@ async function createMcpServer(definition, options = {}) {
|
|
|
195
195
|
host: {
|
|
196
196
|
mountStatic: () => {},
|
|
197
197
|
resolveOrigin: () => "mcp://devframe",
|
|
198
|
-
getStorageDir: (scope) =>
|
|
198
|
+
getStorageDir: (scope) => {
|
|
199
|
+
if (scope === "workspace") return join(process.cwd(), ".devframe");
|
|
200
|
+
if (scope === "project") return join(process.cwd(), `node_modules/.${definition.id}/devframe`);
|
|
201
|
+
return join(homedir(), `.${definition.id}/devframe`);
|
|
202
|
+
}
|
|
199
203
|
}
|
|
200
204
|
});
|
|
201
205
|
await definition.setup(ctx);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as colors } from "./diagnostics-reporter-CsIG85Q5.mjs";
|
|
2
2
|
import { createBuild } from "./adapters/build.mjs";
|
|
3
|
-
import { n as resolveDevServerPort, t as createDevServer } from "./dev-
|
|
3
|
+
import { n as resolveDevServerPort, t as createDevServer } from "./dev-D6Hcv4v8.mjs";
|
|
4
4
|
import process from "node:process";
|
|
5
5
|
import cac from "cac";
|
|
6
6
|
import { safeParse } from "valibot";
|
|
@@ -88,7 +88,7 @@ function createCac(d, options = {}) {
|
|
|
88
88
|
const defaultPort = options.defaultPort ?? d.cli?.port ?? 9999;
|
|
89
89
|
const defaultHost = d.cli?.host ?? "localhost";
|
|
90
90
|
const cli = cac(d.cli?.command ?? d.id);
|
|
91
|
-
const devCommand = cli.command("[...args]", "Start a local dev server").option("--port <port>", "Port to listen on").option("--host <host>", "Host to bind to", { default: defaultHost }).option("--open", "Open the browser on start").option("--no-open", "Do not open the browser").option("--mcp", "Expose an MCP server over HTTP at /__mcp (use --no-mcp to disable) [experimental]");
|
|
91
|
+
const devCommand = cli.command("[...args]", "Start a local dev server").option("--port <port>", "Port to listen on").option("--host <host>", "Host to bind to", { default: defaultHost }).option("--open", "Open the browser on start").option("--no-open", "Do not open the browser").option("--no-auth", "Disable the interactive authentication gate").option("--mcp", "Expose an MCP server over HTTP at /__mcp (use --no-mcp to disable) [experimental]");
|
|
92
92
|
if (d.cli?.flags) for (const [key, schema] of Object.entries(d.cli.flags)) {
|
|
93
93
|
const optionName = flagKeyToOption(key);
|
|
94
94
|
const description = schema.description ?? "";
|
package/dist/client/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { F as SettingsForNamespace, K as RpcSharedStateGetOptions, N as ScopedServerFunctions, O as DevframeSettings, Ot as EventEmitter, P as ScopedSharedStates, Q as DevframeRpcServerFunctions, Z as DevframeRpcClientFunctions, _ as ConnectionMeta, at as StreamSink, it as StreamReader, mt as SharedState, q as RpcSharedStateHost } from "../devframe-WHtcqYlZ.mjs";
|
|
2
2
|
import { _ as RpcFunctionDefinition, w as RpcFunctionsCollector } from "../types-CrzNxXKq.mjs";
|
|
3
3
|
import { C as RpcCacheManager, w as RpcCacheOptions } from "../index-DgsLFhZg.mjs";
|
|
4
4
|
import { t as WsRpcChannelOptions } from "../ws-client-DSXiI2h7.mjs";
|
|
@@ -195,9 +195,25 @@ interface DevframeRpcClientOptions {
|
|
|
195
195
|
* (OTP) for "magic link" auth (e.g. a link the dev server prints). When
|
|
196
196
|
* present, the client exchanges the code for a token and removes the parameter
|
|
197
197
|
* from the URL. Set `false` to disable — e.g. integrations that drive their
|
|
198
|
-
* own authentication via `authenticateWithUrlOtp`.
|
|
198
|
+
* own authentication via `authenticateWithUrlOtp`.
|
|
199
|
+
*
|
|
200
|
+
* @default 'devframe_otp'
|
|
199
201
|
*/
|
|
200
202
|
otpParam?: string | false;
|
|
203
|
+
/**
|
|
204
|
+
* Fall back to a native browser `prompt()` for the one-time authentication
|
|
205
|
+
* code when the server refuses trust and no other credential succeeds (a
|
|
206
|
+
* stored token, an injected token, or a magic-link OTP). The prompt fires
|
|
207
|
+
* only on a **top-level, unframed** page — a framed plugin (e.g. mounted in
|
|
208
|
+
* a hub dock) never prompts, since a hub pre-authorizes it and browsers
|
|
209
|
+
* block `prompt()` in cross-origin frames anyway.
|
|
210
|
+
*
|
|
211
|
+
* Set `false` to drive your own auth UI (a hub sets this on the plugin
|
|
212
|
+
* connections it manages, alongside supplying the token).
|
|
213
|
+
*
|
|
214
|
+
* @default true
|
|
215
|
+
*/
|
|
216
|
+
simpleAuth?: boolean;
|
|
201
217
|
wsOptions?: Partial<WsRpcChannelOptions>;
|
|
202
218
|
rpcOptions?: Partial<BirpcOptions<DevframeRpcServerFunctions, DevframeRpcClientFunctions, boolean>>;
|
|
203
219
|
cacheOptions?: boolean | Partial<RpcCacheOptions>;
|
package/dist/client/index.mjs
CHANGED
|
@@ -2269,7 +2269,7 @@ async function getDevframeRpcClient(options = {}) {
|
|
|
2269
2269
|
...typeof options.cacheOptions === "object" ? options.cacheOptions : {}
|
|
2270
2270
|
});
|
|
2271
2271
|
const context = { rpc: void 0 };
|
|
2272
|
-
const authToken = getStoredAuthToken(options.authToken);
|
|
2272
|
+
const authToken = getStoredAuthToken(options.authToken || connectionMeta.authToken);
|
|
2273
2273
|
if (authToken) persistAuthToken(authToken);
|
|
2274
2274
|
const clientRpc = new RpcFunctionsCollectorBase(context);
|
|
2275
2275
|
async function fetchJsonFromBases(path) {
|
|
@@ -2361,9 +2361,32 @@ async function getDevframeRpcClient(options = {}) {
|
|
|
2361
2361
|
return scoped;
|
|
2362
2362
|
});
|
|
2363
2363
|
context.rpc = rpc;
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2364
|
+
function isTopLevelUnframed() {
|
|
2365
|
+
try {
|
|
2366
|
+
return typeof window !== "undefined" && window.self === window.top;
|
|
2367
|
+
} catch {
|
|
2368
|
+
return false;
|
|
2369
|
+
}
|
|
2370
|
+
}
|
|
2371
|
+
async function runSimpleAuthPrompt() {
|
|
2372
|
+
if (options.simpleAuth === false || !isTopLevelUnframed()) return;
|
|
2373
|
+
if (typeof globalThis.prompt !== "function") return;
|
|
2374
|
+
while (!rpc.isTrusted) {
|
|
2375
|
+
const code = globalThis.prompt("devframe: enter the authentication code shown in your terminal");
|
|
2376
|
+
if (code == null) return;
|
|
2377
|
+
const trimmed = code.trim();
|
|
2378
|
+
if (!trimmed) continue;
|
|
2379
|
+
if (await rpc.requestTrustWithCode(trimmed)) return;
|
|
2380
|
+
}
|
|
2381
|
+
}
|
|
2382
|
+
async function bootstrapAuth() {
|
|
2383
|
+
const trusted = await mode.requestTrust();
|
|
2384
|
+
const otpParam = options.otpParam ?? "devframe_otp";
|
|
2385
|
+
const viaOtp = otpParam ? await authenticateWithUrlOtp(rpc, { param: otpParam }) : false;
|
|
2386
|
+
if (trusted || viaOtp || rpc.isTrusted) return;
|
|
2387
|
+
await runSimpleAuthPrompt();
|
|
2388
|
+
}
|
|
2389
|
+
bootstrapAuth();
|
|
2367
2390
|
if (authChannel) authChannel.onmessage = (event) => {
|
|
2368
2391
|
if (event.data?.type === "auth-update" && event.data.authToken) rpc.requestTrustWithToken(event.data.authToken);
|
|
2369
2392
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createStorage } from "./storage-
|
|
1
|
+
import { t as createStorage } from "./storage-E9KrCsLr.mjs";
|
|
2
2
|
import { i as randomToken, n as revokeAuthToken, t as revokeActiveConnectionsForToken } from "./revoke-BtQDKTp7.mjs";
|
|
3
3
|
import { join } from "pathe";
|
|
4
4
|
//#region src/node/hub-internals/context.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as DevframeNodeContext, mt as SharedState } from "./devframe-WHtcqYlZ.mjs";
|
|
2
2
|
//#region src/node/hub-internals/context.d.ts
|
|
3
3
|
interface InternalAnonymousAuthStorage {
|
|
4
4
|
trusted: Record<string, {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { DEVFRAME_CONNECTION_META_FILENAME } from "./constants.mjs";
|
|
2
|
-
import { a as diagnostics } from "./storage-
|
|
3
|
-
import { n as createHostContext, t as createH3DevframeHost } from "./host-h3-
|
|
4
|
-
import { i as normalizeHttpServerUrl, t as startHttpAndWs } from "./server-
|
|
2
|
+
import { a as diagnostics } from "./storage-E9KrCsLr.mjs";
|
|
3
|
+
import { n as createHostContext, t as createH3DevframeHost } from "./host-h3-A8CXZoS5.mjs";
|
|
4
|
+
import { i as normalizeHttpServerUrl, t as startHttpAndWs } from "./server-DvrOR1LG.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";
|
|
8
|
+
import { createInteractiveAuth } from "./recipes/interactive-auth.mjs";
|
|
8
9
|
import { resolve } from "pathe";
|
|
9
10
|
import process$1 from "node:process";
|
|
10
11
|
import { networkInterfaces } from "node:os";
|
|
11
12
|
import { H3 } from "h3";
|
|
12
13
|
import { createServer } from "node:net";
|
|
13
|
-
import { joinURL, withBase
|
|
14
|
+
import { joinURL, withBase, withLeadingSlash, withoutLeadingSlash } from "ufo";
|
|
14
15
|
//#region ../../node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
|
|
15
16
|
const unsafePorts = /* @__PURE__ */ new Set([
|
|
16
17
|
1,
|
|
@@ -293,7 +294,7 @@ async function createDevServer(def, options = {}) {
|
|
|
293
294
|
const mcpPath = joinURL(basePath, mcpRoute);
|
|
294
295
|
let mountMcpHttp;
|
|
295
296
|
try {
|
|
296
|
-
({mountMcpHttp} = await import("./http-
|
|
297
|
+
({mountMcpHttp} = await import("./http-Fxm-0_V7.mjs"));
|
|
297
298
|
} catch (error) {
|
|
298
299
|
const reason = error instanceof Error ? error.message : String(error);
|
|
299
300
|
throw diagnostics.DF0017({
|
|
@@ -318,6 +319,17 @@ async function createDevServer(def, options = {}) {
|
|
|
318
319
|
...mcpMeta ? { mcp: mcpMeta } : {}
|
|
319
320
|
}));
|
|
320
321
|
if (distDir) mountStaticHandler(app, basePath, resolve(distDir));
|
|
322
|
+
const authOption = flags.auth === false ? false : def.cli?.auth;
|
|
323
|
+
let authHandler;
|
|
324
|
+
let resolvedAuth;
|
|
325
|
+
if (authOption === false) resolvedAuth = false;
|
|
326
|
+
else if (typeof authOption === "object") {
|
|
327
|
+
authHandler = authOption;
|
|
328
|
+
resolvedAuth = authOption;
|
|
329
|
+
} else {
|
|
330
|
+
authHandler = createInteractiveAuth(ctx);
|
|
331
|
+
resolvedAuth = authHandler;
|
|
332
|
+
}
|
|
321
333
|
const started = await startHttpAndWs({
|
|
322
334
|
context: ctx,
|
|
323
335
|
host,
|
|
@@ -325,8 +337,9 @@ async function createDevServer(def, options = {}) {
|
|
|
325
337
|
app,
|
|
326
338
|
path: bindPath,
|
|
327
339
|
wsPort,
|
|
328
|
-
auth:
|
|
340
|
+
auth: resolvedAuth,
|
|
329
341
|
onReady: async (info) => {
|
|
342
|
+
authHandler?.printBanner();
|
|
330
343
|
await options.onReady?.(info);
|
|
331
344
|
await maybeOpenBrowser(def, flags, `${info.origin}${basePath}`, options.openBrowser);
|
|
332
345
|
}
|
|
@@ -380,7 +393,7 @@ async function maybeOpenBrowser(def, flags, origin, override) {
|
|
|
380
393
|
const cliOpen = def.cli?.open;
|
|
381
394
|
const resolved = override ?? flagsOpen ?? cliOpen;
|
|
382
395
|
if (resolved === void 0 || resolved === false) return;
|
|
383
|
-
const target = typeof resolved === "string" ? withBase
|
|
396
|
+
const target = typeof resolved === "string" ? withBase(resolved, origin) : origin;
|
|
384
397
|
try {
|
|
385
398
|
await open(target);
|
|
386
399
|
} catch {}
|