Initial logic for a new @webref/xref package#1945
Merged
Merged
Conversation
This adds most of the logic needed to prepare a new package with the xref database for validation purpose. Via #1198. The package would be called `@webref/xref` and contain both the `dfns` and the `headings` extracts. Simple JavaScript logic in the `index.js` file allows to lookup a URL with fragment. The package would be published on a weekly basis. The logic is limited for now. The expectation is that the lookup function could be extended over time as needed, to allow looking up a term with various search options, similar to how spec authoring tools operate. The package only contains nightly extracts for now. Release extracts could perhaps also be added if needed. No attempt has been made at optimization. The package would contain ~50MB of JSON data and it loads and indexes everything in memory. Still missing: - Version management for the package - Actually publishing the npm package - Adding the release workflow as a trusted publisher for the package
Tests allow us to validate the fact that the package entry points work as intended. The release extracts are needed because, once in a while BCD targets /TR URLs.
As requested in #1874. This led me to simplify the `source` key to be only one of `"dfns"` or `"headings"`. The function no longer reports on how the match was found in particular (which seems preferable in any case if we want to expand the lookup logic over time).
Also a bit of cleanup
@webref/xref package@webref/xref package
dontcallmedom
approved these changes
May 19, 2026
We validate dfns/headings extracts as part of curation, but the `@webref/xref` package gets released outside the context of any curation and there was nothing in place to validate the raw extracts before releasing a new version of the package. New tests now validate the raw dfns and headings extracts, and the release workflow runs these specific tests before it does anything else.
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.
This adds most of the logic needed to prepare a new package with the xref database for validation purpose. Via #1198.
The package would be called
@webref/xrefand contain both thedfnsand theheadingsextracts. Simple JavaScript logic in theindex.jsfile allows to lookup a URL with fragment. The package would be published on a weekly basis.The logic is limited for now. The expectation is that the lookup function could be extended over time as needed, to allow looking up a term with various search options, similar to how spec authoring tools operate.
The package contains both nightly and release extracts. No attempt has been made at optimization. The package would contain ~70MB of JSON data and it loads and indexes everything in memory.
The release script probably does not work as-is, but if the code looks roughly good, I propose to merge as-is and iterate in production as, er, usual. The package needs to be released manually once in any case, and the
@webref/xref@latestbranch also needs to be created.