devframe 0.1.22 → 0.2.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/README.md +20 -77
- package/dist/{_shared-DcJX9-Az.mjs → _shared-C_yZKUmx.mjs} +3 -3
- package/dist/adapters/build.d.mts +1 -1
- package/dist/adapters/build.mjs +5 -6
- package/dist/adapters/cli.d.mts +3 -3
- package/dist/adapters/cli.mjs +2 -2
- package/dist/adapters/dev.d.mts +7 -7
- package/dist/adapters/dev.mjs +1 -1
- package/dist/adapters/embedded.d.mts +1 -1
- package/dist/adapters/mcp.d.mts +2 -2
- package/dist/adapters/mcp.mjs +73 -18
- package/dist/client/index.d.mts +5 -7
- package/dist/client/index.mjs +10 -23
- package/dist/colors-DS7k8ljB.mjs +123 -0
- package/dist/{context-DBd794Rn.d.mts → context-BaX-SZti.d.mts} +1 -1
- package/dist/{dev-BGpTpYiR.mjs → dev-CA0-8Amw.mjs} +14 -18
- package/dist/{devframe-DulcIxwu.d.mts → devframe-BXZUBuy6.d.mts} +12 -28
- package/dist/{diagnostics-BFhNNmST.mjs → diagnostics-Cg9ycFIM.mjs} +2 -2
- package/dist/hash-CIBte1yS.mjs +263 -0
- package/dist/{adapters → helpers}/vite.d.mts +7 -8
- package/dist/{adapters → helpers}/vite.mjs +8 -9
- package/dist/{context-DUibxhrR.mjs → host-h3-CpYkiCIU.mjs} +36 -14
- package/dist/{index-DB2Ie0Or.d.mts → index-BO4daMzR.d.mts} +51 -3
- package/dist/index.d.mts +4 -4
- package/dist/{launch-editor-KA_21J1T.mjs → launch-editor-1dAC7Uk5.mjs} +9 -9
- package/dist/node/auth.d.mts +2 -2
- package/dist/node/auth.mjs +2 -2
- package/dist/node/index.d.mts +12 -44
- package/dist/node/index.mjs +4 -6
- package/dist/node/internal.d.mts +5 -5
- package/dist/node/internal.mjs +4 -4
- package/dist/{open-DmFp0qZA.mjs → open-CWL4Zasd.mjs} +26 -21
- package/dist/recipes/open-helpers.d.mts +1 -1
- package/dist/recipes/open-helpers.mjs +2 -2
- package/dist/rpc/index.d.mts +3 -3
- package/dist/rpc/index.mjs +2 -2
- package/dist/rpc/transports/ws-client.d.mts +1 -1
- package/dist/rpc/transports/ws-client.mjs +2 -2
- package/dist/rpc/transports/ws-server.d.mts +1 -1
- package/dist/rpc/transports/ws-server.mjs +2 -2
- package/dist/{rpc-CkZuoz-m.mjs → rpc-BlVCyk9W.mjs} +138 -14
- package/dist/{server-zKEDxgqD.d.mts → server-CgqyJG9m.d.mts} +5 -5
- package/dist/{server-ma8-ZVyX.mjs → server-G1ymmN3_.mjs} +3 -3
- package/dist/{shared-state-DCDs0e7y.mjs → shared-state-q9-1EOSX.mjs} +1 -1
- package/dist/{storage-CNC38eU-.mjs → storage-BaLJK6e_.mjs} +3 -3
- package/dist/{structured-clone-DcDc2Dds.mjs → structured-clone-CD2l4fI3.mjs} +1 -1
- package/dist/{transports-BnCs4rj9.mjs → transports-BLwT342H.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +1 -10
- package/dist/{types-4rdUEi2R.d.mts → types-ip8THGH1.d.mts} +21 -5
- package/dist/utils/colors.mjs +1 -1
- package/dist/utils/events.d.mts +1 -1
- package/dist/utils/hash.mjs +1 -1
- package/dist/utils/human-id.mjs +1 -1
- package/dist/utils/launch-editor.mjs +1 -1
- package/dist/utils/open.mjs +1 -1
- package/dist/utils/serve-static.d.mts +13 -3
- package/dist/utils/serve-static.mjs +41 -20
- package/dist/utils/shared-state.d.mts +1 -1
- package/dist/utils/shared-state.mjs +1 -1
- package/dist/utils/streaming-channel.d.mts +1 -1
- package/dist/utils/structured-clone.mjs +1 -1
- package/dist/utils/when.d.mts +1 -1
- package/dist/utils/when.mjs +1 -1
- package/dist/{ws-client-Bavoya6-.d.mts → ws-client-DFUf-xgm.d.mts} +1 -1
- package/dist/{ws-server-DjvlwLuM.d.mts → ws-server-kW8RZXTw.d.mts} +1 -1
- package/package.json +18 -11
- package/skills/devframe/SKILL.md +24 -21
- package/skills/devframe/templates/spa-devframe.ts +2 -2
- package/dist/colors-Bl4W18Mh.mjs +0 -123
- package/dist/hash-BHZbo80D.mjs +0 -126
- package/dist/host-h3-Dz8YnFgu.mjs +0 -24
- package/dist/static-dump-D7AvjrgL.mjs +0 -80
- /package/dist/{human-id-adtUWQLr.mjs → human-id-mPh1HcFO.mjs} +0 -0
- /package/dist/{revoke-DIMz1r7-.mjs → revoke-CWSPBbJH.mjs} +0 -0
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "devframe",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1
|
|
4
|
+
"version": "0.2.1",
|
|
5
5
|
"description": "Framework for building generic DevTools",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"homepage": "https://github.com/
|
|
8
|
+
"homepage": "https://github.com/devframes/devframe#readme",
|
|
9
9
|
"repository": {
|
|
10
|
-
"directory": "
|
|
10
|
+
"directory": "packages/devframe",
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/
|
|
12
|
+
"url": "git+https://github.com/devframes/devframe.git"
|
|
13
13
|
},
|
|
14
|
-
"bugs": "https://github.com/
|
|
14
|
+
"bugs": "https://github.com/devframes/devframe/issues",
|
|
15
15
|
"keywords": [
|
|
16
16
|
"devtools",
|
|
17
17
|
"rpc",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"./adapters/dev": "./dist/adapters/dev.mjs",
|
|
26
26
|
"./adapters/embedded": "./dist/adapters/embedded.mjs",
|
|
27
27
|
"./adapters/mcp": "./dist/adapters/mcp.mjs",
|
|
28
|
-
"./adapters/vite": "./dist/adapters/vite.mjs",
|
|
29
28
|
"./client": "./dist/client/index.mjs",
|
|
30
29
|
"./constants": "./dist/constants.mjs",
|
|
30
|
+
"./helpers/vite": "./dist/helpers/vite.mjs",
|
|
31
31
|
"./node": "./dist/node/index.mjs",
|
|
32
32
|
"./node/auth": "./dist/node/auth.mjs",
|
|
33
33
|
"./node/internal": "./dist/node/internal.mjs",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@valibot/to-json-schema": "^1.7.0",
|
|
71
71
|
"birpc": "^4.0.0",
|
|
72
72
|
"cac": "^7.0.0",
|
|
73
|
-
"h3": "
|
|
73
|
+
"h3": "2.0.1-rc.22",
|
|
74
74
|
"logs-sdk": "^0.0.6",
|
|
75
75
|
"mrmime": "^2.0.1",
|
|
76
76
|
"pathe": "^2.0.3",
|
|
@@ -79,19 +79,26 @@
|
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
82
|
-
"ansis": "^4.
|
|
82
|
+
"ansis": "^4.3.0",
|
|
83
|
+
"get-port-please": "^3.2.0",
|
|
84
|
+
"human-id": "^4.1.3",
|
|
83
85
|
"immer": "^11.1.8",
|
|
84
86
|
"launch-editor": "^2.13.2",
|
|
87
|
+
"mlly": "^1.8.2",
|
|
88
|
+
"obug": "^2.1.1",
|
|
85
89
|
"ohash": "^2.0.11",
|
|
86
90
|
"open": "^11.0.0",
|
|
91
|
+
"p-limit": "^7.3.0",
|
|
92
|
+
"perfect-debounce": "^2.1.0",
|
|
87
93
|
"structured-clone-es": "^2.0.0",
|
|
88
94
|
"tsdown": "^0.22.0",
|
|
95
|
+
"ua-parser-modern": "^0.1.1",
|
|
89
96
|
"whenexpr": "^0.1.2"
|
|
90
97
|
},
|
|
91
98
|
"inlinedDependencies": {
|
|
92
|
-
"ansis": "4.
|
|
99
|
+
"ansis": "4.3.0",
|
|
93
100
|
"bundle-name": "4.1.0",
|
|
94
|
-
"default-browser": "5.
|
|
101
|
+
"default-browser": "5.5.0",
|
|
95
102
|
"default-browser-id": "5.0.1",
|
|
96
103
|
"define-lazy-prop": "3.0.0",
|
|
97
104
|
"get-port-please": "3.2.0",
|
|
@@ -100,7 +107,7 @@
|
|
|
100
107
|
"is-docker": "3.0.0",
|
|
101
108
|
"is-in-ssh": "1.0.0",
|
|
102
109
|
"is-inside-container": "1.0.0",
|
|
103
|
-
"is-wsl": "3.1.
|
|
110
|
+
"is-wsl": "3.1.1",
|
|
104
111
|
"launch-editor": "2.13.2",
|
|
105
112
|
"obug": "2.1.1",
|
|
106
113
|
"ohash": "2.0.11",
|
package/skills/devframe/SKILL.md
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: devframe
|
|
3
3
|
description: >
|
|
4
|
-
Use when building
|
|
5
|
-
|
|
4
|
+
Use when building a devtool with devframe — the
|
|
5
|
+
framework- and build-tool-agnostic foundation for defining a
|
|
6
|
+
devtool once and serving it in many places. Covers
|
|
6
7
|
DevframeDefinition, picking the right deployment adapter
|
|
7
8
|
(cli / build / spa / vite / embedded / mcp), designing RPC
|
|
8
|
-
contracts, exposing an agent-native surface over MCP, and
|
|
9
|
-
the author's SPA client.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
`
|
|
14
|
-
migrations of existing inspectors
|
|
15
|
-
|
|
9
|
+
contracts, exposing an agent-native surface over MCP, and
|
|
10
|
+
wiring the author's SPA client. For host-level features (docks,
|
|
11
|
+
terminals, palette, etc.), the devframe can be mounted into a
|
|
12
|
+
host that provides them — Vite DevTools is one supported target,
|
|
13
|
+
reached via the `vite` adapter. Triggers on `devframe` imports,
|
|
14
|
+
`defineDevframe`, `createCli`, `createMcpServer`,
|
|
15
|
+
`connectDevframe`, and on migrations of existing inspectors
|
|
16
|
+
(eslint-config-inspector, unocss-inspector,
|
|
17
|
+
node-modules-inspector-style tools) to devframe.
|
|
16
18
|
---
|
|
17
19
|
|
|
18
20
|
# devframe skill
|
|
19
21
|
|
|
20
|
-
**Devframe is
|
|
22
|
+
**Devframe is an asset: define your devtool once, serve it anywhere.** A devtool built on devframe is a single `DevframeDefinition` plus an author-provided SPA — the same definition deploys through a set of pluggable adapters (standalone CLI, static report, embedded SPA, MCP server, mounted into a host, etc.). Devframe is framework- and build-tool-agnostic; it has no Vite dependency and makes no UI-framework assumption.
|
|
21
23
|
|
|
22
|
-
Devframe
|
|
24
|
+
Devframe describes one tool. If you need host-level features (cross-tool palette, integrated terminals, dock aggregation), mount the devframe into a host that provides them — [Vite DevTools](https://devtools.vite.dev/) is the canonical example, reached via the `vite` adapter — or build your own host adapter. `devframe` itself must not depend on Vite or any `@vitejs/*` package.
|
|
23
25
|
|
|
24
26
|
Full reference: [devfra.me/](https://devfra.me/).
|
|
25
27
|
|
|
@@ -31,14 +33,15 @@ All adapter factories share the shape `createXxx(devframeDef, options?)`.
|
|
|
31
33
|
|-------------|---------|-------|
|
|
32
34
|
| Standalone CLI for local use | `createCli(def, options?)` | `devframe/adapters/cli` |
|
|
33
35
|
| Run the dev server programmatically (any CLI framework) | `createDevServer(def, options?)` | `devframe/adapters/dev` |
|
|
34
|
-
| Mount a SPA in an existing Vite dev server | `createVitePlugin(def, options?)` | `devframe/adapters/vite` |
|
|
35
36
|
| Self-contained static deploy with baked data | `createBuild(def, options?)` | `devframe/adapters/build` |
|
|
36
|
-
|
|
|
37
|
+
| Mount into a host (Vite DevTools or any compatible host) | `createPluginFromDevframe(def, options?)` | `@vitejs/devtools-kit/node` |
|
|
37
38
|
| Register dynamically at runtime | `createEmbedded(def, { ctx })` | `devframe/adapters/embedded` |
|
|
38
39
|
| Expose to coding agents (MCP) | `createMcpServer(def, options?)` | `devframe/adapters/mcp` *(experimental)* |
|
|
39
40
|
|
|
40
41
|
The same `DevframeDefinition` runs under every adapter — pick based on deployment, not on what the tool does.
|
|
41
42
|
|
|
43
|
+
For Vite-based hosts that don't use the kit (Nuxt, Astro, SolidStart, plain Vite apps), `devframe/helpers/vite` exports `viteDevBridge(def, options?)` — a Vite plugin that mounts the SPA (static mode) or starts the RPC + WS bridge alongside the host's dev server (`devMiddleware: true`). Not an adapter; just a Vite integration helper.
|
|
44
|
+
|
|
42
45
|
## Minimum viable devframe
|
|
43
46
|
|
|
44
47
|
```ts
|
|
@@ -59,7 +62,7 @@ export default defineDevframe({
|
|
|
59
62
|
})
|
|
60
63
|
```
|
|
61
64
|
|
|
62
|
-
`setup(ctx)` registers RPC functions, shared state, diagnostics, and any other devframe-level wiring.
|
|
65
|
+
`setup(ctx)` registers RPC functions, shared state, diagnostics, and any other devframe-level wiring. Host adapters can augment `ctx` with extra surfaces — for example, mounting into Vite DevTools via `createPluginFromDevframe(d)` exposes `docks`, `terminals`, `messages`, and `commands` on the augmented context, and the kit auto-derives an iframe dock entry from `id` / `name` / `icon` / `basePath`. For richer host-side behaviour (custom-render, terminals, palette commands) pass `options.setup` to `createPluginFromDevframe`.
|
|
63
66
|
|
|
64
67
|
See `templates/counter-devframe.ts` for a runnable counter example, `templates/spa-devframe.ts` for an SPA-ready shape, and `templates/vite-client.ts` for the author's client entry.
|
|
65
68
|
|
|
@@ -86,7 +89,7 @@ See `templates/counter-devframe.ts` for a runnable counter example, `templates/s
|
|
|
86
89
|
| `ctx.host` | Runtime abstraction — `mountStatic`, `resolveOrigin`, `getStorageDir` |
|
|
87
90
|
| `ctx.mode` | `'dev'` or `'build'` — gate setup work per runtime |
|
|
88
91
|
|
|
89
|
-
>
|
|
92
|
+
> Hosts can augment `ctx` with additional surfaces (e.g. Vite DevTools' `docks`, `terminals`, `messages`, `commands`, `createJsonRenderer`). Consult the host's docs — for Vite DevTools, see the [`vite-devtools-kit` skill](../../skills/vite-devtools-kit).
|
|
90
93
|
|
|
91
94
|
## RPC contracts
|
|
92
95
|
|
|
@@ -236,11 +239,11 @@ Readable.fromWeb(reader.readable).pipe(targetNodeWritable)
|
|
|
236
239
|
| Per-call lifecycles with cancellation | Cross-cutting fire-and-forget signals | Diff-based sync between clients |
|
|
237
240
|
| Replay on reconnect | | |
|
|
238
241
|
|
|
239
|
-
For chat-style UIs that combine both: keep the **conversation log** in shared state (survives reconnects), and use a streaming channel for **active responses**. The action that starts a response appends a placeholder to shared state; on producer close, commit the joined content back to shared state. Working example: [`
|
|
242
|
+
For chat-style UIs that combine both: keep the **conversation log** in shared state (survives reconnects), and use a streaming channel for **active responses**. The action that starts a response appends a placeholder to shared state; on producer close, commit the joined content back to shared state. Working example: [`examples/streaming-chat`](https://github.com/devframes/devframe/tree/main/examples/streaming-chat).
|
|
240
243
|
|
|
241
|
-
## Mounting into Vite DevTools
|
|
244
|
+
## Mounting into a host (Vite DevTools example)
|
|
242
245
|
|
|
243
|
-
A portable devframe
|
|
246
|
+
A portable devframe can be mounted into any host that ships an adapter for it. Vite DevTools is one supported target — `createPluginFromDevframe` is the Vite-DevTools-specific bridge; other hosts can implement equivalent factories. Example:
|
|
244
247
|
|
|
245
248
|
```ts
|
|
246
249
|
// vite.config.ts
|
|
@@ -263,7 +266,7 @@ export default {
|
|
|
263
266
|
}
|
|
264
267
|
```
|
|
265
268
|
|
|
266
|
-
The kit auto-derives an iframe dock entry from `id` / `name` / `icon` / `basePath`. For dock variations (custom-render, launcher, action, json-render), terminals, palette commands, and toasts, use the `options.setup` hook — those APIs live on the
|
|
269
|
+
The kit auto-derives an iframe dock entry from `id` / `name` / `icon` / `basePath`. For dock variations (custom-render, launcher, action, json-render), terminals, palette commands, and toasts, use the `options.setup` hook — those APIs live on the host-augmented context, not on the devframe-level `setup`. See the [`vite-devtools-kit` skill](../../skills/vite-devtools-kit) for the Vite-DevTools-specific reference.
|
|
267
270
|
|
|
268
271
|
## When clauses
|
|
269
272
|
|
|
@@ -419,7 +422,7 @@ Devframe-level pages (one-tool, portable surface):
|
|
|
419
422
|
- [Client](https://devfra.me/client) — auth handshake, modes, discovery
|
|
420
423
|
- [Agent-Native](https://devfra.me/agent-native) — agent field, tools/resources, MCP + Claude Desktop
|
|
421
424
|
|
|
422
|
-
|
|
425
|
+
Host-specific extras (when mounting into Vite DevTools — other hosts have their own equivalents):
|
|
423
426
|
|
|
424
427
|
- [Vite DevTools Kit overview](https://devtools.vite.dev/kit/)
|
|
425
428
|
- [Dock System](https://devtools.vite.dev/kit/dock-system) — every entry type + remote docks
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Devframe with setupBrowser + SPA query-loader — deployable as a static site.
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// Host adapters (e.g. the `vite` adapter for Vite DevTools) auto-derive their
|
|
3
|
+
// mount entry from `id` / `name` / `icon`.
|
|
4
4
|
import { defineDevframe, defineRpcFunction } from 'devframe'
|
|
5
5
|
import * as v from 'valibot'
|
|
6
6
|
|
package/dist/colors-Bl4W18Mh.mjs
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import { r as __toESM, t as __commonJSMin } from "./chunk-e9Ob2GDo.mjs";
|
|
2
|
-
//#endregion
|
|
3
|
-
//#region ../../../node_modules/.pnpm/ansis@4.2.0/node_modules/ansis/index.mjs
|
|
4
|
-
var import_ansis = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
5
|
-
let e, t, r, { defineProperty: l, setPrototypeOf: n, create: o, keys: s } = Object, i = "", { round: c, max: a } = Math, p = (e) => {
|
|
6
|
-
let t = /([a-f\d]{3,6})/i.exec(e)?.[1], r = t?.length, l = parseInt(6 ^ r ? 3 ^ r ? "0" : t[0] + t[0] + t[1] + t[1] + t[2] + t[2] : t, 16);
|
|
7
|
-
return [
|
|
8
|
-
l >> 16 & 255,
|
|
9
|
-
l >> 8 & 255,
|
|
10
|
-
255 & l
|
|
11
|
-
];
|
|
12
|
-
}, u = (e, t, r) => e ^ t || t ^ r ? 16 + 36 * c(e / 51) + 6 * c(t / 51) + c(r / 51) : 8 > e ? 16 : e > 248 ? 231 : c(24 * (e - 8) / 247) + 232, d = (e) => {
|
|
13
|
-
let t, r, l, n, o;
|
|
14
|
-
return 8 > e ? 30 + e : 16 > e ? e - 8 + 90 : (232 > e ? (o = (e -= 16) % 36, t = (e / 36 | 0) / 5, r = (o / 6 | 0) / 5, l = o % 6 / 5) : t = r = l = (10 * (e - 232) + 8) / 255, n = 2 * a(t, r, l), n ? 30 + (c(l) << 2 | c(r) << 1 | c(t)) + (2 ^ n ? 0 : 60) : 30);
|
|
15
|
-
}, f = (() => {
|
|
16
|
-
let r = (e) => o.some(((t) => e.test(t))), l = globalThis, n = l.process ?? {}, o = n.argv ?? [], i = n.env ?? {}, c = -1;
|
|
17
|
-
try {
|
|
18
|
-
e = "," + s(i).join(",");
|
|
19
|
-
} catch (e) {
|
|
20
|
-
i = {}, c = 0;
|
|
21
|
-
}
|
|
22
|
-
let a = "FORCE_COLOR", p = {
|
|
23
|
-
false: 0,
|
|
24
|
-
0: 0,
|
|
25
|
-
1: 1,
|
|
26
|
-
2: 2,
|
|
27
|
-
3: 3
|
|
28
|
-
}[i[a]] ?? -1, u = a in i && p || r(/^--color=?(true|always)?$/);
|
|
29
|
-
return u && (c = p), ~c || (c = ((r, l, n) => (t = r.TERM, {
|
|
30
|
-
"24bit": 3,
|
|
31
|
-
truecolor: 3,
|
|
32
|
-
ansi256: 2,
|
|
33
|
-
ansi: 1
|
|
34
|
-
}[r.COLORTERM] || (r.CI ? /,GITHUB/.test(e) ? 3 : 1 : l && "dumb" !== t ? n ? 3 : /-256/.test(t) ? 2 : 1 : 0)))(i, !!i.PM2_HOME || i.NEXT_RUNTIME?.includes("edge") || !!n.stdout?.isTTY, "win32" === n.platform)), !p || i.NO_COLOR || r(/^--(no-color|color=(false|never))$/) ? 0 : l.window?.chrome || u && !c ? 3 : c;
|
|
35
|
-
})(), g = {
|
|
36
|
-
open: i,
|
|
37
|
-
close: i
|
|
38
|
-
}, h = 39, b = 49, O = {}, m = ({ p: e }, { open: t, close: l }) => {
|
|
39
|
-
let o = (e, ...r) => {
|
|
40
|
-
if (!e) {
|
|
41
|
-
if (t && t === l) return t;
|
|
42
|
-
if ((e ?? i) === i) return i;
|
|
43
|
-
}
|
|
44
|
-
let n, s = e.raw ? String.raw({ raw: e }, ...r) : i + e, c = o.p, a = c.o, p = c.c;
|
|
45
|
-
if (s.includes("\x1B")) for (; c; c = c.p) {
|
|
46
|
-
let { open: e, close: t } = c, r = t.length, l = i, o = 0;
|
|
47
|
-
if (r) for (; ~(n = s.indexOf(t, o)); o = n + r) l += s.slice(o, n) + e;
|
|
48
|
-
s = l + s.slice(o);
|
|
49
|
-
}
|
|
50
|
-
return a + (s.includes("\n") ? s.replace(/(\r?\n)/g, p + "$1" + a) : s) + p;
|
|
51
|
-
}, s = t, c = l;
|
|
52
|
-
return e && (s = e.o + t, c = l + e.c), n(o, r), o.p = {
|
|
53
|
-
open: t,
|
|
54
|
-
close: l,
|
|
55
|
-
o: s,
|
|
56
|
-
c,
|
|
57
|
-
p: e
|
|
58
|
-
}, o.open = s, o.close = c, o;
|
|
59
|
-
};
|
|
60
|
-
const w = new function e(t = f) {
|
|
61
|
-
let s = {
|
|
62
|
-
Ansis: e,
|
|
63
|
-
level: t,
|
|
64
|
-
isSupported: () => a,
|
|
65
|
-
strip: (e) => e.replace(/[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, i),
|
|
66
|
-
extend(e) {
|
|
67
|
-
for (let t in e) {
|
|
68
|
-
let r = e[t], l = (typeof r)[0];
|
|
69
|
-
"s" === l ? (c(t, T(...p(r))), c(_(t), v(...p(r)))) : c(t, r, "f" === l);
|
|
70
|
-
}
|
|
71
|
-
return r = o({}, O), n(s, r), s;
|
|
72
|
-
}
|
|
73
|
-
}, c = (e, t, r) => {
|
|
74
|
-
O[e] = { get() {
|
|
75
|
-
let n = r ? (...e) => m(this, t(...e)) : m(this, t);
|
|
76
|
-
return l(this, e, { value: n }), n;
|
|
77
|
-
} };
|
|
78
|
-
}, a = t > 0, w = (e, t) => a ? {
|
|
79
|
-
open: `[${e}m`,
|
|
80
|
-
close: `[${t}m`
|
|
81
|
-
} : g, y = (e) => (t) => e(...p(t)), R = (e, t) => (r, l, n) => w(`${e}8;2;${r};${l};${n}`, t), $ = (e, t) => (r, l, n) => w(((e, t, r) => d(u(e, t, r)))(r, l, n) + e, t), x = (e) => (t, r, l) => e(u(t, r, l)), T = R(3, h), v = R(4, b), C = (e) => w("38;5;" + e, h), E = (e) => w("48;5;" + e, b);
|
|
82
|
-
2 === t ? (T = x(C), v = x(E)) : 1 === t && (T = $(0, h), v = $(10, b), C = (e) => w(d(e), h), E = (e) => w(d(e) + 10, b));
|
|
83
|
-
let M, I = {
|
|
84
|
-
fg: C,
|
|
85
|
-
bg: E,
|
|
86
|
-
rgb: T,
|
|
87
|
-
bgRgb: v,
|
|
88
|
-
hex: y(T),
|
|
89
|
-
bgHex: y(v),
|
|
90
|
-
visible: g,
|
|
91
|
-
reset: w(0, 0),
|
|
92
|
-
bold: w(1, 22),
|
|
93
|
-
dim: w(2, 22),
|
|
94
|
-
italic: w(3, 23),
|
|
95
|
-
underline: w(4, 24),
|
|
96
|
-
inverse: w(7, 27),
|
|
97
|
-
hidden: w(8, 28),
|
|
98
|
-
strikethrough: w(9, 29)
|
|
99
|
-
}, _ = (e) => "bg" + e[0].toUpperCase() + e.slice(1), k = "Bright";
|
|
100
|
-
return "black,red,green,yellow,blue,magenta,cyan,white,gray".split(",").map(((e, t) => {
|
|
101
|
-
M = _(e), 8 > t ? (I[e + k] = w(90 + t, h), I[M + k] = w(100 + t, b)) : t = 60, I[e] = w(30 + t, h), I[M] = w(40 + t, b);
|
|
102
|
-
})), s.extend(I);
|
|
103
|
-
}();
|
|
104
|
-
module.exports = w, w.default = w;
|
|
105
|
-
})))(), 1);
|
|
106
|
-
var ansis_default = import_ansis.default;
|
|
107
|
-
const { Ansis, fg, bg, rgb, bgRgb, hex, bgHex, reset, inverse, hidden, visible, bold, dim, italic, underline, strikethrough, black, red, green, yellow, blue, magenta, cyan, white, gray, redBright, greenBright, yellowBright, blueBright, magentaBright, cyanBright, whiteBright, bgBlack, bgRed, bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite, bgGray, bgRedBright, bgGreenBright, bgYellowBright, bgBlueBright, bgMagentaBright, bgCyanBright, bgWhiteBright } = import_ansis.default;
|
|
108
|
-
//#endregion
|
|
109
|
-
//#region src/utils/colors.ts
|
|
110
|
-
const colors = {
|
|
111
|
-
blue: ansis_default.blue,
|
|
112
|
-
cyan: ansis_default.cyan,
|
|
113
|
-
gray: ansis_default.gray,
|
|
114
|
-
green: ansis_default.green,
|
|
115
|
-
red: ansis_default.red,
|
|
116
|
-
yellow: ansis_default.yellow,
|
|
117
|
-
bold: ansis_default.bold,
|
|
118
|
-
dim: ansis_default.dim,
|
|
119
|
-
reset: ansis_default.reset,
|
|
120
|
-
underline: ansis_default.underline
|
|
121
|
-
};
|
|
122
|
-
//#endregion
|
|
123
|
-
export { colors as t };
|
package/dist/hash-BHZbo80D.mjs
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { createHash } from "node:crypto";
|
|
2
|
-
//#region ../../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/shared/ohash.D__AXeF1.mjs
|
|
3
|
-
function serialize(o) {
|
|
4
|
-
return typeof o == "string" ? `'${o}'` : new c().serialize(o);
|
|
5
|
-
}
|
|
6
|
-
const c = /* @__PURE__ */ function() {
|
|
7
|
-
class o {
|
|
8
|
-
#t = /* @__PURE__ */ new Map();
|
|
9
|
-
compare(t, r) {
|
|
10
|
-
const e = typeof t, n = typeof r;
|
|
11
|
-
return e === "string" && n === "string" ? t.localeCompare(r) : e === "number" && n === "number" ? t - r : String.prototype.localeCompare.call(this.serialize(t, true), this.serialize(r, true));
|
|
12
|
-
}
|
|
13
|
-
serialize(t, r) {
|
|
14
|
-
if (t === null) return "null";
|
|
15
|
-
switch (typeof t) {
|
|
16
|
-
case "string": return r ? t : `'${t}'`;
|
|
17
|
-
case "bigint": return `${t}n`;
|
|
18
|
-
case "object": return this.$object(t);
|
|
19
|
-
case "function": return this.$function(t);
|
|
20
|
-
}
|
|
21
|
-
return String(t);
|
|
22
|
-
}
|
|
23
|
-
serializeObject(t) {
|
|
24
|
-
const r = Object.prototype.toString.call(t);
|
|
25
|
-
if (r !== "[object Object]") return this.serializeBuiltInType(r.length < 10 ? `unknown:${r}` : r.slice(8, -1), t);
|
|
26
|
-
const e = t.constructor, n = e === Object || e === void 0 ? "" : e.name;
|
|
27
|
-
if (n !== "" && globalThis[n] === e) return this.serializeBuiltInType(n, t);
|
|
28
|
-
if (typeof t.toJSON == "function") {
|
|
29
|
-
const i = t.toJSON();
|
|
30
|
-
return n + (i !== null && typeof i == "object" ? this.$object(i) : `(${this.serialize(i)})`);
|
|
31
|
-
}
|
|
32
|
-
return this.serializeObjectEntries(n, Object.entries(t));
|
|
33
|
-
}
|
|
34
|
-
serializeBuiltInType(t, r) {
|
|
35
|
-
const e = this["$" + t];
|
|
36
|
-
if (e) return e.call(this, r);
|
|
37
|
-
if (typeof r?.entries == "function") return this.serializeObjectEntries(t, r.entries());
|
|
38
|
-
throw new Error(`Cannot serialize ${t}`);
|
|
39
|
-
}
|
|
40
|
-
serializeObjectEntries(t, r) {
|
|
41
|
-
const e = Array.from(r).sort((i, a) => this.compare(i[0], a[0]));
|
|
42
|
-
let n = `${t}{`;
|
|
43
|
-
for (let i = 0; i < e.length; i++) {
|
|
44
|
-
const [a, l] = e[i];
|
|
45
|
-
n += `${this.serialize(a, true)}:${this.serialize(l)}`, i < e.length - 1 && (n += ",");
|
|
46
|
-
}
|
|
47
|
-
return n + "}";
|
|
48
|
-
}
|
|
49
|
-
$object(t) {
|
|
50
|
-
let r = this.#t.get(t);
|
|
51
|
-
return r === void 0 && (this.#t.set(t, `#${this.#t.size}`), r = this.serializeObject(t), this.#t.set(t, r)), r;
|
|
52
|
-
}
|
|
53
|
-
$function(t) {
|
|
54
|
-
const r = Function.prototype.toString.call(t);
|
|
55
|
-
return r.slice(-15) === "[native code] }" ? `${t.name || ""}()[native]` : `${t.name}(${t.length})${r.replace(/\s*\n\s*/g, "")}`;
|
|
56
|
-
}
|
|
57
|
-
$Array(t) {
|
|
58
|
-
let r = "[";
|
|
59
|
-
for (let e = 0; e < t.length; e++) r += this.serialize(t[e]), e < t.length - 1 && (r += ",");
|
|
60
|
-
return r + "]";
|
|
61
|
-
}
|
|
62
|
-
$Date(t) {
|
|
63
|
-
try {
|
|
64
|
-
return `Date(${t.toISOString()})`;
|
|
65
|
-
} catch {
|
|
66
|
-
return "Date(null)";
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
$ArrayBuffer(t) {
|
|
70
|
-
return `ArrayBuffer[${new Uint8Array(t).join(",")}]`;
|
|
71
|
-
}
|
|
72
|
-
$Set(t) {
|
|
73
|
-
return `Set${this.$Array(Array.from(t).sort((r, e) => this.compare(r, e)))}`;
|
|
74
|
-
}
|
|
75
|
-
$Map(t) {
|
|
76
|
-
return this.serializeObjectEntries("Map", t.entries());
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
for (const s of [
|
|
80
|
-
"Error",
|
|
81
|
-
"RegExp",
|
|
82
|
-
"URL"
|
|
83
|
-
]) o.prototype["$" + s] = function(t) {
|
|
84
|
-
return `${s}(${t})`;
|
|
85
|
-
};
|
|
86
|
-
for (const s of [
|
|
87
|
-
"Int8Array",
|
|
88
|
-
"Uint8Array",
|
|
89
|
-
"Uint8ClampedArray",
|
|
90
|
-
"Int16Array",
|
|
91
|
-
"Uint16Array",
|
|
92
|
-
"Int32Array",
|
|
93
|
-
"Uint32Array",
|
|
94
|
-
"Float32Array",
|
|
95
|
-
"Float64Array"
|
|
96
|
-
]) o.prototype["$" + s] = function(t) {
|
|
97
|
-
return `${s}[${t.join(",")}]`;
|
|
98
|
-
};
|
|
99
|
-
for (const s of ["BigInt64Array", "BigUint64Array"]) o.prototype["$" + s] = function(t) {
|
|
100
|
-
return `${s}[${t.join("n,")}${t.length > 0 ? "n" : ""}]`;
|
|
101
|
-
};
|
|
102
|
-
return o;
|
|
103
|
-
}();
|
|
104
|
-
//#endregion
|
|
105
|
-
//#region ../../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs
|
|
106
|
-
const e = globalThis.process?.getBuiltinModule?.("crypto")?.hash, r = "sha256", s = "base64url";
|
|
107
|
-
function digest(t) {
|
|
108
|
-
if (e) return e(r, t, s);
|
|
109
|
-
const o = createHash(r).update(t);
|
|
110
|
-
return globalThis.process?.versions?.webcontainer ? o.digest().toString(s) : o.digest(s);
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region ../../../node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/index.mjs
|
|
114
|
-
function hash$1(input) {
|
|
115
|
-
return digest(serialize(input));
|
|
116
|
-
}
|
|
117
|
-
//#endregion
|
|
118
|
-
//#region src/utils/hash.ts
|
|
119
|
-
/**
|
|
120
|
-
* Stable, deterministic hash of any structured-cloneable value.
|
|
121
|
-
*/
|
|
122
|
-
function hash(value) {
|
|
123
|
-
return hash$1(value);
|
|
124
|
-
}
|
|
125
|
-
//#endregion
|
|
126
|
-
export { hash as t };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { homedir } from "node:os";
|
|
2
|
-
import process from "node:process";
|
|
3
|
-
import { join } from "pathe";
|
|
4
|
-
//#region src/node/host-h3.ts
|
|
5
|
-
/**
|
|
6
|
-
* h3-backed {@link DevToolsHost} — used by the standalone CLI adapter.
|
|
7
|
-
*/
|
|
8
|
-
function createH3DevToolsHost(options) {
|
|
9
|
-
const workspaceRoot = options.workspaceRoot ?? process.cwd();
|
|
10
|
-
return {
|
|
11
|
-
mountStatic(base, distDir) {
|
|
12
|
-
return options.mount?.(base, distDir);
|
|
13
|
-
},
|
|
14
|
-
resolveOrigin() {
|
|
15
|
-
return options.origin;
|
|
16
|
-
},
|
|
17
|
-
getStorageDir(scope) {
|
|
18
|
-
const namespace = `.${options.appName}/devtools`;
|
|
19
|
-
return scope === "workspace" ? join(workspaceRoot, "node_modules", namespace) : join(homedir(), namespace);
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
//#endregion
|
|
24
|
-
export { createH3DevToolsHost as t };
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { n as dumpFunctions, s as getRpcHandler } from "./rpc-CkZuoz-m.mjs";
|
|
2
|
-
import { DEVTOOLS_RPC_DUMP_DIRNAME } from "./constants.mjs";
|
|
3
|
-
//#region src/node/static-dump.ts
|
|
4
|
-
function makeDumpKey(name) {
|
|
5
|
-
return encodeURIComponent(name.replaceAll(":", "~"));
|
|
6
|
-
}
|
|
7
|
-
function makeStaticPath(name) {
|
|
8
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.static.json`;
|
|
9
|
-
}
|
|
10
|
-
function makeQueryRecordPath(name, hash) {
|
|
11
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.record.${hash}.json`;
|
|
12
|
-
}
|
|
13
|
-
function makeQueryFallbackPath(name) {
|
|
14
|
-
return `${DEVTOOLS_RPC_DUMP_DIRNAME}/${makeDumpKey(name)}.fallback.json`;
|
|
15
|
-
}
|
|
16
|
-
async function resolveRecord(record) {
|
|
17
|
-
return typeof record === "function" ? await record() : record;
|
|
18
|
-
}
|
|
19
|
-
async function collectStaticRpcDump(definitions, context) {
|
|
20
|
-
const manifest = {};
|
|
21
|
-
const files = {};
|
|
22
|
-
for (const definition of definitions) {
|
|
23
|
-
const type = definition.type ?? "query";
|
|
24
|
-
const serialization = definition.jsonSerializable === true ? "json" : "structured-clone";
|
|
25
|
-
if (type === "static") {
|
|
26
|
-
const handler = await getRpcHandler(definition, context);
|
|
27
|
-
const path = makeStaticPath(definition.name);
|
|
28
|
-
files[path] = {
|
|
29
|
-
serialization,
|
|
30
|
-
fnName: definition.name,
|
|
31
|
-
data: { output: await Promise.resolve(handler()) }
|
|
32
|
-
};
|
|
33
|
-
manifest[definition.name] = {
|
|
34
|
-
type: "static",
|
|
35
|
-
path,
|
|
36
|
-
serialization
|
|
37
|
-
};
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (type !== "query") continue;
|
|
41
|
-
const store = await dumpFunctions([definition], context);
|
|
42
|
-
if (!(definition.name in store.definitions)) continue;
|
|
43
|
-
const queryEntry = {
|
|
44
|
-
type: "query",
|
|
45
|
-
records: {},
|
|
46
|
-
serialization
|
|
47
|
-
};
|
|
48
|
-
const prefix = `${definition.name}---`;
|
|
49
|
-
for (const [recordKey, recordOrGetter] of Object.entries(store.records)) {
|
|
50
|
-
if (!recordKey.startsWith(prefix)) continue;
|
|
51
|
-
const key = recordKey.slice(prefix.length);
|
|
52
|
-
const record = await resolveRecord(recordOrGetter);
|
|
53
|
-
if (key === "fallback") {
|
|
54
|
-
const path = makeQueryFallbackPath(definition.name);
|
|
55
|
-
files[path] = {
|
|
56
|
-
serialization,
|
|
57
|
-
fnName: definition.name,
|
|
58
|
-
data: record
|
|
59
|
-
};
|
|
60
|
-
queryEntry.fallback = path;
|
|
61
|
-
} else {
|
|
62
|
-
const path = makeQueryRecordPath(definition.name, key);
|
|
63
|
-
files[path] = {
|
|
64
|
-
serialization,
|
|
65
|
-
fnName: definition.name,
|
|
66
|
-
data: record
|
|
67
|
-
};
|
|
68
|
-
queryEntry.records[key] = path;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (!Object.keys(queryEntry.records).length && !queryEntry.fallback) continue;
|
|
72
|
-
manifest[definition.name] = queryEntry;
|
|
73
|
-
}
|
|
74
|
-
return {
|
|
75
|
-
manifest,
|
|
76
|
-
files
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
//#endregion
|
|
80
|
-
export { collectStaticRpcDump as t };
|
|
File without changes
|
|
File without changes
|