The `theoremts-plugins` package provides essential build-time integration for projects utilizing the Theorem TypeScript contract system. Currently at version 0.3.2, this package offers plugins for popular bundlers like Vite, esbuild, and tsup, enabling the stripping of Theorem contracts during the build process. This crucial functionality ensures zero runtime overhead for contracts in production environments, making it a key differentiator for performance-sensitive applications using Theorem. As a pre-1.0 release, its development cadence is likely tied to the Theorem project itself, implying potential for breaking changes in minor versions without strict semver adherence. Its primary purpose is to optimize the deployment of Theorem-powered applications by removing development-time contract checks, offering a lean production bundle.
npm install theoremts-pluginsVerified import paths — ran on the pinned version, not inferred.
Illustrates how to integrate the `theoremVite` plugin into a Vite configuration file to strip Theorem contracts at build time.
Review the project's GitHub releases or changelog for specific migration steps before upgrading.
Ensure `theoremts` is installed and actively used for defining contracts in your codebase.
Check your installed versions of `vite` or `esbuild` against the `peerDependencies` listed in `theoremts-plugins`'s `package.json` and adjust as needed.
Ensure the plugin is called with `theoremVite()` (note the parentheses) when added to the `plugins` array in `vite.config.ts`.
Ensure your configuration file uses ESM `import` syntax (e.g., `import { theoremVite } from 'theoremts-plugins/vite'`) and that your project is configured for ESM where appropriate (e.g., `"type": "module"` in `package.json`). Double-check the path for typos.Install `esbuild` as a development dependency: `npm install --save-dev esbuild` or `yarn add -D esbuild`.