@devframes/plugin-messages 0.0.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/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-PRESENT Anthony Fu <https://github.com/antfu>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,49 @@
1
+ # @devframes/plugin-messages
2
+
3
+ > [!WARNING] Experimental
4
+ > This plugin is experimental and may change without a major version bump until
5
+ > it stabilizes.
6
+
7
+ A devframe plugin that surfaces the hub message feed (`ctx.messages`) as a
8
+ portable panel: browse diagnostics and notifications from every mounted tool,
9
+ filter by level / source / category / label, inspect stack traces, element and
10
+ file positions, and jump to the offending file in your editor.
11
+
12
+ Ported from the built-in Messages view of
13
+ [`vitejs/devtools`](https://github.com/vitejs/devtools); rebuilt on devframe's
14
+ framework-neutral client (`connectDevframe`) with a Vue + Vite SPA, reading the
15
+ feed through `@devframes/hub`'s `listSince` delta API.
16
+
17
+ ## Mount into a hub
18
+
19
+ ```ts
20
+ import { mountDevframe } from '@devframes/hub/node'
21
+ import messagesDevframe from '@devframes/plugin-messages'
22
+
23
+ await mountDevframe(hubContext, messagesDevframe)
24
+ ```
25
+
26
+ The hub's `ctx.messages` host feeds the panel live — every
27
+ `ctx.messages.add(...)` from any mounted tool shows up, updates stream over
28
+ the `devframe:messages:updated` broadcast, and dismissals write back through
29
+ the plugin's namespaced RPCs. On a plain (non-hub) context the plugin warns
30
+ (`DP_MESSAGES_0001`) and serves an empty feed.
31
+
32
+ ## Embed the panel directly
33
+
34
+ ```ts
35
+ import { mountMessages } from '@devframes/plugin-messages/client'
36
+
37
+ const handle = await mountMessages(document.querySelector('#panel')!, {
38
+ rpc, // optional — reuse the host page's client
39
+ })
40
+ ```
41
+
42
+ ## Standalone
43
+
44
+ ```bash
45
+ npx @devframes/plugin-messages
46
+ ```
47
+
48
+ `pnpm dev` in this package self-hosts the SPA against a demo-seeded messages
49
+ host, so the feed is lively without a full hub.
package/bin.mjs ADDED
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ import process from 'node:process'
3
+ import { createMessagesCli } from './dist/cli.mjs'
4
+
5
+ async function main() {
6
+ const cli = createMessagesCli()
7
+ await cli.parse()
8
+ }
9
+
10
+ main().catch((error) => {
11
+ console.error(error)
12
+ process.exit(1)
13
+ })
package/dist/cli.d.mts ADDED
@@ -0,0 +1,12 @@
1
+ import { CliHandle } from "devframe/adapters/cli";
2
+
3
+ //#region src/cli.d.ts
4
+ /**
5
+ * Build the standalone CLI for the messages panel — backs the package `bin`
6
+ * (`devframe-messages`) and `npx @devframes/plugin-messages`. Wraps the
7
+ * default {@link createMessagesDevframe} definition with devframe's
8
+ * `dev` / `build` / `spa` / `mcp` command shell.
9
+ */
10
+ declare function createMessagesCli(): CliHandle;
11
+ //#endregion
12
+ export { createMessagesCli };
package/dist/cli.mjs ADDED
@@ -0,0 +1,14 @@
1
+ import { n as messagesDevframe } from "./src-CY7M8Mzi.mjs";
2
+ import { createCli } from "devframe/adapters/cli";
3
+ //#region src/cli.ts
4
+ /**
5
+ * Build the standalone CLI for the messages panel — backs the package `bin`
6
+ * (`devframe-messages`) and `npx @devframes/plugin-messages`. Wraps the
7
+ * default {@link createMessagesDevframe} definition with devframe's
8
+ * `dev` / `build` / `spa` / `mcp` command shell.
9
+ */
10
+ function createMessagesCli() {
11
+ return createCli(messagesDevframe);
12
+ }
13
+ //#endregion
14
+ export { createMessagesCli };