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

[docs] add JSDocs for Vite build process #5517

Closed
wants to merge 4 commits into from
Closed

[docs] add JSDocs for Vite build process #5517

wants to merge 4 commits into from

Conversation

benmccann
Copy link
Member

@benmccann benmccann commented Jul 14, 2022

Also refactored out a couple of methods to make writeBundle a little shorter and moved a few log statements to better align with code boundaries

@changeset-bot
Copy link

changeset-bot bot commented Jul 14, 2022

⚠️ No Changeset found

Latest commit: 7496850

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment on lines 394 to 401
for (const key of Object.keys(bundle)) {
// collect asset and output chunks
if (bundle[key].type === 'asset') {
assets.push(/** @type {import('rollup').OutputAsset} */ (bundle[key]));
} else {
chunks.push(/** @type {import('rollup').OutputChunk} */ (bundle[key]));
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The key isn't used directly, might as well refactor it to Object.values while we're here.

Copy link
Member

Choose a reason for hiding this comment

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

Yep, we can also leverage TS control flow for discriminated unions and remove the type assertion.

@Rich-Harris
Copy link
Member

I merged this into vite-3 FYI, so we can close this when #5005 is merged if that doesn't happen automatically

@benmccann benmccann closed this Jul 14, 2022
@benmccann benmccann deleted the vite-docs branch July 14, 2022 15:16
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