@angular/compiler-cli 14.0.0-next.13 → 14.0.0-next.16
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-FDAHGRSF.js → chunk-36EOQKNZ.js} +3 -3
- package/bundles/{chunk-FDAHGRSF.js.map → chunk-36EOQKNZ.js.map} +0 -0
- package/bundles/{chunk-DNXEJI2I.js → chunk-4TK5AAQK.js} +2 -2
- package/bundles/{chunk-DNXEJI2I.js.map → chunk-4TK5AAQK.js.map} +0 -0
- package/bundles/{chunk-ESNS3BVQ.js → chunk-6E6DHHHX.js} +140 -52
- package/bundles/chunk-6E6DHHHX.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-RYXFJXXN.js → chunk-HZUCTYDG.js} +3216 -3053
- package/bundles/chunk-HZUCTYDG.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-LQLIHXU2.js → chunk-OGPZOZRU.js} +4 -4
- package/bundles/{chunk-LQLIHXU2.js.map → chunk-OGPZOZRU.js.map} +0 -0
- package/bundles/index.js +4 -4
- 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/packages/build_marker.d.ts +1 -1
- package/package.json +3 -3
- 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 +8 -7
- package/src/ngtsc/core/src/host.d.ts +2 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
- package/src/ngtsc/metadata/src/api.d.ts +18 -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 +2 -2
- package/src/ngtsc/scope/src/api.d.ts +16 -10
- package/src/ngtsc/scope/src/component_scope.d.ts +2 -2
- package/src/ngtsc/scope/src/standalone.d.ts +26 -0
- package/src/ngtsc/scope/src/util.d.ts +1 -0
- package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
- package/bundles/chunk-ESNS3BVQ.js.map +0 -6
- package/bundles/chunk-FJDIFR5C.js.map +0 -6
- package/bundles/chunk-RYXFJXXN.js.map +0 -6
- package/bundles/chunk-UMDDHI5B.js.map +0 -6
- package/src/ngtsc/annotations/component/src/scope.d.ts +0 -20
|
@@ -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-next.
|
|
12
|
+
export declare const NGCC_VERSION = "14.0.0-next.16";
|
|
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.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler-cli",
|
|
3
|
-
"version": "14.0.0-next.
|
|
3
|
+
"version": "14.0.0-next.16",
|
|
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-next.
|
|
69
|
-
"typescript": ">=4.6.2 <4.
|
|
68
|
+
"@angular/compiler": "14.0.0-next.16",
|
|
69
|
+
"typescript": ">=4.6.2 <4.8"
|
|
70
70
|
},
|
|
71
71
|
"repository": {
|
|
72
72
|
"type": "git",
|
|
@@ -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,13 +20,14 @@ 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>[];
|
|
30
31
|
rawImports: ts.Expression | null;
|
|
31
32
|
exports: Reference<ClassDeclaration>[];
|
|
32
33
|
rawExports: ts.Expression | null;
|
|
@@ -74,11 +75,6 @@ export declare class NgModuleDecoratorHandler implements DecoratorHandler<Decora
|
|
|
74
75
|
resolve(node: ClassDeclaration, analysis: Readonly<NgModuleAnalysis>): ResolveResult<NgModuleResolution>;
|
|
75
76
|
compileFull(node: ClassDeclaration, { inj, mod, fac, classMetadata, declarations }: Readonly<NgModuleAnalysis>, { injectorImports }: Readonly<NgModuleResolution>): CompileResult[];
|
|
76
77
|
compilePartial(node: ClassDeclaration, { inj, fac, mod, classMetadata }: Readonly<NgModuleAnalysis>, { injectorImports }: Readonly<NgModuleResolution>): CompileResult[];
|
|
77
|
-
/**
|
|
78
|
-
* Merge the injector imports (which are 'exports' that were later found to be NgModules)
|
|
79
|
-
* computed during resolution with the ones from analysis.
|
|
80
|
-
*/
|
|
81
|
-
private mergeInjectorImports;
|
|
82
78
|
/**
|
|
83
79
|
* Add class metadata statements, if provided, to the `ngModuleStatements`.
|
|
84
80
|
*/
|
|
@@ -114,3 +110,8 @@ export declare class NgModuleDecoratorHandler implements DecoratorHandler<Decora
|
|
|
114
110
|
*/
|
|
115
111
|
private resolveTypeList;
|
|
116
112
|
}
|
|
113
|
+
export interface TopLevelImportedExpression {
|
|
114
|
+
expression: ts.Expression;
|
|
115
|
+
resolvedReferences: Array<Reference<ClassDeclaration>>;
|
|
116
|
+
hasModuleWithProviders: boolean;
|
|
117
|
+
}
|
|
@@ -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;
|
|
@@ -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>[];
|
|
@@ -81,15 +82,19 @@ export interface DirectiveTypeCheckMeta {
|
|
|
81
82
|
*/
|
|
82
83
|
isGeneric: boolean;
|
|
83
84
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
/**
|
|
86
|
+
* Disambiguates different kinds of compiler metadata objects.
|
|
87
|
+
*/
|
|
88
|
+
export declare enum MetaKind {
|
|
89
|
+
Directive = 0,
|
|
90
|
+
Pipe = 1,
|
|
91
|
+
NgModule = 2
|
|
87
92
|
}
|
|
88
93
|
/**
|
|
89
94
|
* Metadata collected for a directive within an NgModule's scope.
|
|
90
95
|
*/
|
|
91
96
|
export interface DirectiveMeta extends T2DirectiveMeta, DirectiveTypeCheckMeta {
|
|
92
|
-
|
|
97
|
+
kind: MetaKind.Directive;
|
|
93
98
|
ref: Reference<ClassDeclaration>;
|
|
94
99
|
/**
|
|
95
100
|
* Unparsed selector of the directive, or null if the directive does not have a selector.
|
|
@@ -124,6 +129,14 @@ export interface DirectiveMeta extends T2DirectiveMeta, DirectiveTypeCheckMeta {
|
|
|
124
129
|
* Whether the directive is a standalone entity.
|
|
125
130
|
*/
|
|
126
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;
|
|
127
140
|
}
|
|
128
141
|
/**
|
|
129
142
|
* Metadata that describes a template guard for one of the directive's inputs.
|
|
@@ -146,7 +159,7 @@ export interface TemplateGuardMeta {
|
|
|
146
159
|
* Metadata for a pipe within an NgModule's scope.
|
|
147
160
|
*/
|
|
148
161
|
export interface PipeMeta {
|
|
149
|
-
|
|
162
|
+
kind: MetaKind.Pipe;
|
|
150
163
|
ref: Reference<ClassDeclaration>;
|
|
151
164
|
name: string;
|
|
152
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,9 +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 { ComponentScopeReader, ExportScope, LocalModuleScope, ScopeData } from './src/api';
|
|
9
|
+
export { ComponentScopeKind, ComponentScopeReader, ExportScope, LocalModuleScope, ScopeData, StandaloneScope } from './src/api';
|
|
10
10
|
export { CompoundComponentScopeReader } from './src/component_scope';
|
|
11
11
|
export { DtsModuleScopeResolver, MetadataDtsModuleScopeResolver } from './src/dependency';
|
|
12
12
|
export { DeclarationData, LocalModuleScopeRegistry, LocalNgModuleData } from './src/local';
|
|
13
13
|
export { TypeCheckScope, TypeCheckScopeRegistry } from './src/typecheck';
|
|
14
|
-
export { makeNotStandaloneDiagnostic } from './src/util';
|
|
14
|
+
export { makeNotStandaloneDiagnostic, makeUnknownComponentImportDiagnostic } from './src/util';
|
|
@@ -8,20 +8,13 @@
|
|
|
8
8
|
/// <amd-module name="@angular/compiler-cli/src/ngtsc/scope/src/api" />
|
|
9
9
|
import { SchemaMetadata } from '@angular/compiler';
|
|
10
10
|
import { Reexport, Reference } from '../../imports';
|
|
11
|
-
import { DirectiveMeta, PipeMeta } from '../../metadata';
|
|
11
|
+
import { DirectiveMeta, NgModuleMeta, PipeMeta } from '../../metadata';
|
|
12
12
|
import { ClassDeclaration } from '../../reflection';
|
|
13
13
|
/**
|
|
14
14
|
* Data for one of a given NgModule's scopes (either compilation scope or export scopes).
|
|
15
15
|
*/
|
|
16
16
|
export interface ScopeData {
|
|
17
|
-
|
|
18
|
-
* Directives in the exported scope of the module.
|
|
19
|
-
*/
|
|
20
|
-
directives: DirectiveMeta[];
|
|
21
|
-
/**
|
|
22
|
-
* Pipes in the exported scope of the module.
|
|
23
|
-
*/
|
|
24
|
-
pipes: PipeMeta[];
|
|
17
|
+
dependencies: Array<DirectiveMeta | PipeMeta>;
|
|
25
18
|
/**
|
|
26
19
|
* Whether some module or component in this scope contains errors and is thus semantically
|
|
27
20
|
* unreliable.
|
|
@@ -52,17 +45,30 @@ export interface RemoteScope {
|
|
|
52
45
|
*/
|
|
53
46
|
pipes: Reference[];
|
|
54
47
|
}
|
|
48
|
+
export declare enum ComponentScopeKind {
|
|
49
|
+
NgModule = 0,
|
|
50
|
+
Standalone = 1
|
|
51
|
+
}
|
|
55
52
|
export interface LocalModuleScope extends ExportScope {
|
|
53
|
+
kind: ComponentScopeKind.NgModule;
|
|
56
54
|
ngModule: ClassDeclaration;
|
|
57
55
|
compilation: ScopeData;
|
|
58
56
|
reexports: Reexport[] | null;
|
|
59
57
|
schemas: SchemaMetadata[];
|
|
60
58
|
}
|
|
59
|
+
export interface StandaloneScope {
|
|
60
|
+
kind: ComponentScopeKind.Standalone;
|
|
61
|
+
dependencies: Array<DirectiveMeta | PipeMeta | NgModuleMeta>;
|
|
62
|
+
component: ClassDeclaration;
|
|
63
|
+
schemas: SchemaMetadata[];
|
|
64
|
+
isPoisoned: boolean;
|
|
65
|
+
}
|
|
66
|
+
export declare type ComponentScope = LocalModuleScope | StandaloneScope;
|
|
61
67
|
/**
|
|
62
68
|
* Read information about the compilation scope of components.
|
|
63
69
|
*/
|
|
64
70
|
export interface ComponentScopeReader {
|
|
65
|
-
getScopeForComponent(clazz: ClassDeclaration):
|
|
71
|
+
getScopeForComponent(clazz: ClassDeclaration): ComponentScope | null;
|
|
66
72
|
/**
|
|
67
73
|
* Get the `RemoteScope` required for this component, if any.
|
|
68
74
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
import { ClassDeclaration } from '../../reflection';
|
|
10
|
-
import {
|
|
10
|
+
import { ComponentScope, ComponentScopeReader, RemoteScope } from './api';
|
|
11
11
|
/**
|
|
12
12
|
* A `ComponentScopeReader` that reads from an ordered set of child readers until it obtains the
|
|
13
13
|
* requested scope.
|
|
@@ -18,6 +18,6 @@ import { ComponentScopeReader, LocalModuleScope, RemoteScope } from './api';
|
|
|
18
18
|
export declare class CompoundComponentScopeReader implements ComponentScopeReader {
|
|
19
19
|
private readers;
|
|
20
20
|
constructor(readers: ComponentScopeReader[]);
|
|
21
|
-
getScopeForComponent(clazz: ClassDeclaration):
|
|
21
|
+
getScopeForComponent(clazz: ClassDeclaration): ComponentScope | null;
|
|
22
22
|
getRemoteScope(clazz: ClassDeclaration): RemoteScope | null;
|
|
23
23
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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/scope/src/standalone" />
|
|
9
|
+
import { MetadataReader } from '../../metadata';
|
|
10
|
+
import { ClassDeclaration } from '../../reflection';
|
|
11
|
+
import { ComponentScopeReader, StandaloneScope } from './api';
|
|
12
|
+
import { DtsModuleScopeResolver } from './dependency';
|
|
13
|
+
import { LocalModuleScopeRegistry } from './local';
|
|
14
|
+
/**
|
|
15
|
+
* Computes scopes for standalone components based on their `imports`, expanding imported NgModule
|
|
16
|
+
* scopes where necessary.
|
|
17
|
+
*/
|
|
18
|
+
export declare class StandaloneComponentScopeReader implements ComponentScopeReader {
|
|
19
|
+
private metaReader;
|
|
20
|
+
private localModuleReader;
|
|
21
|
+
private dtsModuleReader;
|
|
22
|
+
private cache;
|
|
23
|
+
constructor(metaReader: MetadataReader, localModuleReader: LocalModuleScopeRegistry, dtsModuleReader: DtsModuleScopeResolver);
|
|
24
|
+
getScopeForComponent(clazz: ClassDeclaration): StandaloneScope | null;
|
|
25
|
+
getRemoteScope(): null;
|
|
26
|
+
}
|
|
@@ -12,3 +12,4 @@ import { ClassDeclaration } from '../../reflection';
|
|
|
12
12
|
import { ComponentScopeReader } from './api';
|
|
13
13
|
export declare function getDiagnosticNode(ref: Reference<ClassDeclaration>, rawExpr: ts.Expression | null): ts.Expression;
|
|
14
14
|
export declare function makeNotStandaloneDiagnostic(scopeReader: ComponentScopeReader, ref: Reference<ClassDeclaration>, rawExpr: ts.Expression | null, kind: 'component' | 'directive' | 'pipe'): ts.Diagnostic;
|
|
15
|
+
export declare function makeUnknownComponentImportDiagnostic(ref: Reference<ClassDeclaration>, rawExpr: ts.Expression): ts.DiagnosticWithLocation;
|
|
@@ -45,6 +45,13 @@ export declare function tsCreateVariable(id: ts.Identifier, initializer: ts.Expr
|
|
|
45
45
|
* Construct a `ts.CallExpression` that calls a method on a receiver.
|
|
46
46
|
*/
|
|
47
47
|
export declare function tsCallMethod(receiver: ts.Expression, methodName: string, args?: ts.Expression[]): ts.CallExpression;
|
|
48
|
+
/**
|
|
49
|
+
* Updates a `ts.TypeParameter` declaration.
|
|
50
|
+
*
|
|
51
|
+
* TODO(crisbeto): this is a backwards-compatibility layer for versions of TypeScript less than 4.7.
|
|
52
|
+
* We should remove it once we have dropped support for the older versions.
|
|
53
|
+
*/
|
|
54
|
+
export declare function tsUpdateTypeParameterDeclaration(node: ts.TypeParameterDeclaration, name: ts.Identifier, constraint: ts.TypeNode | undefined, defaultType: ts.TypeNode | undefined): ts.TypeParameterDeclaration;
|
|
48
55
|
export declare function checkIfClassIsExported(node: ClassDeclaration): boolean;
|
|
49
56
|
export declare function checkIfGenericTypesAreUnbound(node: ClassDeclaration<ts.ClassDeclaration>): boolean;
|
|
50
57
|
export declare function isAccessExpression(node: ts.Node): node is ts.ElementAccessExpression | ts.PropertyAccessExpression;
|