Packages
@strict-script/vite
The strict-script plugin for Vite: a .sts file that a TypeScript or a Vue file imports is compiled by the build,
with no step run by hand.
// vite.config.ts
import strictScript from '@strict-script/vite';
export default { plugins: [strictScript()] };
It is an adapter around the compiler: it reads the file and every .sts file it imports, hands their texts over,
and gives Vite the JavaScript and its source map. It holds no rule of the language. A file that is refused fails
the build with the message of the compiler.
Beside each name.sts it writes name.d.sts.ts, where TypeScript looks for the types of ./name.sts under
allowArbitraryExtensions; strictScript({ declarations: false }) writes none.
In a .vue file, <script lang="sts"> exports a function setup that gives what the template names; each Cell
among it is shown to Vue as a ref (@strict-script/vite/vue, which the plugin imports for the component). This
needs Vue's own plugin beside this one.
@strict-script/vite/volar is a plugin for vue-tsc and for Vue's tools in an editor: the template of such a
component is checked against what its script gives.
How to use it in a project is in In a project. The tests build a small Vue application
(test/app), render it, run tsc on what the plugin wrote, and open it in a browser: a click changes the state of a
component written in strict-script, and the page follows.