1 | /// <amd-module name="@angular/compiler-cli/ngcc/src/entry_point_finder/targeted_entry_point_finder" />
|
---|
2 | /**
|
---|
3 | * @license
|
---|
4 | * Copyright Google LLC All Rights Reserved.
|
---|
5 | *
|
---|
6 | * Use of this source code is governed by an MIT-style license that can be
|
---|
7 | * found in the LICENSE file at https://angular.io/license
|
---|
8 | */
|
---|
9 | import { AbsoluteFsPath, ReadonlyFileSystem } from '../../../src/ngtsc/file_system';
|
---|
10 | import { Logger } from '../../../src/ngtsc/logging';
|
---|
11 | import { EntryPointWithDependencies } from '../dependencies/dependency_host';
|
---|
12 | import { DependencyResolver, SortedEntryPointsInfo } from '../dependencies/dependency_resolver';
|
---|
13 | import { NgccConfiguration } from '../packages/configuration';
|
---|
14 | import { EntryPointJsonProperty } from '../packages/entry_point';
|
---|
15 | import { PathMappings } from '../path_mappings';
|
---|
16 | import { TracingEntryPointFinder } from './tracing_entry_point_finder';
|
---|
17 | /**
|
---|
18 | * An EntryPointFinder that starts from a target entry-point and only finds
|
---|
19 | * entry-points that are dependencies of the target.
|
---|
20 | *
|
---|
21 | * This is faster than searching the entire file-system for all the entry-points,
|
---|
22 | * and is used primarily by the CLI integration.
|
---|
23 | */
|
---|
24 | export declare class TargetedEntryPointFinder extends TracingEntryPointFinder {
|
---|
25 | private targetPath;
|
---|
26 | constructor(fs: ReadonlyFileSystem, config: NgccConfiguration, logger: Logger, resolver: DependencyResolver, basePath: AbsoluteFsPath, pathMappings: PathMappings | undefined, targetPath: AbsoluteFsPath);
|
---|
27 | /**
|
---|
28 | * Search for Angular entry-points that can be reached from the entry-point specified by the given
|
---|
29 | * `targetPath`.
|
---|
30 | */
|
---|
31 | findEntryPoints(): SortedEntryPointsInfo;
|
---|
32 | /**
|
---|
33 | * Determine whether the entry-point at the given `targetPath` needs to be processed.
|
---|
34 | *
|
---|
35 | * @param propertiesToConsider the package.json properties that should be considered for
|
---|
36 | * processing.
|
---|
37 | * @param compileAllFormats true if all formats need to be processed, or false if it is enough for
|
---|
38 | * one of the formats covered by the `propertiesToConsider` is processed.
|
---|
39 | */
|
---|
40 | targetNeedsProcessingOrCleaning(propertiesToConsider: EntryPointJsonProperty[], compileAllFormats: boolean): boolean;
|
---|
41 | /**
|
---|
42 | * Return an array containing the `targetPath` from which to start the trace.
|
---|
43 | */
|
---|
44 | protected getInitialEntryPointPaths(): AbsoluteFsPath[];
|
---|
45 | /**
|
---|
46 | * For the given `entryPointPath`, compute, or retrieve, the entry-point information, including
|
---|
47 | * paths to other entry-points that this entry-point depends upon.
|
---|
48 | *
|
---|
49 | * @param entryPointPath the path to the entry-point whose information and dependencies are to be
|
---|
50 | * retrieved or computed.
|
---|
51 | *
|
---|
52 | * @returns the entry-point and its dependencies or `null` if the entry-point is not compiled by
|
---|
53 | * Angular or cannot be determined.
|
---|
54 | */
|
---|
55 | protected getEntryPointWithDeps(entryPointPath: AbsoluteFsPath): EntryPointWithDependencies | null;
|
---|
56 | /**
|
---|
57 | * Compute the path to the package that contains the given entry-point.
|
---|
58 | *
|
---|
59 | * In this entry-point finder it is not trivial to find the containing package, since it is
|
---|
60 | * possible that this entry-point is not directly below the directory containing the package.
|
---|
61 | * Moreover, the import path could be affected by path-mapping.
|
---|
62 | *
|
---|
63 | * @param entryPointPath the path to the entry-point, whose package path we want to compute.
|
---|
64 | */
|
---|
65 | private computePackagePath;
|
---|
66 | /**
|
---|
67 | * Compute whether the `test` path is contained within the `base` path.
|
---|
68 | *
|
---|
69 | * Note that this doesn't use a simple `startsWith()` since that would result in a false positive
|
---|
70 | * for `test` paths such as `a/b/c-x` when the `base` path is `a/b/c`.
|
---|
71 | *
|
---|
72 | * Since `fs.relative()` can be quite expensive we check the fast possibilities first.
|
---|
73 | */
|
---|
74 | private isPathContainedBy;
|
---|
75 | /**
|
---|
76 | * Search down to the `entryPointPath` from the `containingPath` for the first `package.json` that
|
---|
77 | * we come to. This is the path to the entry-point's containing package. For example if
|
---|
78 | * `containingPath` is `/a/b/c` and `entryPointPath` is `/a/b/c/d/e` and there exists
|
---|
79 | * `/a/b/c/d/package.json` and `/a/b/c/d/e/package.json`, then we will return `/a/b/c/d`.
|
---|
80 | *
|
---|
81 | * To account for nested `node_modules` we actually start the search at the last `node_modules` in
|
---|
82 | * the `entryPointPath` that is below the `containingPath`. E.g. if `containingPath` is `/a/b/c`
|
---|
83 | * and `entryPointPath` is `/a/b/c/d/node_modules/x/y/z`, we start the search at
|
---|
84 | * `/a/b/c/d/node_modules`.
|
---|
85 | */
|
---|
86 | private computePackagePathFromContainingPath;
|
---|
87 | /**
|
---|
88 | * Search up the directory tree from the `entryPointPath` looking for a `node_modules` directory
|
---|
89 | * that we can use as a potential starting point for computing the package path.
|
---|
90 | */
|
---|
91 | private computePackagePathFromNearestNodeModules;
|
---|
92 | /**
|
---|
93 | * Split the given `path` into path segments using an FS independent algorithm.
|
---|
94 | */
|
---|
95 | private splitPath;
|
---|
96 | }
|
---|