Skip to content

feat: expose vite options#3776

Merged
mrlubos merged 1 commit intomainfrom
feat/vite-plugin-api
Apr 15, 2026
Merged

feat: expose vite options#3776
mrlubos merged 1 commit intomainfrom
feat/vite-plugin-api

Conversation

@mrlubos
Copy link
Copy Markdown
Member

@mrlubos mrlubos commented Apr 15, 2026

Closes #3775

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@mrlubos mrlubos marked this pull request as ready for review April 15, 2026 09:30
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog bot commented Apr 15, 2026

Reviewed PR #3776. The change cleanly exposes a vite option on heyApiPlugin typed as Omit<Plugin, 'configResolved' | 'name'>, with correct spread ordering so enforce is overridable while configResolved and name remain pinned. No issues found — approved.

Task list (4/4 completed)
  • Read the PR diff to understand changes
  • Read relevant source files for context
  • Analyze changes and draft review
  • Submit review

Pullfrog  | View workflow run | via Pullfrog𝕏

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: 664cf85

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/vite-plugin Patch

Not sure what this means? Click here to learn what changesets are.

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

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hey-api-docs Ready Ready Preview, Comment Apr 15, 2026 10:15am

Request Review

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. feature 🚀 Feature request. labels Apr 15, 2026
@pullfrog
Copy link
Copy Markdown
Contributor

pullfrog bot commented Apr 15, 2026

TL;DR — Exposes the Vite Plugin API surface on heyApiPlugin so consumers can pass through options like apply, buildStart, etc. Also declares vite as a peer dependency (5–8), externalizes it from the bundle, and updates docs to reflect supported versions (closes #3775).

Key changes

  • Add vite option to HeyApiPluginOptions — Accepts any Plugin property except configResolved and name, spread onto the returned object so users can customize hooks and behavior.
  • Export HeyApiPluginOptions interface — Extracts the inline options type into a named, exported interface for external consumption.
  • Declare vite as a peer dependency — Adds "vite": "^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0" to peerDependencies and externalizes it in the tsdown build config.
  • Update docs with supported Vite versions — Documentation and README now explicitly state Vite 5, 6, 7, and 8 compatibility, and a new "Vite Options" section demonstrates the vite passthrough.

Summary | 8 files | 1 commit | base: mainfeat/vite-plugin-api


Passthrough Vite plugin options

Before: heyApiPlugin accepted only a config option and returned a fixed plugin object — no way to set apply, buildStart, or other Vite hooks.
After: A new vite option (typed as Omit<Plugin, 'configResolved' | 'name'>) is spread into the returned plugin, letting consumers customize behavior while the plugin retains ownership of configResolved and name.

The spread order (enforce...options?.viteconfigResolved / name) means users can override enforce if needed, but can never accidentally shadow the core logic. The options type is now a standalone exported HeyApiPluginOptions interface rather than an inline anonymous type. The return type is explicitly annotated as Plugin.

packages/vite-plugin/src/index.ts


Vite peer dependency and build externalization

Before: vite was only a devDependency — no version contract with consumers, and the import could be bundled.
After: vite is declared as a peer dependency (^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0) and added to neverBundle in the tsdown config, ensuring consumers provide their own Vite instance.

This is needed because the plugin now imports Plugin from vite as a type at the API boundary. Externalizing prevents bundling Vite internals into the package output.

packages/vite-plugin/package.json · packages/vite-plugin/tsdown.config.ts

Pullfrog  | View workflow run | via Pullfrog𝕏

Copy link
Copy Markdown
Contributor

@pullfrog pullfrog bot left a comment

Choose a reason for hiding this comment

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

Reviewed — no issues found.

Task list (4/4 completed)
  • Read the PR diff to understand changes
  • Read relevant source files for context
  • Analyze changes and draft review
  • Submit review

Pullfrog  | View workflow run𝕏

@mrlubos mrlubos force-pushed the feat/vite-plugin-api branch from 21c6194 to 8ccc2aa Compare April 15, 2026 10:05
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Apr 15, 2026
@mrlubos mrlubos force-pushed the feat/vite-plugin-api branch from 8ccc2aa to d471362 Compare April 15, 2026 10:06
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 15, 2026

Open in StackBlitz

@hey-api/codegen-core

npm i https://pkg.pr.new/@hey-api/codegen-core@3776

@hey-api/json-schema-ref-parser

npm i https://pkg.pr.new/@hey-api/json-schema-ref-parser@3776

@hey-api/openapi-ts

npm i https://pkg.pr.new/@hey-api/openapi-ts@3776

@hey-api/shared

npm i https://pkg.pr.new/@hey-api/shared@3776

@hey-api/spec-types

npm i https://pkg.pr.new/@hey-api/spec-types@3776

@hey-api/types

npm i https://pkg.pr.new/@hey-api/types@3776

@hey-api/vite-plugin

npm i https://pkg.pr.new/@hey-api/vite-plugin@3776

commit: 664cf85

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 40.08%. Comparing base (0673f9d) to head (664cf85).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3776   +/-   ##
=======================================
  Coverage   40.08%   40.08%           
=======================================
  Files         522      522           
  Lines       19323    19323           
  Branches     5767     5767           
=======================================
  Hits         7746     7746           
  Misses       9374     9374           
  Partials     2203     2203           
Flag Coverage Δ
unittests 40.08% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrlubos mrlubos force-pushed the feat/vite-plugin-api branch from d471362 to 664cf85 Compare April 15, 2026 10:15
@mrlubos mrlubos merged commit adb5e15 into main Apr 15, 2026
12 checks passed
@mrlubos mrlubos deleted the feat/vite-plugin-api branch April 15, 2026 10:19
@hey-api hey-api bot mentioned this pull request Apr 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🚀 Feature request. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow vite plugin to fail silently during build

1 participant