@angular/compiler-cli 14.0.0-next.9 → 14.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/{chunk-SNAJD4VP.js → chunk-53V6MPBS.js} +15 -4
- package/bundles/chunk-53V6MPBS.js.map +6 -0
- package/bundles/{chunk-FJDIFR5C.js → chunk-7XY4OMWJ.js} +70 -34
- package/bundles/chunk-7XY4OMWJ.js.map +6 -0
- package/bundles/{chunk-34QUU6SJ.js → chunk-BHGVN4MI.js} +64 -19
- package/bundles/chunk-BHGVN4MI.js.map +6 -0
- package/bundles/{chunk-GYVY4Y2L.js → chunk-GJVJ6GH4.js} +1056 -805
- package/bundles/chunk-GJVJ6GH4.js.map +6 -0
- package/bundles/{chunk-UMDDHI5B.js → chunk-JDKMNZ6O.js} +2 -1
- package/bundles/chunk-JDKMNZ6O.js.map +6 -0
- package/bundles/{chunk-AGDZS4UG.js → chunk-KPGMJT2X.js} +2 -2
- package/bundles/{chunk-AGDZS4UG.js.map → chunk-KPGMJT2X.js.map} +0 -0
- package/bundles/{chunk-M3IOYIU5.js → chunk-N6HUFHQ6.js} +962 -896
- package/bundles/chunk-N6HUFHQ6.js.map +6 -0
- package/bundles/index.js +5 -6
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +2 -2
- package/bundles/linker/index.js +2 -2
- package/bundles/ngcc/index.js +5 -5
- package/bundles/ngcc/main-ngcc.js +5 -5
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +4 -4
- package/bundles/private/migrations.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/bundles_metadata.json +1 -1
- package/ngcc/src/dependencies/module_resolver.d.ts +5 -2
- package/ngcc/src/execution/cluster/api.d.ts +1 -1
- package/ngcc/src/execution/cluster/package_json_updater.d.ts +1 -1
- package/ngcc/src/execution/tasks/api.d.ts +2 -2
- package/ngcc/src/packages/build_marker.d.ts +1 -1
- package/ngcc/src/packages/entry_point.d.ts +1 -7
- package/ngcc/src/utils.d.ts +26 -0
- package/ngcc/src/writing/package_json_updater.d.ts +2 -1
- package/package.json +4 -4
- package/src/ngtsc/annotations/common/index.d.ts +1 -0
- package/src/ngtsc/annotations/common/src/schema.d.ts +12 -0
- package/src/ngtsc/annotations/common/src/util.d.ts +1 -1
- package/src/ngtsc/annotations/component/src/metadata.d.ts +7 -8
- package/src/ngtsc/annotations/component/src/resources.d.ts +1 -1
- package/src/ngtsc/annotations/ng_module/src/handler.d.ts +10 -7
- package/src/ngtsc/core/api/src/adapter.d.ts +12 -1
- package/src/ngtsc/core/src/host.d.ts +9 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
- package/src/ngtsc/metadata/src/api.d.ts +32 -5
- package/src/ngtsc/metadata/src/util.d.ts +1 -0
- package/src/ngtsc/partial_evaluator/index.d.ts +1 -0
- package/src/ngtsc/partial_evaluator/src/dynamic.d.ts +9 -1
- package/src/ngtsc/partial_evaluator/src/interface.d.ts +2 -1
- package/src/ngtsc/partial_evaluator/src/result.d.ts +2 -1
- package/src/ngtsc/partial_evaluator/src/synthetic.d.ts +19 -0
- package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +2 -2
- package/src/ngtsc/scope/index.d.ts +4 -3
- package/src/ngtsc/scope/src/api.d.ts +36 -14
- package/src/ngtsc/scope/src/component_scope.d.ts +2 -16
- package/src/ngtsc/scope/src/local.d.ts +4 -11
- package/src/ngtsc/scope/src/standalone.d.ts +26 -0
- package/src/ngtsc/scope/src/typecheck.d.ts +1 -1
- package/src/ngtsc/scope/src/util.d.ts +15 -0
- package/src/ngtsc/transform/src/compilation.d.ts +3 -1
- package/src/ngtsc/typecheck/api/checker.d.ts +6 -6
- package/src/ngtsc/typecheck/api/completion.d.ts +3 -3
- package/src/ngtsc/typecheck/api/symbols.d.ts +23 -16
- package/src/ngtsc/typecheck/src/checker.d.ts +5 -4
- package/src/ngtsc/typecheck/src/completion.d.ts +6 -5
- package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +4 -3
- package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
- package/bundles/chunk-34QUU6SJ.js.map +0 -6
- package/bundles/chunk-FJDIFR5C.js.map +0 -6
- package/bundles/chunk-GYVY4Y2L.js.map +0 -6
- package/bundles/chunk-M3IOYIU5.js.map +0 -6
- package/bundles/chunk-SNAJD4VP.js.map +0 -6
- package/bundles/chunk-UMDDHI5B.js.map +0 -6
- package/src/ngtsc/annotations/component/src/scope.d.ts +0 -20
|
@@ -65,14 +65,17 @@ export declare class ModuleResolver {
|
|
|
65
65
|
* Try to resolve the `moduleName` as an external entry-point by searching the `node_modules`
|
|
66
66
|
* folders up the tree for a matching `.../node_modules/${moduleName}`.
|
|
67
67
|
*
|
|
68
|
-
* If a folder is found but the path
|
|
69
|
-
* "deep-import".
|
|
68
|
+
* If a folder is found but the path is not considered an entry-point (see `isEntryPoint()`) then
|
|
69
|
+
* it is marked as a "deep-import".
|
|
70
70
|
*/
|
|
71
71
|
private resolveAsEntryPoint;
|
|
72
72
|
/**
|
|
73
73
|
* Can we consider the given path as an entry-point to a package?
|
|
74
74
|
*
|
|
75
75
|
* This is achieved by checking for the existence of `${modulePath}/package.json`.
|
|
76
|
+
* If there is no `package.json`, we check whether this is an APF v14+ secondary entry-point,
|
|
77
|
+
* which does not have its own `package.json` but has an `exports` entry in the package's primary
|
|
78
|
+
* `package.json`.
|
|
76
79
|
*/
|
|
77
80
|
private isEntryPoint;
|
|
78
81
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/// <amd-module name="@angular/compiler-cli/ngcc/src/execution/cluster/api" />
|
|
9
9
|
import { AbsoluteFsPath } from '../../../../src/ngtsc/file_system';
|
|
10
|
-
import { JsonObject } from '../../
|
|
10
|
+
import { JsonObject } from '../../utils';
|
|
11
11
|
import { PackageJsonChange } from '../../writing/package_json_updater';
|
|
12
12
|
import { Task, TaskProcessingOutcome } from '../tasks/api';
|
|
13
13
|
/** A message reporting that the worker is ready for retrieving tasks. */
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/// <amd-module name="@angular/compiler-cli/ngcc/src/execution/cluster/package_json_updater" />
|
|
9
9
|
import { AbsoluteFsPath } from '../../../../src/ngtsc/file_system';
|
|
10
|
-
import { JsonObject } from '../../
|
|
10
|
+
import { JsonObject } from '../../utils';
|
|
11
11
|
import { PackageJsonChange, PackageJsonUpdate, PackageJsonUpdater } from '../../writing/package_json_updater';
|
|
12
12
|
/**
|
|
13
13
|
* A `PackageJsonUpdater` for cluster workers that will send update changes to the master process so
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* Use of this source code is governed by an MIT-style license that can be
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
|
-
import { EntryPoint, EntryPointJsonProperty
|
|
10
|
-
import { PartiallyOrderedList } from '../../utils';
|
|
9
|
+
import { EntryPoint, EntryPointJsonProperty } from '../../packages/entry_point';
|
|
10
|
+
import { JsonObject, PartiallyOrderedList } from '../../utils';
|
|
11
11
|
/**
|
|
12
12
|
* Represents a unit of work to be undertaken by an `Executor`.
|
|
13
13
|
*
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { AbsoluteFsPath } from '../../../src/ngtsc/file_system';
|
|
10
10
|
import { PackageJsonUpdater } from '../writing/package_json_updater';
|
|
11
11
|
import { EntryPointPackageJson, PackageJsonFormatProperties } from './entry_point';
|
|
12
|
-
export declare const NGCC_VERSION = "14.0.0-
|
|
12
|
+
export declare const NGCC_VERSION = "14.0.0-rc.0";
|
|
13
13
|
/**
|
|
14
14
|
* Returns true if there is a format in this entry-point that was compiled with an outdated version
|
|
15
15
|
* of ngcc.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <amd-module name="@angular/compiler-cli/ngcc/src/packages/entry_point" />
|
|
2
2
|
import { AbsoluteFsPath, ReadonlyFileSystem } from '../../../src/ngtsc/file_system';
|
|
3
3
|
import { Logger } from '../../../src/ngtsc/logging';
|
|
4
|
+
import { JsonObject } from '../utils';
|
|
4
5
|
import { NgccConfiguration } from './configuration';
|
|
5
6
|
/**
|
|
6
7
|
* The possible values for the format of an entry-point.
|
|
@@ -35,13 +36,6 @@ export interface EntryPoint extends JsonObject {
|
|
|
35
36
|
/** Should ngcc generate deep re-exports for this entrypoint? */
|
|
36
37
|
generateDeepReexports: boolean;
|
|
37
38
|
}
|
|
38
|
-
export declare type JsonPrimitive = string | number | boolean | null;
|
|
39
|
-
export declare type JsonValue = JsonPrimitive | JsonArray | JsonObject | undefined;
|
|
40
|
-
export interface JsonArray extends Array<JsonValue> {
|
|
41
|
-
}
|
|
42
|
-
export interface JsonObject {
|
|
43
|
-
[key: string]: JsonValue;
|
|
44
|
-
}
|
|
45
39
|
export interface PackageJsonFormatPropertiesMap {
|
|
46
40
|
browser?: string;
|
|
47
41
|
fesm2015?: string;
|
package/ngcc/src/utils.d.ts
CHANGED
|
@@ -9,6 +9,13 @@
|
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { AbsoluteFsPath, ReadonlyFileSystem } from '../../src/ngtsc/file_system';
|
|
11
11
|
import { DeclarationNode, KnownDeclaration } from '../../src/ngtsc/reflection';
|
|
12
|
+
export declare type JsonPrimitive = string | number | boolean | null;
|
|
13
|
+
export declare type JsonValue = JsonPrimitive | JsonArray | JsonObject | undefined;
|
|
14
|
+
export interface JsonArray extends Array<JsonValue> {
|
|
15
|
+
}
|
|
16
|
+
export interface JsonObject {
|
|
17
|
+
[key: string]: JsonValue;
|
|
18
|
+
}
|
|
12
19
|
/**
|
|
13
20
|
* A list (`Array`) of partially ordered `T` items.
|
|
14
21
|
*
|
|
@@ -85,3 +92,22 @@ export declare function getTsHelperFnFromIdentifier(id: ts.Identifier): KnownDec
|
|
|
85
92
|
*/
|
|
86
93
|
export declare function stripDollarSuffix(value: string): string;
|
|
87
94
|
export declare function stripExtension(fileName: string): string;
|
|
95
|
+
/**
|
|
96
|
+
* Parse the JSON from a `package.json` file.
|
|
97
|
+
*
|
|
98
|
+
* @param packageJsonPath The absolute path to the `package.json` file.
|
|
99
|
+
* @returns JSON from the `package.json` file if it exists and is valid, `null` otherwise.
|
|
100
|
+
*/
|
|
101
|
+
export declare function loadJson<T extends JsonObject = JsonObject>(fs: ReadonlyFileSystem, packageJsonPath: AbsoluteFsPath): T | null;
|
|
102
|
+
/**
|
|
103
|
+
* Given the parsed JSON of a `package.json` file, try to extract info for a secondary entry-point
|
|
104
|
+
* from the `exports` property. Such info will only be present for packages following Angular
|
|
105
|
+
* Package Format v14+.
|
|
106
|
+
*
|
|
107
|
+
* @param primaryPackageJson The parsed JSON of the primary `package.json` (or `null` if it failed
|
|
108
|
+
* to be loaded).
|
|
109
|
+
* @param packagePath The absolute path to the containing npm package.
|
|
110
|
+
* @param entryPointPath The absolute path to the secondary entry-point.
|
|
111
|
+
* @returns The `exports` info for the specified entry-point if it exists, `null` otherwise.
|
|
112
|
+
*/
|
|
113
|
+
export declare function loadSecondaryEntryPointInfoForApfV14(fs: ReadonlyFileSystem, primaryPackageJson: JsonObject | null, packagePath: AbsoluteFsPath, entryPointPath: AbsoluteFsPath): JsonObject | null;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/// <amd-module name="@angular/compiler-cli/ngcc/src/writing/package_json_updater" />
|
|
9
9
|
import { AbsoluteFsPath, FileSystem } from '../../../src/ngtsc/file_system';
|
|
10
|
-
import { JsonObject, JsonValue } from '../
|
|
10
|
+
import { JsonObject, JsonValue } from '../utils';
|
|
11
11
|
export declare type PackageJsonChange = [string[], JsonValue, PackageJsonPropertyPositioning];
|
|
12
12
|
export declare type PackageJsonPropertyPositioning = 'unimportant' | 'alphabetic' | {
|
|
13
13
|
before: string;
|
|
@@ -87,6 +87,7 @@ export declare class PackageJsonUpdate {
|
|
|
87
87
|
*/
|
|
88
88
|
writeChanges(packageJsonPath: AbsoluteFsPath, parsedJson?: JsonObject): void;
|
|
89
89
|
private ensureNotApplied;
|
|
90
|
+
private ensureNotSynthesized;
|
|
90
91
|
}
|
|
91
92
|
/** A `PackageJsonUpdater` that writes directly to the file-system. */
|
|
92
93
|
export declare class DirectPackageJsonUpdater implements PackageJsonUpdater {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler-cli",
|
|
3
|
-
"version": "14.0.0-
|
|
3
|
+
"version": "14.0.0-rc.0",
|
|
4
4
|
"description": "Angular - the compiler CLI for Node.js",
|
|
5
5
|
"typings": "index.d.ts",
|
|
6
6
|
"bin": {
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"yargs": "^17.2.1"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"@angular/compiler": "14.0.0-
|
|
69
|
-
"typescript": ">=4.6.2 <4.
|
|
68
|
+
"@angular/compiler": "14.0.0-rc.0",
|
|
69
|
+
"typescript": ">=4.6.2 <4.8"
|
|
70
70
|
},
|
|
71
71
|
"repository": {
|
|
72
72
|
"type": "git",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"bugs": {
|
|
85
85
|
"url": "https://github.com/angular/angular/issues"
|
|
86
86
|
},
|
|
87
|
-
"homepage": "https://github.com/angular/angular/tree/
|
|
87
|
+
"homepage": "https://github.com/angular/angular/tree/main/packages/compiler-cli",
|
|
88
88
|
"ng-update": {
|
|
89
89
|
"packageGroup": [
|
|
90
90
|
"@angular/core",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC 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
|
+
*/
|
|
8
|
+
/// <amd-module name="@angular/compiler-cli/src/ngtsc/annotations/common/src/schema" />
|
|
9
|
+
import { SchemaMetadata } from '@angular/compiler';
|
|
10
|
+
import ts from 'typescript';
|
|
11
|
+
import { PartialEvaluator } from '../../../partial_evaluator';
|
|
12
|
+
export declare function extractSchemas(rawExpr: ts.Expression, evaluator: PartialEvaluator, context: string): SchemaMetadata[];
|
|
@@ -53,7 +53,7 @@ export declare function tryUnwrapForwardRef(node: ts.Expression, reflector: Refl
|
|
|
53
53
|
* @param args the arguments to the invocation of the forwardRef expression
|
|
54
54
|
* @returns an unwrapped argument if `ref` pointed to forwardRef, or null otherwise
|
|
55
55
|
*/
|
|
56
|
-
export declare
|
|
56
|
+
export declare const forwardRefResolver: ForeignFunctionResolver;
|
|
57
57
|
/**
|
|
58
58
|
* Combines an array of resolver functions into a one.
|
|
59
59
|
* @param resolvers Resolvers to be combined.
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <amd-module name="@angular/compiler-cli/src/ngtsc/annotations/component/src/metadata" />
|
|
9
|
-
import { AnimationTriggerNames, R3ClassMetadata, R3ComponentMetadata } from '@angular/compiler';
|
|
9
|
+
import { AnimationTriggerNames, R3ClassMetadata, R3ComponentMetadata, R3TemplateDependencyMetadata, SchemaMetadata } from '@angular/compiler';
|
|
10
10
|
import ts from 'typescript';
|
|
11
11
|
import { Reference } from '../../../imports';
|
|
12
12
|
import { ClassPropertyMapping, ComponentResources, DirectiveTypeCheckMeta } from '../../../metadata';
|
|
@@ -19,13 +19,13 @@ import { ParsedTemplateWithSource, StyleUrlMeta } from './resources';
|
|
|
19
19
|
* The `keyof R3ComponentMetadata &` condition ensures that only fields of `R3ComponentMetadata` can
|
|
20
20
|
* be included here.
|
|
21
21
|
*/
|
|
22
|
-
export declare type ComponentMetadataResolvedFields = SubsetOfKeys<R3ComponentMetadata
|
|
22
|
+
export declare type ComponentMetadataResolvedFields = SubsetOfKeys<R3ComponentMetadata<R3TemplateDependencyMetadata>, 'declarations' | 'declarationListEmitMode'>;
|
|
23
23
|
export interface ComponentAnalysisData {
|
|
24
24
|
/**
|
|
25
25
|
* `meta` includes those fields of `R3ComponentMetadata` which are calculated at `analyze` time
|
|
26
26
|
* (not during resolve).
|
|
27
27
|
*/
|
|
28
|
-
meta: Omit<R3ComponentMetadata
|
|
28
|
+
meta: Omit<R3ComponentMetadata<R3TemplateDependencyMetadata>, ComponentMetadataResolvedFields>;
|
|
29
29
|
baseClass: Reference<ClassDeclaration> | 'dynamic' | null;
|
|
30
30
|
typeCheckMeta: DirectiveTypeCheckMeta;
|
|
31
31
|
template: ParsedTemplateWithSource;
|
|
@@ -53,9 +53,8 @@ export interface ComponentAnalysisData {
|
|
|
53
53
|
inlineStyles: string[] | null;
|
|
54
54
|
isPoisoned: boolean;
|
|
55
55
|
animationTriggerNames: AnimationTriggerNames | null;
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} | null;
|
|
56
|
+
rawImports: ts.Expression | null;
|
|
57
|
+
resolvedImports: Reference<ClassDeclaration>[] | null;
|
|
58
|
+
schemas: SchemaMetadata[] | null;
|
|
60
59
|
}
|
|
61
|
-
export declare type ComponentResolutionData = Pick<R3ComponentMetadata
|
|
60
|
+
export declare type ComponentResolutionData = Pick<R3ComponentMetadata<R3TemplateDependencyMetadata>, ComponentMetadataResolvedFields>;
|
|
@@ -116,7 +116,7 @@ export declare function makeResourceNotFoundError(file: string, nodeForError: ts
|
|
|
116
116
|
* Additionally, the references to external resources would require libraries to ship
|
|
117
117
|
* external resources exclusively for the class metadata.
|
|
118
118
|
*/
|
|
119
|
-
export declare function
|
|
119
|
+
export declare function transformDecoratorResources(dec: Decorator, component: Map<string, ts.Expression>, styles: string[], template: ParsedTemplateWithSource): Decorator;
|
|
120
120
|
export declare function extractComponentStyleUrls(evaluator: PartialEvaluator, component: Map<string, ts.Expression>): StyleUrlMeta[];
|
|
121
121
|
export declare function extractStyleResources(resourceLoader: ResourceLoader, component: Map<string, ts.Expression>, containingFile: string): ReadonlySet<Resource>;
|
|
122
122
|
export declare function _extractTemplateStyleUrls(template: ParsedTemplateWithSource): StyleUrlMeta[];
|
|
@@ -20,14 +20,17 @@ import { AnalysisOutput, CompileResult, DecoratorHandler, DetectResult, HandlerP
|
|
|
20
20
|
import { ReferencesRegistry } from '../../common';
|
|
21
21
|
export interface NgModuleAnalysis {
|
|
22
22
|
mod: R3NgModuleMetadata;
|
|
23
|
-
inj: R3InjectorMetadata
|
|
23
|
+
inj: Omit<R3InjectorMetadata, 'imports'>;
|
|
24
24
|
fac: R3FactoryMetadata;
|
|
25
25
|
classMetadata: R3ClassMetadata | null;
|
|
26
26
|
declarations: Reference<ClassDeclaration>[];
|
|
27
27
|
rawDeclarations: ts.Expression | null;
|
|
28
28
|
schemas: SchemaMetadata[];
|
|
29
|
-
imports:
|
|
29
|
+
imports: TopLevelImportedExpression[];
|
|
30
|
+
importRefs: Reference<ClassDeclaration>[];
|
|
31
|
+
rawImports: ts.Expression | null;
|
|
30
32
|
exports: Reference<ClassDeclaration>[];
|
|
33
|
+
rawExports: ts.Expression | null;
|
|
31
34
|
id: Expression | null;
|
|
32
35
|
factorySymbolName: string;
|
|
33
36
|
providersRequiringFactory: Set<Reference<ClassDeclaration>> | null;
|
|
@@ -72,11 +75,6 @@ export declare class NgModuleDecoratorHandler implements DecoratorHandler<Decora
|
|
|
72
75
|
resolve(node: ClassDeclaration, analysis: Readonly<NgModuleAnalysis>): ResolveResult<NgModuleResolution>;
|
|
73
76
|
compileFull(node: ClassDeclaration, { inj, mod, fac, classMetadata, declarations }: Readonly<NgModuleAnalysis>, { injectorImports }: Readonly<NgModuleResolution>): CompileResult[];
|
|
74
77
|
compilePartial(node: ClassDeclaration, { inj, fac, mod, classMetadata }: Readonly<NgModuleAnalysis>, { injectorImports }: Readonly<NgModuleResolution>): CompileResult[];
|
|
75
|
-
/**
|
|
76
|
-
* Merge the injector imports (which are 'exports' that were later found to be NgModules)
|
|
77
|
-
* computed during resolution with the ones from analysis.
|
|
78
|
-
*/
|
|
79
|
-
private mergeInjectorImports;
|
|
80
78
|
/**
|
|
81
79
|
* Add class metadata statements, if provided, to the `ngModuleStatements`.
|
|
82
80
|
*/
|
|
@@ -112,3 +110,8 @@ export declare class NgModuleDecoratorHandler implements DecoratorHandler<Decora
|
|
|
112
110
|
*/
|
|
113
111
|
private resolveTypeList;
|
|
114
112
|
}
|
|
113
|
+
export interface TopLevelImportedExpression {
|
|
114
|
+
expression: ts.Expression;
|
|
115
|
+
resolvedReferences: Array<Reference<ClassDeclaration>>;
|
|
116
|
+
hasModuleWithProviders: boolean;
|
|
117
|
+
}
|
|
@@ -23,7 +23,7 @@ export declare type ExtendedCompilerHostMethods = 'getCanonicalFileName' | 'reso
|
|
|
23
23
|
* which is relied upon by `NgCompiler`. A consumer of `NgCompiler` can therefore use the
|
|
24
24
|
* `NgCompilerHost` or implement `NgCompilerAdapter` itself.
|
|
25
25
|
*/
|
|
26
|
-
export interface NgCompilerAdapter extends Omit<ts.ModuleResolutionHost, 'getCurrentDirectory'>, Pick<ExtendedTsCompilerHost, 'getCurrentDirectory' | ExtendedCompilerHostMethods
|
|
26
|
+
export interface NgCompilerAdapter extends Omit<ts.ModuleResolutionHost, 'getCurrentDirectory'>, Pick<ExtendedTsCompilerHost, 'getCurrentDirectory' | ExtendedCompilerHostMethods>, SourceFileTypeIdentifier {
|
|
27
27
|
/**
|
|
28
28
|
* A path to a single file which represents the entrypoint of an Angular Package Format library,
|
|
29
29
|
* if the current program is one.
|
|
@@ -61,6 +61,8 @@ export interface NgCompilerAdapter extends Omit<ts.ModuleResolutionHost, 'getCur
|
|
|
61
61
|
* Resolved list of root directories explicitly set in, or inferred from, the tsconfig.
|
|
62
62
|
*/
|
|
63
63
|
readonly rootDirs: ReadonlyArray<AbsoluteFsPath>;
|
|
64
|
+
}
|
|
65
|
+
export interface SourceFileTypeIdentifier {
|
|
64
66
|
/**
|
|
65
67
|
* Distinguishes between shim files added by Angular to the compilation process (both those
|
|
66
68
|
* intended for output, like ngfactory files, as well as internal shims like ngtypecheck files)
|
|
@@ -70,4 +72,13 @@ export interface NgCompilerAdapter extends Omit<ts.ModuleResolutionHost, 'getCur
|
|
|
70
72
|
* `true` if a file was written by the user, and `false` if a file was added by the compiler.
|
|
71
73
|
*/
|
|
72
74
|
isShim(sf: ts.SourceFile): boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Distinguishes between resource files added by Angular to the project and original files in the
|
|
77
|
+
* user's program.
|
|
78
|
+
*
|
|
79
|
+
* This is necessary only for the language service because it adds resource files as root files
|
|
80
|
+
* when they are read. This is done to indicate to TS Server that these resources are part of the
|
|
81
|
+
* project and ensures that projects are retained properly when navigating around the workspace.
|
|
82
|
+
*/
|
|
83
|
+
isResource(sf: ts.SourceFile): boolean;
|
|
73
84
|
}
|
|
@@ -36,14 +36,14 @@ export declare class DelegatingCompilerHost implements Omit<RequiredDelegations<
|
|
|
36
36
|
getModifiedResourceFiles: (() => Set<string> | undefined) | undefined;
|
|
37
37
|
getNewLine: () => string;
|
|
38
38
|
getParsedCommandLine: ((fileName: string) => ts.ParsedCommandLine | undefined) | undefined;
|
|
39
|
-
getSourceFileByPath: ((fileName: string, path: ts.Path,
|
|
39
|
+
getSourceFileByPath: ((fileName: string, path: ts.Path, languageVersionOrOptions: ts.ScriptTarget | ts.CreateSourceFileOptions, onError?: ((message: string) => void) | undefined, shouldCreateNewSourceFile?: boolean | undefined) => ts.SourceFile | undefined) | undefined;
|
|
40
40
|
readDirectory: ((rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number | undefined) => string[]) | undefined;
|
|
41
41
|
readFile: (fileName: string) => string | undefined;
|
|
42
42
|
readResource: ((fileName: string) => string | Promise<string>) | undefined;
|
|
43
43
|
transformResource: ((data: string, context: import("@angular/compiler-cli/src/ngtsc/core/api/index").ResourceHostContext) => Promise<import("@angular/compiler-cli/src/ngtsc/core/api/index").TransformResourceResult | null>) | undefined;
|
|
44
44
|
realpath: ((path: string) => string) | undefined;
|
|
45
45
|
resolveModuleNames: ((moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions, containingSourceFile?: ts.SourceFile | undefined) => (ts.ResolvedModule | undefined)[]) | undefined;
|
|
46
|
-
resolveTypeReferenceDirectives: ((typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions) => (ts.ResolvedTypeReferenceDirective | undefined)[]) | undefined;
|
|
46
|
+
resolveTypeReferenceDirectives: ((typeReferenceDirectiveNames: string[] | readonly ts.FileReference[], containingFile: string, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions, containingFileMode?: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined) => (ts.ResolvedTypeReferenceDirective | undefined)[]) | undefined;
|
|
47
47
|
resourceNameToFileName: ((resourceName: string, containingFilePath: string, fallbackResolve?: ((url: string, fromFile: string) => string | null) | undefined) => string | null) | undefined;
|
|
48
48
|
trace: ((s: string) => void) | undefined;
|
|
49
49
|
useCaseSensitiveFileNames: () => boolean;
|
|
@@ -97,6 +97,13 @@ export declare class NgCompilerHost extends DelegatingCompilerHost implements Re
|
|
|
97
97
|
* If this returns false, the file is user-provided.
|
|
98
98
|
*/
|
|
99
99
|
isShim(sf: ts.SourceFile): boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Check whether the given `ts.SourceFile` is a resource file.
|
|
102
|
+
*
|
|
103
|
+
* This simply returns `false` for the compiler-cli since resource files are not added as root
|
|
104
|
+
* files to the project.
|
|
105
|
+
*/
|
|
106
|
+
isResource(sf: ts.SourceFile): boolean;
|
|
100
107
|
getSourceFile(fileName: string, languageVersion: ts.ScriptTarget, onError?: ((message: string) => void) | undefined, shouldCreateNewSourceFile?: boolean | undefined): ts.SourceFile | undefined;
|
|
101
108
|
fileExists(fileName: string): boolean;
|
|
102
109
|
get unifiedModulesHost(): UnifiedModulesHost | null;
|
|
@@ -120,6 +120,10 @@ export declare enum ErrorCode {
|
|
|
120
120
|
* Raised when a standalone directive/pipe is part of the declarations of an NgModule.
|
|
121
121
|
*/
|
|
122
122
|
NGMODULE_DECLARATION_IS_STANDALONE = 6008,
|
|
123
|
+
/**
|
|
124
|
+
* Raised when a standalone component is part of the bootstrap list of an NgModule.
|
|
125
|
+
*/
|
|
126
|
+
NGMODULE_BOOTSTRAP_IS_STANDALONE = 6009,
|
|
123
127
|
/**
|
|
124
128
|
* Indicates that an NgModule is declared with `id: module.id`. This is an anti-pattern that is
|
|
125
129
|
* disabled explicitly in the compiler, that was originally based on a misunderstanding of
|
|
@@ -15,6 +15,7 @@ import { ClassPropertyMapping, ClassPropertyName } from './property_mapping';
|
|
|
15
15
|
* Metadata collected for an `NgModule`.
|
|
16
16
|
*/
|
|
17
17
|
export interface NgModuleMeta {
|
|
18
|
+
kind: MetaKind.NgModule;
|
|
18
19
|
ref: Reference<ClassDeclaration>;
|
|
19
20
|
declarations: Reference<ClassDeclaration>[];
|
|
20
21
|
imports: Reference<ClassDeclaration>[];
|
|
@@ -27,6 +28,20 @@ export interface NgModuleMeta {
|
|
|
27
28
|
* because the module came from a .d.ts file).
|
|
28
29
|
*/
|
|
29
30
|
rawDeclarations: ts.Expression | null;
|
|
31
|
+
/**
|
|
32
|
+
* The raw `ts.Expression` which gave rise to `imports`, if one exists.
|
|
33
|
+
*
|
|
34
|
+
* If this is `null`, then either no imports exist, or no expression was available (likely
|
|
35
|
+
* because the module came from a .d.ts file).
|
|
36
|
+
*/
|
|
37
|
+
rawImports: ts.Expression | null;
|
|
38
|
+
/**
|
|
39
|
+
* The raw `ts.Expression` which gave rise to `exports`, if one exists.
|
|
40
|
+
*
|
|
41
|
+
* If this is `null`, then either no exports exist, or no expression was available (likely
|
|
42
|
+
* because the module came from a .d.ts file).
|
|
43
|
+
*/
|
|
44
|
+
rawExports: ts.Expression | null;
|
|
30
45
|
}
|
|
31
46
|
/**
|
|
32
47
|
* Typing metadata collected for a directive within an NgModule's scope.
|
|
@@ -67,15 +82,19 @@ export interface DirectiveTypeCheckMeta {
|
|
|
67
82
|
*/
|
|
68
83
|
isGeneric: boolean;
|
|
69
84
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Disambiguates different kinds of compiler metadata objects.
|
|
87
|
+
*/
|
|
88
|
+
export declare enum MetaKind {
|
|
89
|
+
Directive = 0,
|
|
90
|
+
Pipe = 1,
|
|
91
|
+
NgModule = 2
|
|
73
92
|
}
|
|
74
93
|
/**
|
|
75
94
|
* Metadata collected for a directive within an NgModule's scope.
|
|
76
95
|
*/
|
|
77
96
|
export interface DirectiveMeta extends T2DirectiveMeta, DirectiveTypeCheckMeta {
|
|
78
|
-
|
|
97
|
+
kind: MetaKind.Directive;
|
|
79
98
|
ref: Reference<ClassDeclaration>;
|
|
80
99
|
/**
|
|
81
100
|
* Unparsed selector of the directive, or null if the directive does not have a selector.
|
|
@@ -110,6 +129,14 @@ export interface DirectiveMeta extends T2DirectiveMeta, DirectiveTypeCheckMeta {
|
|
|
110
129
|
* Whether the directive is a standalone entity.
|
|
111
130
|
*/
|
|
112
131
|
isStandalone: boolean;
|
|
132
|
+
/**
|
|
133
|
+
* For standalone components, the list of imported types.
|
|
134
|
+
*/
|
|
135
|
+
imports: Reference<ClassDeclaration>[] | null;
|
|
136
|
+
/**
|
|
137
|
+
* For standalone components, the list of schemas declared.
|
|
138
|
+
*/
|
|
139
|
+
schemas: SchemaMetadata[] | null;
|
|
113
140
|
}
|
|
114
141
|
/**
|
|
115
142
|
* Metadata that describes a template guard for one of the directive's inputs.
|
|
@@ -132,7 +159,7 @@ export interface TemplateGuardMeta {
|
|
|
132
159
|
* Metadata for a pipe within an NgModule's scope.
|
|
133
160
|
*/
|
|
134
161
|
export interface PipeMeta {
|
|
135
|
-
|
|
162
|
+
kind: MetaKind.Pipe;
|
|
136
163
|
ref: Reference<ClassDeclaration>;
|
|
137
164
|
name: string;
|
|
138
165
|
nameExpr: ts.Expression | null;
|
|
@@ -12,6 +12,7 @@ import { ClassDeclaration, ReflectionHost } from '../../reflection';
|
|
|
12
12
|
import { DirectiveMeta, DirectiveTypeCheckMeta, MetadataReader, NgModuleMeta, PipeMeta } from './api';
|
|
13
13
|
import { ClassPropertyMapping } from './property_mapping';
|
|
14
14
|
export declare function extractReferencesFromType(checker: ts.TypeChecker, def: ts.TypeNode, bestGuessOwningModule: OwningModule | null): Reference<ClassDeclaration>[];
|
|
15
|
+
export declare function readBooleanType(type: ts.TypeNode): boolean | null;
|
|
15
16
|
export declare function readStringType(type: ts.TypeNode): string | null;
|
|
16
17
|
export declare function readStringMapType(type: ts.TypeNode): {
|
|
17
18
|
[key: string]: string;
|
|
@@ -11,3 +11,4 @@ export { DynamicValue } from './src/dynamic';
|
|
|
11
11
|
export { ForeignFunctionResolver, PartialEvaluator } from './src/interface';
|
|
12
12
|
export { StaticInterpreter } from './src/interpreter';
|
|
13
13
|
export { EnumValue, KnownFn, ResolvedValue, ResolvedValueArray, ResolvedValueMap } from './src/result';
|
|
14
|
+
export { SyntheticValue } from './src/synthetic';
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
import ts from 'typescript';
|
|
10
10
|
import { Reference } from '../../imports';
|
|
11
11
|
import { FunctionDefinition } from '../../reflection';
|
|
12
|
+
import { SyntheticValue } from './synthetic';
|
|
12
13
|
/**
|
|
13
14
|
* The reason why a value cannot be determined statically.
|
|
14
15
|
*/
|
|
@@ -67,10 +68,15 @@ export declare const enum DynamicValueReason {
|
|
|
67
68
|
* 'foo', 'bar' or any arbitrary string, so we evaluate it to a DynamicValue.
|
|
68
69
|
*/
|
|
69
70
|
DYNAMIC_TYPE = 7,
|
|
71
|
+
/**
|
|
72
|
+
* A value could not be determined because one of the inputs to its evaluation is a synthetically
|
|
73
|
+
* produced value.
|
|
74
|
+
*/
|
|
75
|
+
SYNTHETIC_INPUT = 8,
|
|
70
76
|
/**
|
|
71
77
|
* A value could not be determined statically for any reason other the above.
|
|
72
78
|
*/
|
|
73
|
-
UNKNOWN =
|
|
79
|
+
UNKNOWN = 9
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* Represents a value which cannot be determined statically.
|
|
@@ -88,6 +94,7 @@ export declare class DynamicValue<R = unknown> {
|
|
|
88
94
|
static fromInvalidExpressionType(node: ts.Node, value: unknown): DynamicValue<unknown>;
|
|
89
95
|
static fromComplexFunctionCall(node: ts.Node, fn: FunctionDefinition): DynamicValue<FunctionDefinition>;
|
|
90
96
|
static fromDynamicType(node: ts.TypeNode): DynamicValue;
|
|
97
|
+
static fromSyntheticInput(node: ts.Node, value: SyntheticValue<unknown>): DynamicValue<SyntheticValue<unknown>>;
|
|
91
98
|
static fromUnknown(node: ts.Node): DynamicValue;
|
|
92
99
|
isFromDynamicInput(this: DynamicValue<R>): this is DynamicValue<DynamicValue>;
|
|
93
100
|
isFromDynamicString(this: DynamicValue<R>): this is DynamicValue;
|
|
@@ -109,5 +116,6 @@ export interface DynamicValueVisitor<R> {
|
|
|
109
116
|
visitInvalidExpressionType(value: DynamicValue): R;
|
|
110
117
|
visitComplexFunctionCall(value: DynamicValue<FunctionDefinition>): R;
|
|
111
118
|
visitDynamicType(value: DynamicValue): R;
|
|
119
|
+
visitSyntheticInput(value: DynamicValue<SyntheticValue<unknown>>): R;
|
|
112
120
|
visitUnknown(value: DynamicValue): R;
|
|
113
121
|
}
|
|
@@ -10,8 +10,9 @@ import ts from 'typescript';
|
|
|
10
10
|
import { Reference } from '../../imports';
|
|
11
11
|
import { DependencyTracker } from '../../incremental/api';
|
|
12
12
|
import { ReflectionHost } from '../../reflection';
|
|
13
|
+
import { DynamicValue } from './dynamic';
|
|
13
14
|
import { ResolvedValue } from './result';
|
|
14
|
-
export declare type ForeignFunctionResolver = (
|
|
15
|
+
export declare type ForeignFunctionResolver = (fn: Reference<ts.FunctionDeclaration | ts.MethodDeclaration | ts.FunctionExpression>, callExpr: ts.CallExpression, resolve: (expr: ts.Expression) => ResolvedValue, unresolvable: DynamicValue) => ResolvedValue;
|
|
15
16
|
export declare class PartialEvaluator {
|
|
16
17
|
private host;
|
|
17
18
|
private checker;
|
|
@@ -10,6 +10,7 @@ import ts from 'typescript';
|
|
|
10
10
|
import { Reference } from '../../imports';
|
|
11
11
|
import { Declaration } from '../../reflection';
|
|
12
12
|
import { DynamicValue } from './dynamic';
|
|
13
|
+
import { SyntheticValue } from './synthetic';
|
|
13
14
|
/**
|
|
14
15
|
* A value resulting from static resolution.
|
|
15
16
|
*
|
|
@@ -17,7 +18,7 @@ import { DynamicValue } from './dynamic';
|
|
|
17
18
|
* non-primitive value, or a special `DynamicValue` type which indicates the value was not
|
|
18
19
|
* available statically.
|
|
19
20
|
*/
|
|
20
|
-
export declare type ResolvedValue = number | boolean | string | null | undefined | Reference | EnumValue | ResolvedValueArray | ResolvedValueMap | ResolvedModule | KnownFn | DynamicValue<unknown>;
|
|
21
|
+
export declare type ResolvedValue = number | boolean | string | null | undefined | Reference | EnumValue | ResolvedValueArray | ResolvedValueMap | ResolvedModule | KnownFn | SyntheticValue<unknown> | DynamicValue<unknown>;
|
|
21
22
|
/**
|
|
22
23
|
* An array of `ResolvedValue`s.
|
|
23
24
|
*
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC 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
|
+
*/
|
|
8
|
+
/// <amd-module name="@angular/compiler-cli/src/ngtsc/partial_evaluator/src/synthetic" />
|
|
9
|
+
/**
|
|
10
|
+
* A value produced which originated in a `ForeignFunctionResolver` and doesn't come from the
|
|
11
|
+
* template itself.
|
|
12
|
+
*
|
|
13
|
+
* Synthetic values cannot be further evaluated, and attempts to do so produce `DynamicValue`s
|
|
14
|
+
* instead.
|
|
15
|
+
*/
|
|
16
|
+
export declare class SyntheticValue<T> {
|
|
17
|
+
readonly value: T;
|
|
18
|
+
constructor(value: T);
|
|
19
|
+
}
|
|
@@ -32,12 +32,12 @@ export declare class DelegatingCompilerHost implements Omit<RequiredDelegations<
|
|
|
32
32
|
getEnvironmentVariable: ((name: string) => string | undefined) | undefined;
|
|
33
33
|
getNewLine: () => string;
|
|
34
34
|
getParsedCommandLine: ((fileName: string) => ts.ParsedCommandLine | undefined) | undefined;
|
|
35
|
-
getSourceFileByPath: ((fileName: string, path: ts.Path,
|
|
35
|
+
getSourceFileByPath: ((fileName: string, path: ts.Path, languageVersionOrOptions: ts.ScriptTarget | ts.CreateSourceFileOptions, onError?: ((message: string) => void) | undefined, shouldCreateNewSourceFile?: boolean | undefined) => ts.SourceFile | undefined) | undefined;
|
|
36
36
|
readDirectory: ((rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number | undefined) => string[]) | undefined;
|
|
37
37
|
readFile: (fileName: string) => string | undefined;
|
|
38
38
|
realpath: ((path: string) => string) | undefined;
|
|
39
39
|
resolveModuleNames: ((moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions, containingSourceFile?: ts.SourceFile | undefined) => (ts.ResolvedModule | undefined)[]) | undefined;
|
|
40
|
-
resolveTypeReferenceDirectives: ((typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions) => (ts.ResolvedTypeReferenceDirective | undefined)[]) | undefined;
|
|
40
|
+
resolveTypeReferenceDirectives: ((typeReferenceDirectiveNames: string[] | readonly ts.FileReference[], containingFile: string, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions, containingFileMode?: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined) => (ts.ResolvedTypeReferenceDirective | undefined)[]) | undefined;
|
|
41
41
|
trace: ((s: string) => void) | undefined;
|
|
42
42
|
useCaseSensitiveFileNames: () => boolean;
|
|
43
43
|
getModuleResolutionCache: (() => ts.ModuleResolutionCache | undefined) | undefined;
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* found in the LICENSE file at https://angular.io/license
|
|
7
7
|
*/
|
|
8
8
|
/// <amd-module name="@angular/compiler-cli/src/ngtsc/scope" />
|
|
9
|
-
export { ExportScope, ScopeData } from './src/api';
|
|
10
|
-
export {
|
|
9
|
+
export { ComponentScopeKind, ComponentScopeReader, ExportScope, LocalModuleScope, ScopeData, StandaloneScope } from './src/api';
|
|
10
|
+
export { CompoundComponentScopeReader } from './src/component_scope';
|
|
11
11
|
export { DtsModuleScopeResolver, MetadataDtsModuleScopeResolver } from './src/dependency';
|
|
12
|
-
export { DeclarationData,
|
|
12
|
+
export { DeclarationData, LocalModuleScopeRegistry, LocalNgModuleData } from './src/local';
|
|
13
13
|
export { TypeCheckScope, TypeCheckScopeRegistry } from './src/typecheck';
|
|
14
|
+
export { makeNotStandaloneDiagnostic, makeUnknownComponentImportDiagnostic } from './src/util';
|