Skip to content

Initial logic for a new @webref/xref package#1945

Merged
tidoust merged 9 commits into
mainfrom
package-xref
May 19, 2026
Merged

Initial logic for a new @webref/xref package#1945
tidoust merged 9 commits into
mainfrom
package-xref

Conversation

@tidoust
Copy link
Copy Markdown
Member

@tidoust tidoust commented May 15, 2026

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 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@latest branch also needs to be created.

tidoust added 7 commits May 15, 2026 16:24
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
@tidoust tidoust changed the title Initial and incomplete logic for a new @webref/xref package Initial logic for a new @webref/xref package May 19, 2026
@tidoust tidoust marked this pull request as ready for review May 19, 2026 11:51
@tidoust tidoust requested a review from dontcallmedom May 19, 2026 11:52
tidoust added 2 commits May 19, 2026 17:08
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.
@tidoust tidoust merged commit 1bd4b91 into main May 19, 2026
1 check passed
@tidoust tidoust deleted the package-xref branch May 19, 2026 15:29
@tidoust tidoust mentioned this pull request May 19, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants