devframe 0.7.10 → 0.7.11

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.
@@ -1,2 +1,2 @@
1
- import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-BK-MiL3k.mjs";
1
+ import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-Drj5sjnU.mjs";
2
2
  export { createCac, defineCliFlags, parseCliFlags };
@@ -1,4 +1,4 @@
1
- import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-BK-MiL3k.mjs";
1
+ import { n as defineCliFlags, r as parseCliFlags, t as createCac } from "../cac-Drj5sjnU.mjs";
2
2
  //#region src/adapters/cli.ts
3
3
  /** @deprecated Use `createCac` from `devframe/adapters/cac` instead. */
4
4
  const createCli = createCac;
@@ -1,4 +1,4 @@
1
- import { d as McpRouteOptions, r as DevframeDefinition, u as DevframeWsOptions } from "../devframe-C18zEiex.mjs";
1
+ import { d as McpRouteOptions, p as DevframeAuthHandler, r as DevframeDefinition, u as DevframeWsOptions } from "../devframe-C18zEiex.mjs";
2
2
  import { n as StartedServer } from "../server-BLaM21gv.mjs";
3
3
  import { H3 } from "h3";
4
4
  //#region src/adapters/dev.d.ts
@@ -50,6 +50,17 @@ interface CreateDevServerOptions {
50
50
  * sources; a string opens that relative path.
51
51
  */
52
52
  openBrowser?: boolean | string;
53
+ /**
54
+ * Override how authentication resolves, taking precedence over
55
+ * `def.cli?.auth`. Pass `false` to skip the gate entirely (the standard
56
+ * choice for a **hosted** deployment where the host manages auth — see
57
+ * {@link viteDevBridge}); a {@link DevframeAuthHandler} to install a custom
58
+ * scheme; or `true` to force devframe's interactive OTP gate on. When
59
+ * omitted, auth resolves from `flags.auth` / `def.cli?.auth` (the standalone
60
+ * default: gated). The `--no-auth` flag (`flags.auth === false`) still forces
61
+ * the gate off regardless of this option.
62
+ */
63
+ auth?: boolean | DevframeAuthHandler;
53
64
  /**
54
65
  * Expose a route-based MCP server on the dev server (Streamable-HTTP).
55
66
  * Overrides `def.cli?.mcp`; `undefined` falls through to it. `false`
@@ -1,2 +1,2 @@
1
- import { n as resolveDevServerPort, t as createDevServer } from "../dev-DmdXbLyJ.mjs";
1
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-BdegDQKt.mjs";
2
2
  export { createDevServer, resolveDevServerPort };
@@ -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-DmdXbLyJ.mjs";
3
+ import { n as resolveDevServerPort, t as createDevServer } from "./dev-BdegDQKt.mjs";
4
4
  import process from "node:process";
5
5
  import cac from "cac";
6
6
  import { safeParse } from "valibot";
@@ -319,7 +319,7 @@ async function createDevServer(def, options = {}) {
319
319
  ...mcpMeta ? { mcp: mcpMeta } : {}
320
320
  }));
321
321
  if (distDir) mountStaticHandler(app, basePath, resolve(distDir));
322
- const authOption = flags.auth === false ? false : def.cli?.auth;
322
+ const authOption = flags.auth === false ? false : options.auth !== void 0 ? options.auth : def.cli?.auth;
323
323
  let authHandler;
324
324
  let resolvedAuth;
325
325
  if (authOption === false) resolvedAuth = false;
@@ -1,4 +1,4 @@
1
- import { r as DevframeDefinition } from "../devframe-C18zEiex.mjs";
1
+ import { p as DevframeAuthHandler, r as DevframeDefinition } from "../devframe-C18zEiex.mjs";
2
2
  //#region src/helpers/vite.d.ts
3
3
  interface ViteDevBridgeOptions {
4
4
  /**
@@ -30,6 +30,19 @@ interface ViteDevBridgeOptions {
30
30
  /** Flag bag forwarded to `def.setup(ctx, { flags })`. */
31
31
  flags?: Record<string, unknown>;
32
32
  };
33
+ /**
34
+ * Whether the bridged devframe runs its own auth gate. This is a **hosted**
35
+ * adapter — the devframe shares the host app's origin and the host owns
36
+ * authentication — so it defaults to `false`: the plugin's own gate never
37
+ * fires and its `cli.auth` default is ignored (matching devframe's
38
+ * hosted-deployment contract). Pass `true` to force devframe's interactive
39
+ * OTP gate on, or a {@link DevframeAuthHandler} to install a custom scheme.
40
+ * Only applies in bridge mode (`devMiddleware`); the static-mount mode
41
+ * starts no RPC server.
42
+ *
43
+ * @default false
44
+ */
45
+ auth?: boolean | DevframeAuthHandler;
33
46
  }
34
47
  interface DevframeVitePlugin {
35
48
  name: string;
@@ -58,6 +71,12 @@ interface DevframeVitePlugin {
58
71
  * host-served SPA can discover the WS endpoint via
59
72
  * {@link connectDevframe}.
60
73
  *
74
+ * As a hosted adapter the bridge defers authentication to the host: its
75
+ * side-car RPC server runs with the plugin's own auth gate **off** by
76
+ * default (ignoring `def.cli?.auth`), so a plugin mounted this way never
77
+ * triggers its standalone OTP prompt. Opt back in per-mount with
78
+ * `options.auth` (`true` for devframe's interactive gate, or a handler).
79
+ *
61
80
  * Use bridge mode when integrating with frameworks that own the SPA
62
81
  * (Nuxt, Astro, SolidStart, plain Vite apps). For the all-in-one
63
82
  * `dev` / `build` / `mcp` shell, reach for {@link createCac} instead.
@@ -2,7 +2,7 @@ import { DEVFRAME_CONNECTION_META_FILENAME, DEVFRAME_WS_ROUTE } from "../constan
2
2
  import { a as diagnostics } from "../storage-D_Xy9v1l.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-DmdXbLyJ.mjs";
5
+ import { n as resolveDevServerPort, t as createDevServer } from "../dev-BdegDQKt.mjs";
6
6
  import { resolve } from "pathe";
7
7
  //#region src/helpers/vite.ts
8
8
  /**
@@ -19,6 +19,12 @@ import { resolve } from "pathe";
19
19
  * host-served SPA can discover the WS endpoint via
20
20
  * {@link connectDevframe}.
21
21
  *
22
+ * As a hosted adapter the bridge defers authentication to the host: its
23
+ * side-car RPC server runs with the plugin's own auth gate **off** by
24
+ * default (ignoring `def.cli?.auth`), so a plugin mounted this way never
25
+ * triggers its standalone OTP prompt. Opt back in per-mount with
26
+ * `options.auth` (`true` for devframe's interactive gate, or a handler).
27
+ *
22
28
  * Use bridge mode when integrating with frameworks that own the SPA
23
29
  * (Nuxt, Astro, SolidStart, plain Vite apps). For the all-in-one
24
30
  * `dev` / `build` / `mcp` shell, reach for {@link createCac} instead.
@@ -51,7 +57,8 @@ function viteDevBridge(d, options = {}) {
51
57
  host: mw.host,
52
58
  port,
53
59
  flags: mw.flags,
54
- openBrowser: false
60
+ openBrowser: false,
61
+ auth: options.auth ?? false
55
62
  });
56
63
  } catch (e) {
57
64
  diagnostics.DF0033({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "devframe",
3
3
  "type": "module",
4
- "version": "0.7.10",
4
+ "version": "0.7.11",
5
5
  "description": "Framework for building generic devframes",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",