Remove @deroll/router package and update documentation - #208
Merged
Conversation
The router matched inspect payloads against URL patterns, which made sense when an inspect request *was* an HTTP GET and the payload was the path it was made to. It is now an arbitrary buffer whose encoding the application chooses, and the routing key follows from that choice: a segment of a string, a field of a JSON object, a function selector under ABI. Only the first looks like a URL. The package also carried no knowledge of the Cartesi protocol to justify keeping it — strip bytesToString and emitReport and what remained was path-to-regexp behind a for-loop. Its URL metaphor was leaky besides: match() runs against the whole payload, so query strings never matched. There is no v2 of the package; the published versions are deprecated on npm and stay installable, so v1 applications keep resolving. - docs: new "Dispatching queries" section in Inspect Handlers, covering the string, JSON and ABI cases, plus a migration note explaining the removal and the path-to-regexp equivalent. - create-app: the router library choice and --use-router are gone, and Library is now just "wallet". - examples: router and walletRouter are replaced by a single inspect example that dispatches by hand. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G5beDWDrK7C9gnTJGTpw7Z
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 8dae6b9 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR removes the
@deroll/routerpackage entirely and updates the framework to guide users toward implementing routing directly in their inspect handlers. The router abstraction is no longer necessary since inspect payloads are now arbitrary buffers whose encoding is application-specific.Key Changes
@deroll/routerpackage: Deleted the entire package including source code, tests, configuration, and changelogoverview.mdx,create-router.mdx,add.mdx)inspect-handlers.mdxwith three encoding patterns: string paths, JSON, and ABIrouter.tsandwalletRouter.tsexamplesinspect.tsexample demonstrating direct routing in the handler@deroll/create-app: Removed router option from CLI and template generationImplementation Details
The router previously abstracted URL-pattern matching for inspect requests using
path-to-regexp. Since inspect payloads are now arbitrary buffers with application-chosen encoding, the routing key depends on that encoding:Users are guided to implement routing directly in their handlers using simple
switchstatements or by depending onpath-to-regexpdirectly if pattern matching is needed. The new documentation provides clear examples for all three common encoding patterns.https://claude.ai/code/session_01G5beDWDrK7C9gnTJGTpw7Z