Skip to content

Commit 04b4080

Browse files
committed
chore: update
2 parents 7d44d08 + 4a409f5 commit 04b4080

50 files changed

Lines changed: 2710 additions & 2001 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
19-
with:
20-
submodules: recursive
2119

2220
- name: Install pnpm
2321
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093
@@ -55,8 +53,6 @@ jobs:
5553
fail-fast: false
5654
steps:
5755
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
58-
with:
59-
submodules: recursive
6056

6157
- name: Install pnpm
6258
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093
@@ -82,8 +78,6 @@ jobs:
8278
runs-on: ubuntu-latest
8379
steps:
8480
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
85-
with:
86-
submodules: recursive
8781

8882
- name: Install pnpm
8983
uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093

.github/workflows/src/ci.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- uses: actions/checkout@v5
20-
with:
21-
submodules: recursive
2220

2321
- name: Install pnpm
2422
uses: pnpm/action-setup@v4
@@ -54,8 +52,6 @@ jobs:
5452

5553
steps:
5654
- uses: actions/checkout@v5
57-
with:
58-
submodules: recursive
5955

6056
- name: Install pnpm
6157
uses: pnpm/action-setup@v4
@@ -82,8 +78,6 @@ jobs:
8278

8379
steps:
8480
- uses: actions/checkout@v5
85-
with:
86-
submodules: recursive
8781

8882
- name: Install pnpm
8983
uses: pnpm/action-setup@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ packages/kit/skills
2020
**/.vitepress/cache
2121
.turbo
2222
.context
23+
.ghfs
2324

2425
# Agent skills from npm packages (managed by skills-npm)
2526
**/skills/npm-*

.gitmodules

Lines changed: 0 additions & 3 deletions
This file was deleted.

AGENTS.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
Two layers, one mental model:
66

