Registry / devops / theoremts-plugins

theoremts-plugins

JSON →
library0.3.2jsnpmunverified

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-plugins
INSTALL
IMPORT
SIG · THEOREMTS-PLUGINS
T
theoremts-plugins
devopsjavascriptv0.3.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

theoremVite
import { theoremVite } from 'theoremts-plugins/vite'
const theoremVite = require('theoremts-plugins/vite')
Vite configuration files are typically ESM, requiring `import` syntax. Attempting to `require` will result in a runtime error.
theoremEsbuild
import { theoremEsbuild } from 'theoremts-plugins/esbuild'
import { esbuildPlugin } from 'theoremts-plugins/esbuild'
Ensure you import the specific named export `theoremEsbuild` for the esbuild plugin, not a generic name.
theoremTsup
import { theoremTsup } from 'theoremts-plugins/tsup'
const tsupPlugin = require('theoremts-plugins/tsup')
While tsup configurations can sometimes be CommonJS, the plugin itself is provided as an ESM module and should be imported using `import`.

Illustrates how to integrate the `theoremVite` plugin into a Vite configuration file to strip Theorem contracts at build time.

import { defineConfig } from 'vite'; import { theoremVite } from 'theoremts-plugins/vite'; // This configuration demonstrates how to integrate the theoremVite plugin // into a standard Vite project. The plugin will automatically detect // and strip Theorem contracts from your code during the build process, // ensuring that they do not incur any runtime overhead in production. export default defineConfig({ plugins: [ // Initialize the theoremVite plugin. It's typically added early // in the plugin array to ensure contracts are stripped before other // transformations that might interfere. theoremVite(), // ... other Vite plugins can go here ], // You might also have other Vite configurations here, // such as build options, server settings, etc. build: { sourcemap: true, // Example build option: useful for debugging production issues minify: 'esbuild' // Example: using esbuild for minification }, });
Debug
Known issues
breakingAs a pre-1.0 package (current version 0.3.2), `theoremts-plugins` may introduce breaking changes in minor versions. Always consult the changelog when upgrading, even for `0.x.y` releases.
fix
Review the project's GitHub releases or changelog for specific migration steps before upgrading.
affects: >=0.1.0
gotchaThis package is a companion to `theoremts`. It assumes you are already using `theoremts` in your project for contract definition. The plugins will not function correctly or provide value without `theoremts` contracts present.
fix
Ensure `theoremts` is installed and actively used for defining contracts in your codebase.
affects: >=0.1.0
gotchaIncorrect peer dependency versions for bundlers (e.g., Vite, esbuild) can lead to unexpected build failures or plugin misbehavior. This package has strict peer dependency ranges.
fix
Check your installed versions of `vite` or `esbuild` against the `peerDependencies` listed in `theoremts-plugins`'s `package.json` and adjust as needed.
affects: >=0.1.0
Errors
Common errors & fixes
Error: Plugin "theoremVite" is not a valid Rollup plugin. Plugins must be an object with a 'name' property and a 'buildStart' or 'load' method (or other Rollup plugin hooks).
The `theoremVite` plugin was not correctly initialized or added to the Vite `plugins` array. It must be called as a function.
fix
Ensure the plugin is called with `theoremVite()` (note the parentheses) when added to the `plugins` array in `vite.config.ts`.
ERR_MODULE_NOT_FOUND: Cannot find module 'theoremts-plugins/vite'
Attempting to `require` an ESM-only module in a CommonJS context, or incorrect import path.
fix
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.
ESBUILD_PEER_DEPENDENCY_NOT_FOUND: The 'esbuild' peer dependency is required but not installed.
The `esbuild` package, a peer dependency for the `theoremts-plugins/esbuild` module, is missing from your project's `node_modules`.
fix
Install `esbuild` as a development dependency: `npm install --save-dev esbuild` or `yarn add -D esbuild`.
Upgrade
Version history
0.3.2latest on npm
Audit
Dependencies
esbuildrequiredRequired for using the esbuild plugin, handles bundling and minification.
viterequiredRequired for using the Vite plugin, integrates with Vite's build pipeline.
Agent activity
7 hits · last 30 days
node
6
OpenAI (training)
1
Resources
theoremts-plugins — npm install theoremts-plugins · libregistry