Packages
@strict-script/compiler
The strict-script compiler: texts in, texts out. It imports nothing from Node and nothing from the TypeScript compiler, and holds every rule of the language, which is described in The language.
import { compile, formatDiagnostic } from '@strict-script/compiler';
const { outputs, diagnostics } = compile(new Map([['invoice.sts', text]]));
compile takes the texts of the sources by path, with every file they import. outputs holds, for a/b.sts,
a/b.js, a/b.d.ts and a/b.js.map; it is empty when anything is refused. formatDiagnostic writes a refusal as
the command line prints it.
import { complete } from '@strict-script/compiler';
const { from, offers } = complete(new Map([['invoice.sts', text]]), 'invoice.sts', offset);
complete says what may be written at a place of a file while it is typed: the names that can be used there,
what a value has after a ., the types that have a name where a type is written, the properties a record that is
being written does not have yet, what a value may still be in a pattern of a match, and the words a declaration
starts with at the top of a file. Each offer is a name, what it is
(value, function, property, method, type, platform, keyword) and its type as it is shown; from is
where the name being typed starts. The text is taken as it is: what cannot be read around the place is passed over,
and where the compiler cannot tell what stands there (in a text, in a comment, after a value that is refused) it
offers nothing. It is what the playground shows under the caret and what the language server answers
(test/complete.test.ts).
The compiler is written in strict-script: its sources are in @strict-script/self, and this package is
the name it is imported under. What is here is the tests, which are the measure: test/language.test.ts runs what
the documentation says, and test/attacks.test.ts holds one test per attack file of strict-ts. None of them knows
which language the compiler is written in.