devframe 0.1.20 → 0.1.22

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.
Files changed (95) hide show
  1. package/README.md +41 -18
  2. package/dist/{_shared-S-Ujqz_L.mjs → _shared-DcJX9-Az.mjs} +4 -4
  3. package/dist/adapters/build.d.mts +7 -7
  4. package/dist/adapters/build.mjs +15 -14
  5. package/dist/adapters/cli.d.mts +2 -2
  6. package/dist/adapters/cli.mjs +5 -5
  7. package/dist/adapters/dev.d.mts +18 -9
  8. package/dist/adapters/dev.mjs +1 -1
  9. package/dist/adapters/embedded.d.mts +6 -6
  10. package/dist/adapters/embedded.mjs +3 -3
  11. package/dist/adapters/mcp.d.mts +3 -3
  12. package/dist/adapters/mcp.mjs +6 -5
  13. package/dist/adapters/vite.d.mts +46 -12
  14. package/dist/adapters/vite.mjs +81 -17
  15. package/dist/chunk-e9Ob2GDo.mjs +26 -0
  16. package/dist/client/index.d.mts +19 -144
  17. package/dist/client/index.mjs +20 -20
  18. package/dist/colors-Bl4W18Mh.mjs +123 -0
  19. package/dist/constants.d.mts +12 -15
  20. package/dist/constants.mjs +12 -29
  21. package/dist/context-DBd794Rn.d.mts +51 -0
  22. package/dist/context-DUibxhrR.mjs +1034 -0
  23. package/dist/{dev-B8i_CBlQ.mjs → dev-BGpTpYiR.mjs} +20 -21
  24. package/dist/{devtool-Bm6zZAw5.d.mts → devframe-DulcIxwu.d.mts} +59 -569
  25. package/dist/diagnostics-BFhNNmST.mjs +56 -0
  26. package/dist/hash-BHZbo80D.mjs +126 -0
  27. package/dist/{human-id-CHS0s28X.mjs → human-id-adtUWQLr.mjs} +12 -4
  28. package/dist/{index-BCo03GEF.d.mts → index-DB2Ie0Or.d.mts} +2 -3
  29. package/dist/index.d.mts +4 -6
  30. package/dist/index.mjs +2 -8
  31. package/dist/launch-editor-KA_21J1T.mjs +581 -0
  32. package/dist/node/auth.d.mts +44 -0
  33. package/dist/node/auth.mjs +55 -0
  34. package/dist/node/index.d.mts +14 -187
  35. package/dist/node/index.mjs +6 -61
  36. package/dist/node/internal.d.mts +16 -0
  37. package/dist/node/internal.mjs +50 -0
  38. package/dist/{open-BtOOEldu.mjs → open-DmFp0qZA.mjs} +15 -6
  39. package/dist/recipes/open-helpers.d.mts +4 -9
  40. package/dist/recipes/open-helpers.mjs +7 -12
  41. package/dist/revoke-DIMz1r7-.mjs +35 -0
  42. package/dist/rpc/index.d.mts +3 -3
  43. package/dist/rpc/index.mjs +4 -4
  44. package/dist/rpc/transports/ws-client.d.mts +1 -1
  45. package/dist/rpc/transports/ws-client.mjs +2 -1
  46. package/dist/rpc/transports/ws-server.d.mts +1 -1
  47. package/dist/rpc/transports/ws-server.mjs +2 -1
  48. package/dist/{rpc-INbWfHoX.mjs → rpc-CkZuoz-m.mjs} +3 -2
  49. package/dist/{serialization-DwKi05Pn.mjs → serialization-CwO31axa.mjs} +1 -2
  50. package/dist/{server-qRRM8t3v.mjs → server-ma8-ZVyX.mjs} +1 -1
  51. package/dist/{server-DksyT-um.d.mts → server-zKEDxgqD.d.mts} +4 -3
  52. package/dist/shared-state-DCDs0e7y.mjs +928 -0
  53. package/dist/{static-dump-C1aVSwxY.mjs → static-dump-D7AvjrgL.mjs} +1 -1
  54. package/dist/storage-CNC38eU-.mjs +117 -0
  55. package/dist/structured-clone-DcDc2Dds.mjs +221 -0
  56. package/dist/types/index.d.mts +4 -4
  57. package/dist/types/index.mjs +11 -2
  58. package/dist/utils/colors.d.mts +28 -0
  59. package/dist/utils/colors.mjs +2 -0
  60. package/dist/utils/events.d.mts +1 -1
  61. package/dist/utils/hash.d.mts +7 -0
  62. package/dist/utils/hash.mjs +2 -0
  63. package/dist/utils/human-id.d.mts +6 -8
  64. package/dist/utils/human-id.mjs +1 -2
  65. package/dist/utils/launch-editor.d.mts +13 -0
  66. package/dist/utils/launch-editor.mjs +2 -0
  67. package/dist/utils/open.d.mts +16 -0
  68. package/dist/utils/open.mjs +2 -0
  69. package/dist/utils/serve-static.d.mts +30 -0
  70. package/dist/utils/serve-static.mjs +152 -0
  71. package/dist/utils/shared-state.d.mts +1 -1
  72. package/dist/utils/shared-state.mjs +1 -35
  73. package/dist/utils/streaming-channel.d.mts +1 -1
  74. package/dist/utils/structured-clone.d.mts +21 -0
  75. package/dist/utils/structured-clone.mjs +2 -0
  76. package/dist/utils/when.d.mts +384 -2
  77. package/dist/utils/when.mjs +20 -2
  78. package/dist/{ws-client-DQySVfF_.d.mts → ws-client-Bavoya6-.d.mts} +1 -1
  79. package/dist/{ws-server-VQqESKAs.d.mts → ws-server-DjvlwLuM.d.mts} +1 -1
  80. package/package.json +23 -13
  81. package/skills/devframe/SKILL.md +93 -117
  82. package/skills/devframe/templates/{counter-devtool.ts → counter-devframe.ts} +5 -10
  83. package/skills/devframe/templates/{spa-devtool.ts → spa-devframe.ts} +5 -10
  84. package/skills/devframe/templates/vite-client.ts +2 -2
  85. package/dist/adapters/kit.d.mts +0 -23
  86. package/dist/adapters/kit.mjs +0 -16
  87. package/dist/context-BfvbAyGk.mjs +0 -7215
  88. package/dist/main-DpINGndA.mjs +0 -601
  89. package/dist/utils/state.d.mts +0 -50
  90. package/dist/utils/state.mjs +0 -26
  91. package/dist/when-aBBXAEh5.d.mts +0 -401
  92. package/dist/{define-Bb4zh-Dc.mjs → define-CW9gLnyG.mjs} +0 -0
  93. package/dist/{host-h3-BMvrFzIJ.mjs → host-h3-Dz8YnFgu.mjs} +2 -2
  94. /package/dist/{transports-BPUzHhI2.mjs → transports-BnCs4rj9.mjs} +0 -0
  95. /package/dist/{types-ag029cAe.d.mts → types-4rdUEi2R.d.mts} +0 -0
