@wc-toolkit/type-parser
Version:
A set of tools for retrieving and transforming data from the Custom Elements Manifest
40 lines (37 loc) • 1.49 kB
TypeScript
import * as typescript from 'typescript';
import typescript__default from 'typescript';
type ParseObjectTypesMode = 'none' | 'partial' | 'full';
/** Options for configuring the CEM Type Parser plugin */
interface Options {
/** Controls whether object types are parsed, and if so, whether fully or partially ('none', 'partial', 'full') */
parseObjectTypes?: ParseObjectTypesMode;
/** Controls whether method parameters are parsed */
parseParameters?: boolean;
/** Determines the name of the property used in the manifest to store the parsed type */
propertyName?: string;
/** Shows output logs used for debugging */
debug?: boolean;
/** Prevents plugin from executing */
skip?: boolean;
}
/**
* CEM Analyzer plugin to parse types in component metadata
* @param tc TypeScript type checker
* @param op Configuration options
* @returns
*/
declare function typeParserPlugin(op: Options): {
name: string;
analyzePhase: typeof analyzePhase;
packageLinkPhase: () => void;
} | undefined;
/**
*
* @param ts Global TypeScript object
* @param globs File globs to analyze
* @param configName TypeScript config file name to use during analysis
* @returns
*/
declare function getTsProgram(ts: typeof typescript, globs: string[], configName?: string): typescript__default.Program;
declare function analyzePhase({ ts, node, moduleDoc, context }: any): void;
export { type Options, type ParseObjectTypesMode, getTsProgram, typeParserPlugin };