tcm-ts.txt / code
tcm . cli . provided
Types
Provided
Server
importedPackages
installed
providePackages
rangeFor
recordForEditor
Shared
EMPTY
codebaseImports
mostUsed
newestRangeFirst
tcmts.cli.provided
Types
Provided type
Server
importedPackages (file: string, text: string, options: CompilerOptions) => string[] The packages a scratch file imports: bare specifiers, and the JSX runtime for a .tsx file.
installed (name: string, dir: string) => string | undefined An installed copy of `name` seen from `dir` (the project's node_modules, as Node would find it).
providePackages (cb: CodebaseCore, file: string, text: string, options: CompilerOptions) => Provided Provide the packages scratch file `file` (with text `text`) imports that the project doesn't have installed at the range chosen for it: installed into the cache, and recorded for the editor in .tcm/packages.json.
rangeFor (cb: CodebaseCore, name: string, file: string, text: string) => { range: string; project: boolean; … The range of `name` a scratch file should get, and whether the project's own copy provides it.
recordForEditor (cb: CodebaseCore, file: string, dirs: Map<string, string>) => void .tcm/packages.json: for each scratch file, where the packages tcm provides to it are. The editor's TypeScript (through tcm's plugin) resolves the file's imports with it, the same way tcm does.
Shared
EMPTY Provided
codebaseImports (text: string) => string[] The `#codebase` names a file imports, as paths (`import { tally } from "#codebase/polls"` → `polls.tally`).
mostUsed (counts: Map<string, number>) => string | undefined The most used range in `counts`, the newest on a tie.
newestRangeFirst (a: string, b: string) => number `19` before `18`, `0.4` before `0.3`: ranges compared by their numbers.