import * as ts from "typescript"; import { Option } from "prelude-ts"; /** * @hidden */ export declare function maybeSingleNode(nodes: ts.NodeArray | undefined): Option; /** * @hidden */ export declare const maybeCallExpression: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybePropertyAccessExpression: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybePropertyAssignment: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeIdentifier: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeStringLiteral: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeObjectLiteralExpression: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeVariableStatement: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeArrowFunction: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeFunctionExpression: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeBlock: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeReturnStatement: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeAsExpression: (input: ts.Node | undefined) => Option; /** * @hidden */ export declare const maybeArrayLiteralExpression: (input: ts.Node | undefined) => Option; /** * Returned by [[ControllerViewConnector.getControllerView]] * Describes a connection between a controller (TS file) * and a view (HTML file). */ export interface ControllerViewInfo { /** * Name of an angular controller */ readonly controllerName: string; /** * Path to an angular view (file name within the project, * NOT absolute path on disk). */ readonly viewPath: string; } /** * Returned by [[ModelViewConnector.getControllerView]] * Describes a connection between a controller or directive (TS file * containing a scope), and a view (HTML file). */ export interface ModelViewInfo { /** * Path to a file containing an angular controller scope * (can be a controller or a directive, the important thing * is that it contains the scope to use for the view) */ readonly modelPath: string; /** * Path to an angular view (file name within the project, * NOT absolute path on disk). */ readonly viewPath: string; } /** * @hidden */ export interface ViewInfo { readonly fileName: string; readonly ngModuleName: Option; readonly controllerName: Option; readonly controllerViewInfos: ControllerViewInfo[]; readonly modelViewInfos: ModelViewInfo[]; } /** * You can register such a connector using [[ProjectSettings.ctrlViewConnectors]]. * Will be called when parsing typescript files, allows you to tell ng-typeview * about connections between controllers and views made in your code, for instance * if you wrapped `$modal.open()` through your own helper classes or things like that. * For an example, check `ctrlViewConn` in `test/controller-parser.ts`. */ export interface ControllerViewConnector { /** * Which AST node you want to be listening for */ interceptAstNode: ts.SyntaxKind; /** * When your view connector is registered and we parse a TS file and * ecounter an AST node with the type you specified through [[interceptAstNode]], * this function will be called. * @param node the AST node which matched your specification * @param projectPath the path of the project on disk * @returns the controller-view connections that you detected for this node, * if any (the empty array if you didn't detect any). */ getControllerView: (node: ts.Node, projectPath: string) => ControllerViewInfo[]; } /** * You can register such a connector using [[ProjectSettings.modelViewConnectors]]. * Will be called when parsing typescript files, allows you to tell ng-typeview * about connections between scopes and views made in your code (whether the scope * is defined in a controller or a directive for instance). */ export interface ModelViewConnector { /** * Which AST node you want to be listening for */ interceptAstNode: ts.SyntaxKind; /** * When your view connector is registered and we parse a TS file and * ecounter an AST node with the type you specified through [[interceptAstNode]], * this function will be called. * @param filename the typescript file name * @param node the AST node which matched your specification * @param projectPath the path of the project on disk * @returns the controller-view connections that you detected for this node, * if any (the empty array if you didn't detect any). */ getModelView: (filename: string, node: ts.Node, projectPath: string) => ModelViewInfo[]; } /** * Default set of [[ControllerViewConnector]] which can recognize connections between * angular controllers and views from the typescript source. * You can give this list in [[ProjectSettings.ctrlViewConnectors]], or you can add * your own or provide your own list entirely. */ export declare const defaultCtrlViewConnectors: ControllerViewConnector[]; /** * Default set of [[ModelViewConnector]] which can recognize connections between * angular models (contained in controller or directives) and views from the typescript source. * You can give this list in [[ProjectSettings.modelViewConnectors]], or you can add * your own or provide your own list entirely. */ export declare const defaultModelViewConnectors: ModelViewConnector[]; /** * @hidden */ export declare function extractCtrlViewConnsAngularModule(fileName: string, webappPath: string, ctrlViewConnectors: ControllerViewConnector[], modelViewConnectors: ModelViewConnector[]): Promise; /** * @hidden */ export interface ControllerScopeInfo { readonly tsModuleName: Option; /** * body of the interface for the scope */ readonly scopeInfo: Option; /** * type parameters for the scope, like "" or "" */ readonly scopeTypeParams: Option; readonly typeAliases: string[]; readonly imports: string[]; readonly importNames: string[]; readonly nonExportedDeclarations: string[]; readonly viewFragments: string[]; } /** * You can register such an extractor using [[ProjectSettings.ctrlViewFragmentExtractors]]. * Will be called when parsing typescript files, allows you to tell ng-typeview * about view fragments present in your controllers, for instance ng-grid has * 'cell templates' which typeview can also type-check through this mechanism. */ export interface CtrlViewFragmentExtractor { /** * Which AST node you want to be listening for */ interceptAstNode: ts.SyntaxKind; /** * When your view connector is registered and we parse a TS file and * ecounter an AST node with the type you specified through [[interceptAstNode]], * this function will be called. * @param node the AST node which matched your specification * @returns the view fragments that you detected for this node, * if any (the empty array if you didn't detect any). */ getViewFragments: (node: ts.Node) => string[]; } /** * Default set of controller view fragment extractors (currently empty) */ export declare const defaultCtrlViewFragmentExtractors: CtrlViewFragmentExtractor[]; /** * @hidden */ export declare function extractControllerScopeInfo(fileName: string, ctrlViewFragmentExtractors: CtrlViewFragmentExtractor[]): Promise;