UNPKG

1.49 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8/// <amd-module name="@angular/compiler-cli/src/metadata/collector" />
9import * as ts from 'typescript';
10import { MetadataValue, ModuleMetadata } from './schema';
11/**
12 * A set of collector options to use when collecting metadata.
13 */
14export interface CollectorOptions {
15 /**
16 * Version of the metadata to collect.
17 */
18 version?: number;
19 /**
20 * Collect a hidden field "$quoted$" in objects literals that record when the key was quoted in
21 * the source.
22 */
23 quotedNames?: boolean;
24 /**
25 * Do not simplify invalid expressions.
26 */
27 verboseInvalidExpression?: boolean;
28 /**
29 * An expression substitution callback.
30 */
31 substituteExpression?: (value: MetadataValue, node: ts.Node) => MetadataValue;
32}
33/**
34 * Collect decorator metadata from a TypeScript module.
35 */
36export declare class MetadataCollector {
37 private options;
38 constructor(options?: CollectorOptions);
39 /**
40 * Returns a JSON.stringify friendly form describing the decorators of the exported classes from
41 * the source file that is expected to correspond to a module.
42 */
43 getMetadata(sourceFile: ts.SourceFile, strict?: boolean, substituteExpression?: (value: MetadataValue, node: ts.Node) => MetadataValue): ModuleMetadata | undefined;
44}