1 | /**
|
2 | * @license
|
3 | * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
|
4 | * This code may only be used under the BSD style license found at
|
5 | * http://polymer.github.io/LICENSE.txt The complete set of authors may be found
|
6 | * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may
|
7 | * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by
|
8 | * Google as part of the polymer project is also subject to an additional IP
|
9 | * rights grant found at http://polymer.github.io/PATENTS.txt
|
10 | */
|
11 | /**
|
12 | * Configuration for declaration generation.
|
13 | */
|
14 | export interface Config {
|
15 | /**
|
16 | * Skip source files whose paths match any of these glob patterns. If
|
17 | * undefined, defaults to excluding "index.html" and directories ending in
|
18 | * "test" or "demo".
|
19 | */
|
20 | excludeFiles?: string[];
|
21 | /**
|
22 | * The same as `excludeFiles`, for backwards compatibility. Will be removed in
|
23 | * next major version.
|
24 | */
|
25 | exclude?: string[];
|
26 | /**
|
27 | * Do not emit any declarations for features that have any of these
|
28 | * identifiers.
|
29 | */
|
30 | excludeIdentifiers?: string[];
|
31 | /**
|
32 | * Remove any triple-slash references to these files, specified as paths
|
33 | * relative to the analysis root directory.
|
34 | */
|
35 | removeReferences?: string[];
|
36 | /**
|
37 | * Additional files to insert as triple-slash reference statements. Given the
|
38 | * map `a: b[]`, a will get an additional reference statement for each file
|
39 | * path in b. All paths are relative to the analysis root directory.
|
40 | */
|
41 | addReferences?: {
|
42 | [filepath: string]: string[];
|
43 | };
|
44 | /**
|
45 | * Whenever a type with a name in this map is encountered, replace it with
|
46 | * the given name. Note this only applies to named types found in places like
|
47 | * function/method parameters and return types. It does not currently rename
|
48 | * e.g. entire generated classes.
|
49 | */
|
50 | renameTypes?: {
|
51 | [name: string]: string;
|
52 | };
|
53 | /**
|
54 | * A map from an ES module path (relative to the analysis root directory) to
|
55 | * an array of identifiers exported by that module. If any of those
|
56 | * identifiers are encountered in a generated typings file, an import for that
|
57 | * identifier from the specified module will be inserted into the typings
|
58 | * file.
|
59 | */
|
60 | autoImport?: {
|
61 | [modulePath: string]: string[];
|
62 | };
|
63 | /**
|
64 | * If true, outputs declarations in 'goog:' modules instead of using
|
65 | * simple ES modules. This is a temporary hack to account for how modules are
|
66 | * resolved for TypeScript inside google3. This is probably not at all useful
|
67 | * for anyone but the Polymer team.
|
68 | */
|
69 | googModules?: boolean;
|
70 | /**
|
71 | * If true, does not log warnings detected when analyzing code,
|
72 | * only diagnostics of Error severity.
|
73 | */
|
74 | hideWarnings?: boolean;
|
75 | }
|
76 | /**
|
77 | * Analyze all files in the given directory using Polymer Analyzer, and return
|
78 | * TypeScript declaration document strings in a map keyed by relative path.
|
79 | */
|
80 | export declare function generateDeclarations(rootDir: string, config: Config): Promise<Map<string, string>>;
|