7-
- **`devframe`***the container for one devtool integration, portable across viewers.* External project; lives at [`github.com/devframes/devframe`](https://github.com/devframes/devframe), docs at [`devfra.me`](https://devfra.me). Consumed here as an npm dependency (`catalog:deps`). A checked-in submodule at `devframe/` mirrors the source at the pinned tag for browsing and upstream contributions.
7+
- **`devframe`***the container for one devtool integration, portable across viewers.* External project; lives at [`github.com/devframes/devframe`](https://github.com/devframes/devframe), docs at [`devfra.me`](https://devfra.me). Consumed here as an npm dependency (`catalog:deps`).
88
- **`@vitejs/devtools-kit`***the hub that unites many devtools integrations.* Owns docking, the command palette, toasts, terminal sessions — anything that only makes sense when more than one tool shares a UI. Provides `createPluginFromDevframe(devframeApp)` so a portable devframe definition drops into Vite DevTools as a Vite plugin, with the dock entry auto-derived from the definition's metadata.
99

1010
When deciding where something belongs: if a single-app standalone CLI would still need it, it belongs upstream in devframe; if it only matters once you have multiple integrations or a host UI, it lives in the kit.
@@ -28,8 +28,6 @@ Monorepo (`pnpm` workspaces + `turbo`). ESM TypeScript; bundled with `tsdown`. P
2828
Other top-level directories:
2929
- `docs/` — VitePress docs; guides in `docs/guide/`
3030
- `skills/` — Agent skill files generated from docs via [Agent Skills](https://agentskills.io/home). Structured references (RPC patterns, dock types, shared state, project structure) for AI agent context.
31-
- `devframe/` — Git submodule pinned to the `devframe` version in `catalogs.deps`. Run `pnpm sync` to align with the catalog; `pnpm sync <version>` or `pnpm sync --latest` to bump.
32-
- `scripts/sync.ts` — Submodule pin manager (see `pnpm sync --help`).
3331

3432
```mermaid
3533
flowchart TD
@@ -125,11 +123,13 @@ Codes are sequential 4-digit numbers per prefix (e.g. `DTK0033`, `RDDT0003`). Ch
125123
import { diagnostics } from './diagnostics'
126124

127125
// For thrown errors — always prefix with `throw` for TypeScript control flow:
128-
throw diagnostics.DTK0033.throw({ name })
126+
throw diagnostics.DTK0033({ name })
129127

130-
// For reported (non-thrown) diagnostics:
131-
diagnostics.DTK0033.report({ name })
132-
diagnostics.DTK0033.report({ name, cause: error }) // attach cause via params
128+
// For reported (non-thrown) diagnostics. The default console method is `warn`;
129+
// override with the 2nd-arg reporter options when needed:
130+
diagnostics.DTK0033({ name }) // console.warn
131+
diagnostics.DTK0033({ name }, { method: 'error' }) // console.error
132+
diagnostics.DTK0033({ name, cause: error }) // attach cause via params
133133
```
134134

135135
3. **Create a docs page** at `docs/errors/DTK0033.md`:

MIGRATION.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,20 @@ These types are no longer re-exported from `@vitejs/devtools-kit`. Import them f
5050
```
5151

5252
The `@vitejs/devtools-kit/utils/when` subpath remains and re-exports these types alongside `evaluateWhen` and `resolveContextValue`.
53+
54+
#### Diagnostic handles are callable
55+
56+
`nostics` 0.2 (pulled in via devframe 0.4) drops the `.report()` / `.throw()` methods on diagnostic handles. Each handle is now a callable that builds and emits a diagnostic; prefix with `throw` to raise.
57+
58+
```diff
59+
- throw ctx.diagnostics.logger.MYP0001.throw({ name })
60+
+ throw ctx.diagnostics.logger.MYP0001({ name })
61+
62+
- ctx.diagnostics.logger.MYP0002.report()
63+
+ ctx.diagnostics.logger.MYP0002()
64+
65+
- ctx.diagnostics.logger.MYP0002.report({ name }, { method: 'error' })
66+
+ ctx.diagnostics.logger.MYP0002({ name }, { method: 'error' })
67+
```
68+
69+
The payload shape (including `cause`) and the optional reporter-options second argument are unchanged. Apply the same rewrite to typed handles returned from `ctx.diagnostics.defineDiagnostics()`.

docs/.vitepress/config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ export default extendConfig(withMermaid(defineConfig({
6161
'packages/**',
6262
'examples/**',
6363
'tests/**',
64-
'devframe/**',
6564
'docs/.vitepress/**',
6665
'.github/**',
6766
'.context/**',

docs/kit/diagnostics.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
interface DevToolsDiagnosticsHost {
1414
/**
1515
* Proxy-backed lookup of every registered code by name. Each entry is a
16-
* `nostics` handle with `.report()` and `.throw()` methods.
16+
* `nostics` `DiagnosticHandle` — a callable that builds a diagnostic and
17+
* routes it through registered reporters; prefix with `throw` to raise.
1718
*/
1819
readonly logger: Record<string, any>
1920

@@ -56,7 +57,7 @@ export function MyPlugin(): PluginWithDevTools {
5657
ctx.diagnostics.register(diagnostics)
5758

5859
// Emit codes through the shared lookup:
59-
ctx.diagnostics.logger.MYP0002.report()
60+
ctx.diagnostics.logger.MYP0002()
6061
},
6162
},
6263
}
@@ -80,23 +81,26 @@ Each definition supports `why` (string or function returning a string) and an op
8081

8182
## Emit a diagnostic
8283

83-
Each registered code is reachable as a property on `ctx.diagnostics.logger`. Every handle exposes `.throw(params)` and `.report(params)`.
84+
Each registered code is reachable as a property on `ctx.diagnostics.logger`. Every handle is a callable — invoke it to report (returns the `Diagnostic`), or prefix with `throw` to raise.
8485

8586
```ts
8687
// Throw — control flow stops here
87-
throw ctx.diagnostics.logger.MYP0001.throw({ name: 'foo' })
88+
throw ctx.diagnostics.logger.MYP0001({ name: 'foo' })
8889

89-
// Report without throwing (goes through the host's reporter)
90-
ctx.diagnostics.logger.MYP0002.report()
90+
// Report without throwing (default console method: `warn`)
91+
ctx.diagnostics.logger.MYP0002()
92+
93+
// Override the console method per call
94+
ctx.diagnostics.logger.MYP0002({}, { method: 'error' })
9195

9296
// Attach a `cause` via the params object
93-
ctx.diagnostics.logger.MYP0001.report({ name: 'foo', cause: error })
97+
ctx.diagnostics.logger.MYP0001({ name: 'foo', cause: error })
9498
```
9599

96-
`.throw()` is typed `never`. Prefix the call with `throw` so TypeScript narrows control flow correctly:
100+
The callable returns a `Diagnostic` (which extends `Error`). Prefix with `throw` so TypeScript narrows the lines after as unreachable:
97101

98102
```ts
99-
throw ctx.diagnostics.logger.MYP0001.throw({ name })
103+
throw ctx.diagnostics.logger.MYP0001({ name })
100104
```
101105

102106
## Typed handle reference
@@ -115,7 +119,7 @@ const myDiagnostics = ctx.diagnostics.defineDiagnostics({
115119
ctx.diagnostics.register(myDiagnostics)
116120

117121
// Use the typed handle directly at emit sites
118-
myDiagnostics.MYP0001.report({ name: 'foo' })
122+
myDiagnostics.MYP0001({ name: 'foo' })
119123
```
120124

121125
Both paths share the formatter and reporter defaults set by the host (ANSI console output).
@@ -135,7 +139,7 @@ Each page covers the message, cause, example, and fix; see any [DTK code page](/
135139

136140
## When to use what
137141

138-
- **`ctx.diagnostics`** — coded conditions worth looking up: misconfiguration, deprecations, validation failures, internal invariants. Always docs-backed. Often `.throw()`.
142+
- **`ctx.diagnostics`** — coded conditions worth looking up: misconfiguration, deprecations, validation failures, internal invariants. Always docs-backed. Often `throw`-prefixed.
139143
- **[`ctx.messages`](./messages)** — user-facing activity surfaces in the DevTools UI: progress indicators, audit results, "URL copied" toasts. Just a message and a level.
140144

141145
Diagnostics target tool authors and CI; messages target the human in front of the DevTools panel.

e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@vitejs/devtools-e2e",
33
"type": "module",
4-
"version": "0.1.24",
4+
"version": "0.2.0",
55
"private": true,
66
"scripts": {
77
"test": "vitest --run"

examples/plugin-a11y-checker/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "example-plugin-a11y-checker",
33
"type": "module",
4-
"version": "0.1.24",
4+
"version": "0.2.0",
55
"private": true,
66
"exports": {
77
".": "./dist/index.mjs",

0 commit comments

Comments
 (0)