1 | /// <amd-module name="@angular/compiler-cli/ngcc/src/packages/entry_point" />
|
---|
2 | import { AbsoluteFsPath, ReadonlyFileSystem } from '../../../src/ngtsc/file_system';
|
---|
3 | import { Logger } from '../../../src/ngtsc/logging';
|
---|
4 | import { NgccConfiguration } from './configuration';
|
---|
5 | /**
|
---|
6 | * The possible values for the format of an entry-point.
|
---|
7 | */
|
---|
8 | export declare type EntryPointFormat = 'esm5' | 'esm2015' | 'umd' | 'commonjs';
|
---|
9 | /**
|
---|
10 | * An object containing information about an entry-point, including paths
|
---|
11 | * to each of the possible entry-point formats.
|
---|
12 | */
|
---|
13 | export interface EntryPoint extends JsonObject {
|
---|
14 | /** The name of the entry-point (e.g. `@angular/core` or `@angular/common/http`). */
|
---|
15 | name: string;
|
---|
16 | /** The path to this entry point. */
|
---|
17 | path: AbsoluteFsPath;
|
---|
18 | /**
|
---|
19 | * The name of the package that contains this entry-point (e.g. `@angular/core` or
|
---|
20 | * `@angular/common`).
|
---|
21 | */
|
---|
22 | packageName: string;
|
---|
23 | /** The path to the package that contains this entry-point. */
|
---|
24 | packagePath: AbsoluteFsPath;
|
---|
25 | /** The parsed package.json file for this entry-point. */
|
---|
26 | packageJson: EntryPointPackageJson;
|
---|
27 | /** The path to a typings (.d.ts) file for this entry-point. */
|
---|
28 | typings: AbsoluteFsPath;
|
---|
29 | /** Is this EntryPoint compiled with the Angular View Engine compiler? */
|
---|
30 | compiledByAngular: boolean;
|
---|
31 | /** Should ngcc ignore missing dependencies and process this entrypoint anyway? */
|
---|
32 | ignoreMissingDependencies: boolean;
|
---|
33 | /** Should ngcc generate deep re-exports for this entrypoint? */
|
---|
34 | generateDeepReexports: boolean;
|
---|
35 | }
|
---|
36 | export declare type JsonPrimitive = string | number | boolean | null;
|
---|
37 | export declare type JsonValue = JsonPrimitive | JsonArray | JsonObject | undefined;
|
---|
38 | export interface JsonArray extends Array<JsonValue> {
|
---|
39 | }
|
---|
40 | export interface JsonObject {
|
---|
41 | [key: string]: JsonValue;
|
---|
42 | }
|
---|
43 | export interface PackageJsonFormatPropertiesMap {
|
---|
44 | browser?: string;
|
---|
45 | fesm2015?: string;
|
---|
46 | fesm5?: string;
|
---|
47 | es2015?: string;
|
---|
48 | esm2015?: string;
|
---|
49 | esm5?: string;
|
---|
50 | main?: string;
|
---|
51 | module?: string;
|
---|
52 | types?: string;
|
---|
53 | typings?: string;
|
---|
54 | }
|
---|
55 | export declare type PackageJsonFormatProperties = keyof PackageJsonFormatPropertiesMap;
|
---|
56 | /**
|
---|
57 | * The properties that may be loaded from the `package.json` file.
|
---|
58 | */
|
---|
59 | export interface EntryPointPackageJson extends JsonObject, PackageJsonFormatPropertiesMap {
|
---|
60 | name: string;
|
---|
61 | version?: string;
|
---|
62 | scripts?: Record<string, string>;
|
---|
63 | __processed_by_ivy_ngcc__?: Record<string, string>;
|
---|
64 | }
|
---|
65 | export declare type EntryPointJsonProperty = Exclude<PackageJsonFormatProperties, 'types' | 'typings'>;
|
---|
66 | export declare const SUPPORTED_FORMAT_PROPERTIES: EntryPointJsonProperty[];
|
---|
67 | /**
|
---|
68 | * The path does not represent an entry-point, i.e. there is no package.json at the path and there
|
---|
69 | * is no config to force an entry-point.
|
---|
70 | */
|
---|
71 | export declare const NO_ENTRY_POINT = "no-entry-point";
|
---|
72 | /**
|
---|
73 | * The path represents an entry-point that is `ignored` by an ngcc config.
|
---|
74 | */
|
---|
75 | export declare const IGNORED_ENTRY_POINT = "ignored-entry-point";
|
---|
76 | /**
|
---|
77 | * The path has a package.json, but it is not a valid entry-point for ngcc processing.
|
---|
78 | */
|
---|
79 | export declare const INCOMPATIBLE_ENTRY_POINT = "incompatible-entry-point";
|
---|
80 | /**
|
---|
81 | * The result of calling `getEntryPointInfo()`.
|
---|
82 | *
|
---|
83 | * This will be an `EntryPoint` object if an Angular entry-point was identified;
|
---|
84 | * Otherwise it will be a flag indicating one of:
|
---|
85 | * * NO_ENTRY_POINT - the path is not an entry-point or ngcc is configured to ignore it
|
---|
86 | * * INCOMPATIBLE_ENTRY_POINT - the path was a non-processable entry-point that should be searched
|
---|
87 | * for sub-entry-points
|
---|
88 | */
|
---|
89 | export declare type GetEntryPointResult = EntryPoint | typeof IGNORED_ENTRY_POINT | typeof INCOMPATIBLE_ENTRY_POINT | typeof NO_ENTRY_POINT;
|
---|
90 | /**
|
---|
91 | * Try to create an entry-point from the given paths and properties.
|
---|
92 | *
|
---|
93 | * @param packagePath the absolute path to the containing npm package
|
---|
94 | * @param entryPointPath the absolute path to the potential entry-point.
|
---|
95 | * @returns
|
---|
96 | * - An entry-point if it is valid and not ignored.
|
---|
97 | * - `NO_ENTRY_POINT` when there is no package.json at the path and there is no config to force an
|
---|
98 | * entry-point,
|
---|
99 | * - `IGNORED_ENTRY_POINT` when the entry-point is ignored by an ngcc config.
|
---|
100 | * - `INCOMPATIBLE_ENTRY_POINT` when there is a package.json but it is not a valid Angular compiled
|
---|
101 | * entry-point.
|
---|
102 | */
|
---|
103 | export declare function getEntryPointInfo(fs: ReadonlyFileSystem, config: NgccConfiguration, logger: Logger, packagePath: AbsoluteFsPath, entryPointPath: AbsoluteFsPath): GetEntryPointResult;
|
---|
104 | export declare function isEntryPoint(result: GetEntryPointResult): result is EntryPoint;
|
---|
105 | /**
|
---|
106 | * Convert a package.json property into an entry-point format.
|
---|
107 | *
|
---|
108 | * @param property The property to convert to a format.
|
---|
109 | * @returns An entry-point format or `undefined` if none match the given property.
|
---|
110 | */
|
---|
111 | export declare function getEntryPointFormat(fs: ReadonlyFileSystem, entryPoint: EntryPoint, property: EntryPointJsonProperty): EntryPointFormat | undefined;
|
---|