Docs@skmtc/core

Projections and snippets

TYPE

Lang

@skmtc/core 0.63.4

The language-specific surface the engine reaches through.

A Lang is the object a @skmtc/lang-* package exposes, carried as the static lang on the package's snippet base (LangSnippetConstructor). Its only consumers are the Drivers - peers the engine can't name concretely - which read it off the projection class (projection.lang) ephemerally at each use site. The engine never names a concrete File / Definition / Import - it only ever calls these neutral factories:

  • createFile - construct this language's file for a path.
  • toDefinition - wrap a generated value in this language's Definition.
  • toImport - build the import of a single peer IdentifierBase from a module (the Driver's cross-file import).
  • toIdentifier - assemble this language's IdentifierBase subclass from a name (the pure toIdentifierName) and the spread IdentifierType (the context-aware toIdentifierType). The engine's identifier-assembly seam - it holds the result as the neutral IdentifierBase.

There is deliberately no concise-import conversion here: the concise vocabulary is intra-lang-package (each language's register function converts its own form), so the neutral interface never names one.

Signature

import type { Lang } from '@skmtc/core'

Properties

createFile, (args: { path: string; settings: ClientSettings | undefined }) => FileBase required

Construct the language's file for path.

toDefinition, <V extends GeneratedValue>(args: LangToDefinitionArgs<V>) => DefinitionBase<V> required

Wrap a generated value in this language's Definition subclass.

toImport, (args: LangToImportArgs) => ImportBase required

Build the import of one peer IdentifierBase from a module.

toIdentifier, (args: LangToIdentifierArgs) => IdentifierBase required

Assemble this language's IdentifierBase subclass from name + type/typeName/exported. type arrives as the opaque-boundary string - the engine never narrows it; the language reads it into its own typed EntityType slot. The engine holds the result as the neutral IdentifierBase; the declaration-type vocabulary is a fixed fact of each language package, never modelled or recovered here.