UNPKG

@storm-stack/core

Version:

A build toolkit and runtime used by Storm Software in TypeScript applications

67 lines (64 loc) 3.04 kB
import { TsConfigJson, CompilerOptions } from '@stryke/types/tsconfig'; import ts from 'typescript'; type ReflectionMode = "default" | "explicit" | "never"; type RawReflectionMode = ReflectionMode | "" | boolean | string | string[] | undefined; /** * Defines the level of reflection to be used during the transpilation process. * * @remarks * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values: * - `minimal` - Only the essential type information is captured. * - `normal` - Additional type information is captured, including some contextual data. * - `verbose` - All available type information is captured, including detailed contextual data. */ type ReflectionLevel = "minimal" | "normal" | "verbose"; interface TSCompilerOptions extends CompilerOptions { /** * Either true to activate reflection for all files compiled using this tsconfig, * or a list of globs/file paths relative to this tsconfig.json. * Globs/file paths can be prefixed with a ! to exclude them. */ reflection?: RawReflectionMode; /** * Defines the level of reflection to be used during the transpilation process. * * @remarks * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values: * - `minimal` - Only the essential type information is captured. * - `normal` - Additional type information is captured, including some contextual data. * - `verbose` - All available type information is captured, including detailed contextual data. */ reflectionLevel?: ReflectionLevel; } /** * The TypeScript compiler configuration. * * @see https://www.typescriptlang.org/docs/handbook/tsconfig-json.html */ interface TSConfig extends Omit<TsConfigJson, "reflection"> { /** * Either true to activate reflection for all files compiled using this tsconfig, * or a list of globs/file paths relative to this tsconfig.json. * Globs/file paths can be prefixed with a ! to exclude them. */ reflection?: RawReflectionMode; /** * Defines the level of reflection to be used during the transpilation process. * * @remarks * The level determines how much extra data is captured in the byte code for each type. This can be one of the following values: * - `minimal` - Only the essential type information is captured. * - `normal` - Additional type information is captured, including some contextual data. * - `verbose` - All available type information is captured, including detailed contextual data. */ reflectionLevel?: ReflectionLevel; /** * Instructs the TypeScript compiler how to compile `.ts` files. */ compilerOptions?: TSCompilerOptions; } type ParsedTypeScriptConfig = ts.ParsedCommandLine & { tsconfigJson: TSConfig; tsconfigFilePath: string; }; export type { ParsedTypeScriptConfig as P, ReflectionMode as R, TSConfig as T, ReflectionLevel as a };