@@ -1,14 +1,15 @@
1
- import { t as createHostContext } from "./context-BfvbAyGk.mjs";
1
+ import { t as createHostContext } from "./context-DUibxhrR.mjs";
2
+ import { t as createH3DevToolsHost } from "./host-h3-Dz8YnFgu.mjs";
3
+ import { t as startHttpAndWs } from "./server-ma8-ZVyX.mjs";
2
4
  import { DEVTOOLS_CONNECTION_META_FILENAME } from "./constants.mjs";
3
- import { t as createH3DevToolsHost } from "./host-h3-BMvrFzIJ.mjs";
4
- import { t as startHttpAndWs } from "./server-qRRM8t3v.mjs";
5
- import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-S-Ujqz_L.mjs";
6
- import { resolve } from "pathe";
7
- import process$1 from "node:process";
5
+ import { n as resolveBasePath, t as normalizeBasePath } from "./_shared-DcJX9-Az.mjs";
6
+ import { t as open } from "./open-DmFp0qZA.mjs";
7
+ import { serveStaticHandler } from "./utils/serve-static.mjs";
8
8
  import { networkInterfaces } from "node:os";
9
- import { createApp, eventHandler, fromNodeMiddleware } from "h3";
9
+ import process$1 from "node:process";
10
+ import { resolve } from "pathe";
11
+ import { createApp, eventHandler } from "h3";
10
12
  import { createServer } from "node:net";
