source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/ngcc_options.d.ts@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 7.0 KB
Line 
1/// <amd-module name="@angular/compiler-cli/ngcc/src/ngcc_options" />
2import { AbsoluteFsPath, FileSystem } from '../../src/ngtsc/file_system';
3import { Logger } from '../../src/ngtsc/logging';
4import { ParsedConfiguration } from '../../src/perform_compile';
5import { PathMappings } from './path_mappings';
6import { FileWriter } from './writing/file_writer';
7import { PackageJsonUpdater } from './writing/package_json_updater';
8/**
9 * The options to configure the ngcc compiler for synchronous execution.
10 */
11export interface SyncNgccOptions {
12 /** The absolute path to the `node_modules` folder that contains the packages to process. */
13 basePath: string;
14 /**
15 * The path to the primary package to be processed. If not absolute then it must be relative to
16 * `basePath`.
17 *
18 * All its dependencies will need to be processed too.
19 *
20 * If this property is provided then `errorOnFailedEntryPoint` is forced to true.
21 */
22 targetEntryPointPath?: string;
23 /**
24 * Which entry-point properties in the package.json to consider when processing an entry-point.
25 * Each property should hold a path to the particular bundle format for the entry-point.
26 * Defaults to all the properties in the package.json.
27 */
28 propertiesToConsider?: string[];
29 /**
30 * Whether to only process the typings files for this entry-point.
31 *
32 * This is useful when running ngcc only to provide typings files to downstream tooling such as
33 * the Angular Language Service or ng-packagr. Defaults to `false`.
34 *
35 * If this is set to `true` then `compileAllFormats` is forced to `false`.
36 */
37 typingsOnly?: boolean;
38 /**
39 * Whether to process all formats specified by (`propertiesToConsider`) or to stop processing
40 * this entry-point at the first matching format.
41 *
42 * Defaults to `true`, but is forced to `false` if `typingsOnly` is `true`.
43 */
44 compileAllFormats?: boolean;
45 /**
46 * Whether to create new entry-points bundles rather than overwriting the original files.
47 */
48 createNewEntryPointFormats?: boolean;
49 /**
50 * Provide a logger that will be called with log messages.
51 */
52 logger?: Logger;
53 /**
54 * Paths mapping configuration (`paths` and `baseUrl`), as found in `ts.CompilerOptions`.
55 * These are used to resolve paths to locally built Angular libraries.
56 *
57 * Note that `pathMappings` specified here take precedence over any `pathMappings` loaded from a
58 * TS config file.
59 */
60 pathMappings?: PathMappings;
61 /**
62 * Provide a file-system service that will be used by ngcc for all file interactions.
63 */
64 fileSystem?: FileSystem;
65 /**
66 * Whether the compilation should run and return asynchronously. Allowing asynchronous execution
67 * may speed up the compilation by utilizing multiple CPU cores (if available).
68 *
69 * Default: `false` (i.e. run synchronously)
70 */
71 async?: false;
72 /**
73 * Set to true in order to terminate immediately with an error code if an entry-point fails to be
74 * processed.
75 *
76 * If `targetEntryPointPath` is provided then this property is always true and cannot be
77 * changed. Otherwise the default is false.
78 *
79 * When set to false, ngcc will continue to process entry-points after a failure. In which case it
80 * will log an error and resume processing other entry-points.
81 */
82 errorOnFailedEntryPoint?: boolean;
83 /**
84 * Render `$localize` messages with legacy format ids.
85 *
86 * The default value is `true`. Only set this to `false` if you do not want legacy message ids to
87 * be rendered. For example, if you are not using legacy message ids in your translation files
88 * AND are not doing compile-time inlining of translations, in which case the extra message ids
89 * would add unwanted size to the final source bundle.
90 *
91 * It is safe to leave this set to true if you are doing compile-time inlining because the extra
92 * legacy message ids will all be stripped during translation.
93 */
94 enableI18nLegacyMessageIdFormat?: boolean;
95 /**
96 * Whether to invalidate any entry-point manifest file that is on disk. Instead, walk the
97 * directory tree looking for entry-points, and then write a new entry-point manifest, if
98 * possible.
99 *
100 * Default: `false` (i.e. the manifest will be used if available)
101 */
102 invalidateEntryPointManifest?: boolean;
103 /**
104 * An absolute path to a TS config file (e.g. `tsconfig.json`) or a directory containing one, that
105 * will be used to configure module resolution with things like path mappings, if not specified
106 * explicitly via the `pathMappings` property to `mainNgcc`.
107 *
108 * If `undefined`, ngcc will attempt to load a `tsconfig.json` file from the directory above the
109 * `basePath`.
110 *
111 * If `null`, ngcc will not attempt to load any TS config file at all.
112 */
113 tsConfigPath?: string | null;
114 /**
115 * Use the program defined in the loaded tsconfig.json (if available - see
116 * `tsConfigPath` option) to identify the entry-points that should be processed.
117 * If this is set to `true` then only the entry-points reachable from the given
118 * program (and their dependencies) will be processed.
119 */
120 findEntryPointsFromTsConfigProgram?: boolean;
121}
122/**
123 * The options to configure the ngcc compiler for asynchronous execution.
124 */
125export declare type AsyncNgccOptions = Omit<SyncNgccOptions, 'async'> & {
126 async: true;
127};
128/**
129 * The options to configure the ngcc compiler.
130 */
131export declare type NgccOptions = AsyncNgccOptions | SyncNgccOptions;
132export declare type OptionalNgccOptionKeys = 'targetEntryPointPath' | 'tsConfigPath' | 'pathMappings' | 'findEntryPointsFromTsConfigProgram';
133export declare type RequiredNgccOptions = Required<Omit<NgccOptions, OptionalNgccOptionKeys>>;
134export declare type OptionalNgccOptions = Pick<NgccOptions, OptionalNgccOptionKeys>;
135export declare type SharedSetup = {
136 fileSystem: FileSystem;
137 absBasePath: AbsoluteFsPath;
138 projectPath: AbsoluteFsPath;
139 tsConfig: ParsedConfiguration | null;
140 getFileWriter(pkgJsonUpdater: PackageJsonUpdater): FileWriter;
141};
142/**
143 * Instantiate common utilities that are always used and fix up options with defaults, as necessary.
144 *
145 * NOTE: Avoid eagerly instantiating anything that might not be used when running sync/async.
146 */
147export declare function getSharedSetup(options: NgccOptions): SharedSetup & RequiredNgccOptions & OptionalNgccOptions;
148export declare function clearTsConfigCache(): void;
149/**
150 * Determines the maximum number of workers to use for parallel execution. This can be set using the
151 * NGCC_MAX_WORKERS environment variable, or is computed based on the number of available CPUs. One
152 * CPU core is always reserved for the master process, so we take the number of CPUs minus one, with
153 * a maximum of 4 workers. We don't scale the number of workers beyond 4 by default, as it takes
154 * considerably more memory and CPU cycles while not offering a substantial improvement in time.
155 */
156export declare function getMaxNumberOfWorkers(): number;
Note: See TracBrowser for help on using the repository browser.