jsii
Version:
[](https://cdk.dev) [](https://github.com/aws/jsii
148 lines • 4.99 kB
TypeScript
import * as spec from '@jsii/spec';
import * as ts from 'typescript';
import { TypeScriptConfigValidationRuleSet } from './tsconfig';
export type TSCompilerOptions = Partial<Pick<ts.CompilerOptions, 'outDir' | 'rootDir' | 'paths' | 'forceConsistentCasingInFileNames' | 'noImplicitOverride' | 'noPropertyAccessFromIndexSignature' | 'noUncheckedIndexedAccess' | 'declarationMap' | 'inlineSourceMap' | 'inlineSources' | 'sourceMap' | 'types'>>;
/**
* The assembly targets have some typing in `spec.PackageJson`, extract it.
*
* The types in the upstream spec library:
*
* - Missing the user-visible `go` target
* - Missing the synthetic `js` target
*/
export type AssemblyTargets = spec.PackageJson['jsii']['targets'] & {
js?: {
npm: string;
};
go?: {
moduleName: string;
packageName: string;
};
[otherLanguage: string]: unknown;
};
export interface ProjectInfo {
readonly projectRoot: string;
readonly packageJson: PackageJson;
readonly name: string;
readonly version: string;
readonly author: spec.Person;
readonly deprecated?: string;
readonly stability?: spec.Stability;
readonly license: string;
readonly repository: {
readonly type: string;
readonly url: string;
readonly directory?: string;
};
readonly keywords?: readonly string[];
readonly main: string;
readonly types?: string;
readonly dependencies: {
readonly [name: string]: string;
};
readonly peerDependencies: {
readonly [name: string]: string;
};
readonly dependencyClosure: readonly spec.Assembly[];
readonly bundleDependencies?: {
readonly [name: string]: string;
};
readonly targets: AssemblyTargets;
readonly metadata?: {
readonly [key: string]: any;
};
readonly jsiiVersionFormat: 'short' | 'full';
readonly diagnostics?: {
readonly [code: string]: ts.DiagnosticCategory;
};
readonly description?: string;
readonly homepage?: string;
readonly contributors?: readonly spec.Person[];
readonly excludeTypescript: readonly string[];
readonly projectReferences?: boolean;
readonly tsc?: TSCompilerOptions;
readonly bin?: {
readonly [name: string]: string;
};
readonly exports?: {
readonly [name: string]: string | {
readonly [name: string]: string;
};
};
readonly tsconfig?: string;
readonly validateTsconfig?: TypeScriptConfigValidationRuleSet;
}
/**
* A type representing the contents of a `package.json` file.
*
* Note that there is also a `PackageJson` type in `@jsii/spec`, and this one is
* not the same. Do not ask me why.
*/
export interface PackageJson {
readonly description?: string;
readonly homepage?: string;
readonly name?: string;
readonly version?: string;
readonly keywords?: readonly string[];
readonly license?: string;
readonly private?: boolean;
readonly exports?: {
readonly [path: string]: string | {
readonly [name: string]: string;
};
};
readonly main?: string;
readonly types?: string;
/**
* @example { "<4.0": { "*": ["ts3.9/*"] } }
* @example { "<4.0": { "index.d.ts": ["index.ts3-9.d.ts"] } }
*/
readonly typesVersions?: {
readonly [versionRange: string]: {
readonly [pattern: string]: readonly string[];
};
};
readonly bin?: {
readonly [name: string]: string;
};
readonly stability?: string;
readonly deprecated?: string;
readonly dependencies?: {
readonly [name: string]: string;
};
readonly devDependencies?: {
readonly [name: string]: string;
};
readonly peerDependencies?: {
readonly [name: string]: string;
};
readonly bundleDependencies?: readonly string[];
readonly bundledDependencies?: readonly string[];
readonly jsii?: {
readonly diagnostics?: {
readonly [id: string]: 'error' | 'warning' | 'suggestion' | 'message';
};
readonly metadata?: {
readonly [key: string]: unknown;
};
readonly targets?: AssemblyTargets;
readonly versionFormat?: 'short' | 'full';
readonly tsconfig?: string;
readonly validateTsconfig?: string;
readonly excludeTypescript?: readonly string[];
readonly projectReferences?: boolean;
readonly tsc?: TSCompilerOptions;
readonly [key: string]: unknown;
};
readonly [key: string]: unknown;
}
export interface ProjectInfoResult {
readonly projectInfo: ProjectInfo;
readonly diagnostics: readonly ts.Diagnostic[];
}
export declare function loadProjectInfo(projectRoot: string): ProjectInfoResult;
/**
* Validate the values of the `.jsii.targets` field
*/
export declare function validateTargets(targets: AssemblyTargets | undefined): AssemblyTargets | undefined;
//# sourceMappingURL=project-info.d.ts.map