11
- import sirv from "sirv";
12
13
  //#region ../../../node_modules/.pnpm/get-port-please@3.2.0/node_modules/get-port-please/dist/index.mjs
13
14
  const unsafePorts = /* @__PURE__ */ new Set([
14
15
  1,
@@ -245,9 +246,15 @@ async function resolveDevServerPort(def, options = {}) {
245
246
  return getPort(portOptions);
246
247
  }
247
248
  /**
248
- * Start a devframe dev server for a {@link DevtoolDefinition} —
249
- * h3 + WebSocket RPC + the author's SPA mounted at the resolved base
250
- * path.
249
+ * Start a devframe dev server for a {@link DevframeDefinition} —
250
+ * h3 + WebSocket RPC + (optionally) the author's SPA mounted at the
251
+ * resolved base path.
252
+ *
253
+ * When `distDir` is omitted (and `def.cli?.distDir` is unset) the
254
+ * server runs in **bridge mode**: only `__connection.json` and the WS
255
+ * endpoint are mounted, with no SPA mount. The SPA is expected to be
256
+ * hosted elsewhere (e.g. by a parent Vite/Nuxt dev server) — see
257
+ * `createVitePlugin({ devMiddleware })`.
251
258
  *
252
259
  * Returns the underlying {@link StartedServer} handle so callers can
253
260
  * close it gracefully (SIGINT, hot-reload, test teardown).
@@ -258,7 +265,6 @@ async function resolveDevServerPort(def, options = {}) {
258
265
  */
259
266
  async function createDevServer(def, options = {}) {
260
267
  const distDir = options.distDir ?? def.cli?.distDir;
261
- if (!distDir) throw new Error(`[devframe] createDevServer: no distDir for "${def.id}". Set \`cli.distDir\` on the definition or pass it as an option.`);
262
268
  const host = options.host ?? def.cli?.host ?? "localhost";
263
269
  const port = options.port ?? await resolveDevServerPort(def, { host });
264
270
  const flags = options.flags ?? {};
@@ -268,10 +274,7 @@ async function createDevServer(def, options = {}) {
268
274
  origin: `http://${host}:${port}`,
269
275
  appName: def.id,
270
276
  mount: (base, dir) => {
271
- app.use(base, fromNodeMiddleware(sirv(dir, {
272
- dev: true,
273
- single: true
274
- })));
277
+ app.use(base, serveStaticHandler(dir));
275
278
  }
276
279
  });
277
280
  const ctx = await createHostContext({
@@ -289,10 +292,7 @@ async function createDevServer(def, options = {}) {
289
292
  websocket: port
290
293
  }));
291
294
  }));
292
- app.use(basePath, fromNodeMiddleware(sirv(resolve(distDir), {
293
- dev: true,
294
- single: true
295
- })));
295
+ if (distDir) app.use(basePath, serveStaticHandler(resolve(distDir)));
296
296
  return startHttpAndWs({
297
297
  context: ctx,
298
298
  host,
@@ -312,7 +312,6 @@ async function maybeOpenBrowser(def, flags, origin, override) {
312
312
  if (resolved === void 0 || resolved === false) return;
313
313
  const target = typeof resolved === "string" ? resolveOpenTarget(origin, resolved) : origin;
314
314
  try {
315
- const { default: open } = await import("./open-BtOOEldu.mjs");
316
315
  await open(target);
317
316
  } catch {}
318
317
  }