UNPKG

3.63 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright Google Inc. 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 */
8import * as ts from 'typescript';
9import { AnnotatorHost } from './annotator_host';
10import * as googmodule from './googmodule';
11import { ModulesManifest } from './modules_manifest';
12import * as tsmes from './ts_migration_exports_shim';
13export { pathToModuleName } from './cli_support';
14export { getGeneratedExterns } from './externs';
15export { FileMap, ModulesManifest } from './modules_manifest';
16export interface TsickleHost extends googmodule.GoogModuleProcessorHost, tsmes.TsMigrationExportsShimProcessorHost, AnnotatorHost {
17 /**
18 * Whether to downlevel decorators
19 */
20 transformDecorators?: boolean;
21 /**
22 * Whether to convert types to closure
23 */
24 transformTypesToClosure?: boolean;
25 /** Are tsMigrationExports calls allowed and should shim files be emitted? */
26 generateTsMigrationExportsShim?: boolean;
27 /**
28 * Whether to add aliases to the .d.ts files to add the exports to the
29 * ಠ_ಠ.clutz namespace.
30 */
31 addDtsClutzAliases?: boolean;
32 /**
33 * If true, tsickle and decorator downlevel processing will be skipped for
34 * that file.
35 */
36 shouldSkipTsickleProcessing(fileName: string): boolean;
37 /**
38 * Tsickle treats warnings as errors, if true, ignore warnings. This might be
39 * useful for e.g. third party code.
40 */
41 shouldIgnoreWarningsForPath(filePath: string): boolean;
42 /**
43 * Whether to convert CommonJS require() imports to goog.module() and
44 * goog.require() calls.
45 */
46 googmodule: boolean;
47 /**
48 * Whether to transform declaration merging namespaces.
49 */
50 useDeclarationMergingTransformation?: boolean;
51 /**
52 * Whether to add suppressions by default.
53 */
54 generateExtraSuppressions: boolean;
55}
56export declare function mergeEmitResults(emitResults: EmitResult[]): EmitResult;
57export interface EmitResult extends ts.EmitResult {
58 modulesManifest: ModulesManifest;
59 /**
60 * externs.js files produced by tsickle, if any. module IDs are relative paths
61 * from fileNameToModuleId.
62 */
63 externs: {
64 [moduleId: string]: string;
65 };
66 /**
67 * Content for the generated files, keyed by their intended filename.
68 * Filenames are google3 relative.
69 */
70 tsMigrationExportsShimFiles: tsmes.TsMigrationExportsShimFileMap;
71}
72export interface EmitTransformers {
73 /** Custom transformers to evaluate before built-in .js transformations. */
74 beforeTs?: ts.CustomTransformers['before'];
75 /** Custom transformers to evaluate after built-in .js transformations. */
76 afterTs?: ts.CustomTransformers['after'];
77 /** Custom transformers to evaluate after built-in .d.ts transformations. */
78 afterDeclarations?: ts.CustomTransformers['afterDeclarations'];
79}
80/**
81 * @deprecated Exposed for backward compat with Angular. Use emit() instead.
82 */
83export declare function emitWithTsickle(program: ts.Program, host: TsickleHost, tsHost: ts.CompilerHost, tsOptions: ts.CompilerOptions, targetSourceFile?: ts.SourceFile, writeFile?: ts.WriteFileCallback, cancellationToken?: ts.CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: EmitTransformers): EmitResult;
84export declare function emit(program: ts.Program, host: TsickleHost, writeFile: ts.WriteFileCallback, targetSourceFile?: ts.SourceFile, cancellationToken?: ts.CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: EmitTransformers): EmitResult;