Skip to content
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bef96d3
feat(nuxt-typed-handler): scaffold the umbrella module over both pare…
DPHonys Aug 22, 2026
777c396
feat(nuxt-typed-handler): land defineTypedEventHandler with the built…
DPHonys Aug 22, 2026
26939b2
test(nuxt-typed-handler): prove the four entries and the wire from a …
DPHonys Aug 22, 2026
62162a4
chore(nuxt-typed-handler): keep the package private until its admission
DPHonys Aug 22, 2026
3dfe609
refactor(nuxt-typed-handler): trim the types door to what the wrapper…
DPHonys Aug 22, 2026
452ea6d
feat(nuxt-typed-handler): type the typed fetch call sites per route a…
DPHonys Aug 22, 2026
58bb15d
feat(nuxt-typed-handler): bind the whole typed fetch family to the um…
DPHonys Aug 22, 2026
1afa27f
feat(nuxt-typed-handler): carry both route maps in one generated decl…
DPHonys Aug 22, 2026
292be12
feat(nuxt-typed-handler): resolve both parents' /types from this modu…
DPHonys Aug 22, 2026
5ad4be5
feat(nuxt-typed-handler): type the playground's call sites against th…
DPHonys Aug 22, 2026
63fd71b
test(nuxt-typed-handler): render both maps in a real app's two programs
DPHonys Aug 22, 2026
3b9690e
test(nuxt-typed-handler): prove one handler carries both parents' brands
DPHonys Aug 22, 2026
c5e21cb
docs(nuxt-typed-handler): make the README the one door a consumer ado…
DPHonys Aug 22, 2026
fbc5f98
test(nuxt-typed-handler): keep each runtime door out of the other's b…
DPHonys Aug 22, 2026
f364cf4
chore(nuxt-typed-handler): seed the debut version at 0.1.0
DPHonys Aug 22, 2026
af2983f
chore(nuxt-typed-handler): admit the package with its first release i…
DPHonys Aug 22, 2026
2cf5ae5
docs(nuxt-handler-errors): send a two-package install to the umbrella
DPHonys Aug 22, 2026
fe3aede
docs(nuxt-handler-validation): send a two-package install to the umbr…
DPHonys Aug 22, 2026
57d6dc2
build(nuxt-typed-handler): keep a sibling's rebuild out of the umbrel…
DPHonys Aug 22, 2026
79d13db
Merge remote-tracking branch 'origin/main' into feat/nuxt-typed-handler
DPHonys Aug 23, 2026
91d2e2f
build(nuxt-typed-handler): pin both parents at their published 0.4.0 …
DPHonys Aug 23, 2026
6c424ac
test: keep every package's vitest config in one shared shape
DPHonys Aug 23, 2026
0920b53
docs: keep each parent readme about its own package
DPHonys Aug 23, 2026
f064dd6
refactor(nuxt-typed-handler): trim comments to the sibling packages' …
DPHonys Aug 23, 2026
2e0e81a
docs(nuxt-typed-handler): lead the readme with quick start, not migra…
DPHonys Aug 23, 2026
121b964
test: give the types tier a timeout that survives a loaded CI runner
DPHonys Aug 23, 2026
420b3dd
build: declare nuxt as a peer dependency of all three modules
DPHonys Aug 23, 2026
3f3f905
fix(nuxt-typed-handler): refuse an empty validate, and compare the pr…
DPHonys Aug 23, 2026
8678fd1
docs(nuxt-typed-handler): keep the migration sweep out of nuxt.config
DPHonys Aug 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/dull-pens-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@dphonys/nuxt-typed-handler': minor
---

Initial release. `@dphonys/nuxt-typed-handler` is one Nuxt module installed instead of `@dphonys/nuxt-handler-errors` and `@dphonys/nuxt-handler-validation`, composing both through their `internals/*` entries. `defineTypedEventHandler({ validate, errors }, fn)` declares a route's request schemas and its expected failures in one place and hands the handler one flat context - the validated sources, plus `fail` when errors were declared - with a built-in `validation-failed` variant that every validating route carries and no route may declare. The Typed fetch family (`useTypedFetch`, `useLazyTypedFetch`, `useRequestTypedFetch`, `useTypedAsyncData`, `useLazyTypedAsyncData`, `$typedFetch` with `.try`, and `event.$typedFetch`) types every call site per route and method for what it may send - `body` and `query` from the schemas' input types - and for what it can fail with. Both parents' public surfaces are re-exported from `/server`, `/shared` and `/types`, so an app imports everything from one package; both parents are pinned exactly, and a project lists this module or them, never both.
25 changes: 25 additions & 0 deletions knip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,22 @@ export default {
],
},

'packages/nuxt-typed-handler': {
...nuxtModuleWorkspace,

// As in both parents: this package's suites import `@nuxt/schema`'s types.
ignoreDependencies: ['@nuxt/devtools'],

entry: [
...nuxtModuleWorkspace.entry,

// Deliberately broken sources, compiled by path by
// `test/types/compile-harness.ts` so a suite can assert on their
// diagnostics. The package tsconfig excludes them for the same reason.
'test/types/fixtures/**/*.ts',
],
},

'packages/nuxt-handler-validation/playground': {
...playgroundWorkspace,

Expand All @@ -87,5 +103,14 @@ export default {
// `.nuxt`.
entry: ['module-options.check.ts'],
},

'packages/nuxt-typed-handler/playground': {
...playgroundWorkspace,

// As in the validation playground above: compiler-asserted by `vue-tsc`,
// never imported. It lives in an app because the route map it reads is
// only generated inside one.
entry: ['request-typing.check.ts'],
},
},
} satisfies KnipConfig
12 changes: 2 additions & 10 deletions packages/nuxt-handler-errors/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import { fileURLToPath } from 'node:url'
import { defineConfig } from 'vitest/config'

// Three tiers: `unit` is fast, `types` suites are asserted by the compiler
// under `typecheck`, and `e2e` builds real apps. The `include` patterns also
// feed knip's entry points.

// These specifiers only resolve inside a real build, so `unit` aliases them
// to doubles. Scoping the aliases to `unit` is deliberate: the e2e tier must
// see the real thing.
const aliases = [
{
find: /^#app$/,
Expand Down Expand Up @@ -50,9 +43,8 @@ export default defineConfig({
name: 'e2e',
include: ['test/e2e/**/*.test.ts'],
testTimeout: 120_000,
// Every file here writes into a real app's build directory - one
// prepares the playground and edits its emitted map, another builds
// and boots it. Run in parallel they race over the same `.nuxt`.
// Every file here works against a real build directory - run in
// parallel they race over the same `dist` and `.nuxt`.
fileParallelism: false,
},
},
Expand Down
4 changes: 0 additions & 4 deletions packages/nuxt-handler-validation/vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { defineConfig } from 'vitest/config'

// Three tiers, mirroring the sibling: `unit` is fast, `types` suites are
// asserted by the compiler under `typecheck`, and `e2e` works against real
// built artifacts. The `include` patterns also feed knip's entry points.

export default defineConfig({
test: {
projects: [
Expand Down
21 changes: 21 additions & 0 deletions packages/nuxt-typed-handler/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 Daniel Petr Honys

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading
Loading