Migrate Specberus to TypeScript and improve API surface#2134
Merged
Conversation
deniak
approved these changes
Jun 29, 2026
Co-authored-by: Denis Ah-Kang <1696128+deniak@users.noreply.github.com>
…ises (#2106) Additional improvements: - Switch all fs function usage in validator.ts to fs/promises - Remove Specberus#clearCache - Add Specberus#load which performs common logic of branching to loadFile/loadURL/loadSource (which are now also private) - Mark more class members as private where feasible - Replace sr.throw calls within rules with actual throw statements, centralizing all throw method calls within validator.ts, ensuring that rejection occurs in response to unexpected errors - Remove start-all/end-all events; use promise APIs in app, api, and tests - Remove doasync (and reorganize some variables for better type safety) - Remove public meta property; rely on resolved promise value instead - Make Specberus emit events directly; thoroughly define event types - Remove unused parameter from extractHeaders - lib/util: Remove unused parameter names; update JSDoc - Fire 'done' event even if an exception occurs - app.ts: Consistently report misc. (non-'exception') errors - Add new/missing test cases - Update docs (including some long-overdue updates) --------- Co-authored-by: Denis Ah-Kang <1696128+deniak@users.noreply.github.com>
Co-authored-by: Denis Ah-Kang <1696128+deniak@users.noreply.github.com>
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.
Reminder: This should be rebase-merged to keep individual commit messages for the release notes
This PR is to merge the
typescriptbranch, which has received a number of already-reviewed PRs:The major points:
node:testmodulespecberus.js, changed fromvalidator.js)In addition to removing Node v20 support within this repo, this branch performs major-version upgrades of dependencies which have also removed v20 support in their latest versions. We had intentionally held these back until this upgrade across the codebase.
Along the way I have checked that existing tests continue to operate as expected and continue to pass. I have also performed tests consuming
specberus@12.3.1andspecberus-13.0.0.tgz(vianpm pack) to confirm identical output for equivalent input.I've also tested consuming this in the context of the following projects that consume specberus:
npm testnpm run typecheck, and ensuring theprofilesexport fromlib/utilcontains the same information in v12 and v13