Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[types] Generate @cloudflare/workers-types with a Worker #2405

Merged
merged 5 commits into from
Jul 18, 2024

Conversation

penalosa
Copy link
Collaborator

@penalosa penalosa commented Jul 17, 2024

Continuing to land #1959 piecemeal. This will probably be the final part we land.

This PR does not change the type generation output, which is identical before and after this PR.

The primary purpose is to add a Worker which does type generation using the workerd:rtti module. That worker is typed under it's own output. This works because we use esbuild to build the Worker, which only does type-stripping.

Because we now have a Worker to generate types, we use that in CI to construct the @cloudflare/workers-types package, removing much of the old code for doing that. Of note: this PR also disables dealing with internal modules (cloudflare-internal:email), and turns off type generation for modules like cloudflare:email (relying on the existing manually written types). This is because the type definitions included both cloudflare-internal:email and cloudflare:email, which led to a fairly confusing user experience when consuming the types. This is something we should figure out a better forward on.

@penalosa penalosa changed the title Add a type generating worker [types] Generate Types with a Worker Jul 17, 2024
@penalosa penalosa changed the title [types] Generate Types with a Worker [types] Generate @cloudflare/workers-types with a Worker Jul 17, 2024
@penalosa penalosa mentioned this pull request Jul 17, 2024
3 tasks
@penalosa penalosa marked this pull request as ready for review July 17, 2024 16:17
@penalosa penalosa requested review from a team as code owners July 17, 2024 16:17
Copy link
Contributor

@andyjessop andyjessop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@penalosa penalosa closed this Jul 18, 2024
@penalosa penalosa reopened this Jul 18, 2024
@penalosa penalosa merged commit 0455ed3 into main Jul 18, 2024
17 checks passed
ns476 pushed a commit to ns476/workerd that referenced this pull request Aug 2, 2024
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.

4 participants