@angular/compiler-cli 14.0.0-next.7 → 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-AR265E4B.js → chunk-2IMT6JFI.js} +1 -1
- package/bundles/chunk-2IMT6JFI.js.map +6 -0
- package/bundles/{chunk-VGNMN2NK.js → chunk-53V6MPBS.js} +19 -8
- package/bundles/chunk-53V6MPBS.js.map +6 -0
- package/bundles/{chunk-OOJDZK5W.js → chunk-7XY4OMWJ.js} +110 -70
- package/bundles/chunk-7XY4OMWJ.js.map +6 -0
- package/bundles/{chunk-NM2N677S.js → chunk-BHGVN4MI.js} +70 -25
- package/bundles/chunk-BHGVN4MI.js.map +6 -0
- package/bundles/{chunk-26T3CJIJ.js → chunk-GJVJ6GH4.js} +1079 -815
- package/bundles/chunk-GJVJ6GH4.js.map +6 -0
- package/bundles/{chunk-WQ3TNYTD.js → chunk-GMSUYBZP.js} +8 -11
- package/bundles/{chunk-WQ3TNYTD.js.map → chunk-GMSUYBZP.js.map} +0 -0
- package/bundles/{chunk-5RC6M6GX.js → chunk-JDKMNZ6O.js} +6 -8
- package/bundles/chunk-JDKMNZ6O.js.map +6 -0
- package/bundles/{chunk-U5ES6WUL.js → chunk-KPGMJT2X.js} +3 -3
- package/bundles/chunk-KPGMJT2X.js.map +6 -0
- package/bundles/{chunk-646P2DOR.js → chunk-LX5Q27EF.js} +1 -1
- package/bundles/chunk-LX5Q27EF.js.map +6 -0
- package/bundles/{chunk-KMCI52ED.js → chunk-N6HUFHQ6.js} +967 -901
- package/bundles/chunk-N6HUFHQ6.js.map +6 -0
- package/bundles/{chunk-MXJN5K6C.js → chunk-OLGEBPBY.js} +3 -3
- package/bundles/chunk-OLGEBPBY.js.map +6 -0
- package/bundles/{chunk-QDWL7SZJ.js → chunk-R3C7RFJ4.js} +1 -1
- package/bundles/chunk-R3C7RFJ4.js.map +6 -0
- package/bundles/{chunk-GLCRIILX.js → chunk-R4NY3TJC.js} +1 -1
- package/bundles/chunk-R4NY3TJC.js.map +6 -0
- package/bundles/{chunk-FXU7FMZC.js → chunk-T7MYRXIE.js} +3 -3
- package/bundles/chunk-T7MYRXIE.js.map +6 -0
- package/bundles/{chunk-3MNDX4LL.js → chunk-W6KM7BUM.js} +3 -3
- package/bundles/chunk-W6KM7BUM.js.map +6 -0
- package/bundles/{chunk-K2Z44JHH.js → chunk-WGBFSDVQ.js} +3 -3
- package/bundles/chunk-WGBFSDVQ.js.map +6 -0
- package/bundles/index.js +11 -12
- package/bundles/index.js.map +1 -1
- package/bundles/linker/babel/index.js +6 -6
- package/bundles/linker/babel/index.js.map +1 -1
- package/bundles/linker/index.js +5 -5
- package/bundles/ngcc/index.js +12 -12
- package/bundles/ngcc/index.js.map +1 -1
- package/bundles/ngcc/main-ngcc.js +13 -13
- package/bundles/ngcc/main-ngcc.js.map +1 -1
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +11 -11
- package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js.map +1 -1
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +4 -4
- package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js.map +1 -1
- package/bundles/private/bazel.js +2 -2
- package/bundles/private/localize.js +4 -4
- package/bundles/private/migrations.js +6 -6
- package/bundles/private/tooling.js +3 -3
- package/bundles/src/bin/ng_xi18n.js +8 -8
- package/bundles/src/bin/ng_xi18n.js.map +1 -1
- package/bundles/src/bin/ngc.js +8 -8
- package/bundles/src/bin/ngc.js.map +1 -1
- package/bundles_metadata.json +1 -1
- package/linker/src/file_linker/emit_scopes/emit_scope.d.ts +7 -3
- package/linker/src/file_linker/emit_scopes/{iife_emit_scope.d.ts → local_emit_scope.d.ts} +7 -11
- package/linker/src/file_linker/partial_linkers/partial_class_metadata_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_component_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_directive_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_factory_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_injectable_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_injector_linker_1.d.ts +3 -3
- package/linker/src/file_linker/partial_linkers/partial_linker.d.ts +8 -1
- package/linker/src/file_linker/partial_linkers/partial_ng_module_linker_1.d.ts +4 -4
- package/linker/src/file_linker/partial_linkers/partial_pipe_linker_1.d.ts +3 -3
- 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 +10 -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/shims/api.d.ts +0 -1
- package/src/ngtsc/transform/src/compilation.d.ts +3 -1
- package/src/ngtsc/tsc_plugin.d.ts +1 -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/src/ngtsc/util/src/typescript.d.ts +0 -5
- package/bundles/chunk-26T3CJIJ.js.map +0 -6
- package/bundles/chunk-3MNDX4LL.js.map +0 -6
- package/bundles/chunk-5RC6M6GX.js.map +0 -6
- package/bundles/chunk-646P2DOR.js.map +0 -6
- package/bundles/chunk-AR265E4B.js.map +0 -6
- package/bundles/chunk-FXU7FMZC.js.map +0 -6
- package/bundles/chunk-GLCRIILX.js.map +0 -6
- package/bundles/chunk-K2Z44JHH.js.map +0 -6
- package/bundles/chunk-KMCI52ED.js.map +0 -6
- package/bundles/chunk-MXJN5K6C.js.map +0 -6
- package/bundles/chunk-NM2N677S.js.map +0 -6
- package/bundles/chunk-OOJDZK5W.js.map +0 -6
- package/bundles/chunk-QDWL7SZJ.js.map +0 -6
- package/bundles/chunk-U5ES6WUL.js.map +0 -6
- package/bundles/chunk-VGNMN2NK.js.map +0 -6
- package/src/ngtsc/annotations/component/src/scope.d.ts +0 -20
|
@@ -120,6 +120,16 @@ 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,
|
|
127
|
+
/**
|
|
128
|
+
* Indicates that an NgModule is declared with `id: module.id`. This is an anti-pattern that is
|
|
129
|
+
* disabled explicitly in the compiler, that was originally based on a misunderstanding of
|
|
130
|
+
* `NgModule.id`.
|
|
131
|
+
*/
|
|
132
|
+
WARN_NGMODULE_ID_UNNECESSARY = 6100,
|
|
123
133
|
/**
|
|
124
134
|
* Not actually raised by the compiler, but reserved for documentation of a View Engine error when
|
|
125
135
|
* a View Engine build depends on an Ivy-compiled NgModule.
|
|
@@ -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';
|
|
@@ -6,25 +6,15 @@
|
|
|
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/src/api" />
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { SchemaMetadata } from '@angular/compiler';
|
|
10
|
+
import { Reexport, Reference } from '../../imports';
|
|
11
|
+
import { DirectiveMeta, NgModuleMeta, PipeMeta } from '../../metadata';
|
|
11
12
|
import { ClassDeclaration } from '../../reflection';
|
|
12
13
|
/**
|
|
13
14
|
* Data for one of a given NgModule's scopes (either compilation scope or export scopes).
|
|
14
15
|
*/
|
|
15
16
|
export interface ScopeData {
|
|
16
|
-
|
|
17
|
-
* Directives in the exported scope of the module.
|
|
18
|
-
*/
|
|
19
|
-
directives: DirectiveMeta[];
|
|
20
|
-
/**
|
|
21
|
-
* Pipes in the exported scope of the module.
|
|
22
|
-
*/
|
|
23
|
-
pipes: PipeMeta[];
|
|
24
|
-
/**
|
|
25
|
-
* NgModules which contributed to the scope of the module.
|
|
26
|
-
*/
|
|
27
|
-
ngModules: ClassDeclaration[];
|
|
17
|
+
dependencies: Array<DirectiveMeta | PipeMeta>;
|
|
28
18
|
/**
|
|
29
19
|
* Whether some module or component in this scope contains errors and is thus semantically
|
|
30
20
|
* unreliable.
|
|
@@ -55,3 +45,35 @@ export interface RemoteScope {
|
|
|
55
45
|
*/
|
|
56
46
|
pipes: Reference[];
|
|
57
47
|
}
|
|
48
|
+
export declare enum ComponentScopeKind {
|
|
49
|
+
NgModule = 0,
|
|
50
|
+
Standalone = 1
|
|
51
|
+
}
|
|
52
|
+
export interface LocalModuleScope extends ExportScope {
|
|
53
|
+
kind: ComponentScopeKind.NgModule;
|
|
54
|
+
ngModule: ClassDeclaration;
|
|
55
|
+
compilation: ScopeData;
|
|
56
|
+
reexports: Reexport[] | null;
|
|
57
|
+
schemas: SchemaMetadata[];
|
|
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;
|
|
67
|
+
/**
|
|
68
|
+
* Read information about the compilation scope of components.
|
|
69
|
+
*/
|
|
70
|
+
export interface ComponentScopeReader {
|
|
71
|
+
getScopeForComponent(clazz: ClassDeclaration): ComponentScope | null;
|
|
72
|
+
/**
|
|
73
|
+
* Get the `RemoteScope` required for this component, if any.
|
|
74
|
+
*
|
|
75
|
+
* If the component requires remote scoping, then retrieve the directives/pipes registered for
|
|
76
|
+
* that component. If remote scoping is not required (the common case), returns `null`.
|
|
77
|
+
*/
|
|
78
|
+
getRemoteScope(clazz: ClassDeclaration): RemoteScope | null;
|
|
79
|
+
}
|
|
@@ -7,21 +7,7 @@
|
|
|
7
7
|
* found in the LICENSE file at https://angular.io/license
|
|
8
8
|
*/
|
|
9
9
|
import { ClassDeclaration } from '../../reflection';
|
|
10
|
-
import { RemoteScope } from './api';
|
|
11
|
-
import { LocalModuleScope } from './local';
|
|
12
|
-
/**
|
|
13
|
-
* Read information about the compilation scope of components.
|
|
14
|
-
*/
|
|
15
|
-
export interface ComponentScopeReader {
|
|
16
|
-
getScopeForComponent(clazz: ClassDeclaration): LocalModuleScope | null;
|
|
17
|
-
/**
|
|
18
|
-
* Get the `RemoteScope` required for this component, if any.
|
|
19
|
-
*
|
|
20
|
-
* If the component requires remote scoping, then retrieve the directives/pipes registered for
|
|
21
|
-
* that component. If remote scoping is not required (the common case), returns `null`.
|
|
22
|
-
*/
|
|
23
|
-
getRemoteScope(clazz: ClassDeclaration): RemoteScope | null;
|
|
24
|
-
}
|
|
10
|
+
import { ComponentScope, ComponentScopeReader, RemoteScope } from './api';
|
|
25
11
|
/**
|
|
26
12
|
* A `ComponentScopeReader` that reads from an ordered set of child readers until it obtains the
|
|
27
13
|
* requested scope.
|
|
@@ -32,6 +18,6 @@ export interface ComponentScopeReader {
|
|
|
32
18
|
export declare class CompoundComponentScopeReader implements ComponentScopeReader {
|
|
33
19
|
private readers;
|
|
34
20
|
constructor(readers: ComponentScopeReader[]);
|
|
35
|
-
getScopeForComponent(clazz: ClassDeclaration):
|
|
21
|
+
getScopeForComponent(clazz: ClassDeclaration): ComponentScope | null;
|
|
36
22
|
getRemoteScope(clazz: ClassDeclaration): RemoteScope | null;
|
|
37
23
|
}
|
|
@@ -6,25 +6,17 @@
|
|
|
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/src/local" />
|
|
9
|
-
import { SchemaMetadata } from '@angular/compiler';
|
|
10
9
|
import ts from 'typescript';
|
|
11
|
-
import { AliasingHost,
|
|
10
|
+
import { AliasingHost, Reference, ReferenceEmitter } from '../../imports';
|
|
12
11
|
import { DirectiveMeta, MetadataReader, MetadataRegistry, NgModuleMeta, PipeMeta } from '../../metadata';
|
|
13
12
|
import { ClassDeclaration } from '../../reflection';
|
|
14
|
-
import {
|
|
15
|
-
import { ComponentScopeReader } from './component_scope';
|
|
13
|
+
import { ComponentScopeReader, LocalModuleScope, RemoteScope } from './api';
|
|
16
14
|
import { DtsModuleScopeResolver } from './dependency';
|
|
17
15
|
export interface LocalNgModuleData {
|
|
18
16
|
declarations: Reference<ClassDeclaration>[];
|
|
19
17
|
imports: Reference<ClassDeclaration>[];
|
|
20
18
|
exports: Reference<ClassDeclaration>[];
|
|
21
19
|
}
|
|
22
|
-
export interface LocalModuleScope extends ExportScope {
|
|
23
|
-
ngModule: ClassDeclaration;
|
|
24
|
-
compilation: ScopeData;
|
|
25
|
-
reexports: Reexport[] | null;
|
|
26
|
-
schemas: SchemaMetadata[];
|
|
27
|
-
}
|
|
28
20
|
/**
|
|
29
21
|
* A registry which collects information about NgModules, Directives, Components, and Pipes which
|
|
30
22
|
* are local (declared in the ts.Program being compiled), and can produce `LocalModuleScope`s
|
|
@@ -46,6 +38,7 @@ export interface LocalModuleScope extends ExportScope {
|
|
|
46
38
|
*/
|
|
47
39
|
export declare class LocalModuleScopeRegistry implements MetadataRegistry, ComponentScopeReader {
|
|
48
40
|
private localReader;
|
|
41
|
+
private fullReader;
|
|
49
42
|
private dependencyScopeReader;
|
|
50
43
|
private refEmitter;
|
|
51
44
|
private aliasingHost;
|
|
@@ -91,7 +84,7 @@ export declare class LocalModuleScopeRegistry implements MetadataRegistry, Compo
|
|
|
91
84
|
* Tracks which NgModules have directives/pipes that are declared in more than one module.
|
|
92
85
|
*/
|
|
93
86
|
private modulesWithStructuralErrors;
|
|
94
|
-
constructor(localReader: MetadataReader, dependencyScopeReader: DtsModuleScopeResolver, refEmitter: ReferenceEmitter, aliasingHost: AliasingHost | null);
|
|
87
|
+
constructor(localReader: MetadataReader, fullReader: MetadataReader, dependencyScopeReader: DtsModuleScopeResolver, refEmitter: ReferenceEmitter, aliasingHost: AliasingHost | null);
|
|
95
88
|
/**
|
|
96
89
|
* Add an NgModule's data to the registry.
|
|
97
90
|
*/
|
|
@@ -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
|
+
}
|
|
@@ -11,7 +11,7 @@ import ts from 'typescript';
|
|
|
11
11
|
import { Reference } from '../../imports';
|
|
12
12
|
import { DirectiveMeta, MetadataReader } from '../../metadata';
|
|
13
13
|
import { ClassDeclaration } from '../../reflection';
|
|
14
|
-
import { ComponentScopeReader } from './
|
|
14
|
+
import { ComponentScopeReader } from './api';
|
|
15
15
|
/**
|
|
16
16
|
* The scope that is used for type-check code generation of a component template.
|
|
17
17
|
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
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/util" />
|
|
9
|
+
import ts from 'typescript';
|
|
10
|
+
import { Reference } from '../../imports';
|
|
11
|
+
import { ClassDeclaration } from '../../reflection';
|
|
12
|
+
import { ComponentScopeReader } from './api';
|
|
13
|
+
export declare function getDiagnosticNode(ref: Reference<ClassDeclaration>, rawExpr: ts.Expression | null): ts.Expression;
|
|
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;
|
package/src/ngtsc/shims/api.d.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
/// <amd-module name="@angular/compiler-cli/src/ngtsc/transform/src/compilation" />
|
|
9
9
|
import { ConstantPool } from '@angular/compiler';
|
|
10
10
|
import ts from 'typescript';
|
|
11
|
+
import { SourceFileTypeIdentifier } from '../../core/api';
|
|
11
12
|
import { IncrementalBuild } from '../../incremental/api';
|
|
12
13
|
import { SemanticDepGraphUpdater, SemanticSymbol } from '../../incremental/semantic_graph';
|
|
13
14
|
import { IndexingContext } from '../../indexer';
|
|
@@ -65,6 +66,7 @@ export declare class TraitCompiler implements ProgramTypeCheckAdapter {
|
|
|
65
66
|
private compilationMode;
|
|
66
67
|
private dtsTransforms;
|
|
67
68
|
private semanticDepGraphUpdater;
|
|
69
|
+
private sourceFileTypeIdentifier;
|
|
68
70
|
/**
|
|
69
71
|
* Maps class declarations to their `ClassRecord`, which tracks the Ivy traits being applied to
|
|
70
72
|
* those classes.
|
|
@@ -82,7 +84,7 @@ export declare class TraitCompiler implements ProgramTypeCheckAdapter {
|
|
|
82
84
|
protected filesWithoutTraits: Set<ts.SourceFile>;
|
|
83
85
|
private reexportMap;
|
|
84
86
|
private handlersByName;
|
|
85
|
-
constructor(handlers: DecoratorHandler<unknown, unknown, SemanticSymbol | null, unknown>[], reflector: ReflectionHost, perf: PerfRecorder, incrementalBuild: IncrementalBuild<ClassRecord, unknown>, compileNonExportedClasses: boolean, compilationMode: CompilationMode, dtsTransforms: DtsTransformRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null);
|
|
87
|
+
constructor(handlers: DecoratorHandler<unknown, unknown, SemanticSymbol | null, unknown>[], reflector: ReflectionHost, perf: PerfRecorder, incrementalBuild: IncrementalBuild<ClassRecord, unknown>, compileNonExportedClasses: boolean, compilationMode: CompilationMode, dtsTransforms: DtsTransformRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, sourceFileTypeIdentifier: SourceFileTypeIdentifier);
|
|
86
88
|
analyzeSync(sf: ts.SourceFile): void;
|
|
87
89
|
analyzeAsync(sf: ts.SourceFile): Promise<void> | undefined;
|
|
88
90
|
private analyze;
|
|
@@ -13,7 +13,7 @@ import { UnifiedModulesHost } from './core/api';
|
|
|
13
13
|
* A `ts.CompilerHost` which also returns a list of input files, out of which the `ts.Program`
|
|
14
14
|
* should be created.
|
|
15
15
|
*
|
|
16
|
-
* Currently mirrored from @bazel/
|
|
16
|
+
* Currently mirrored from @bazel/concatjs/internal/tsc_wrapped/plugin_api (with the naming of
|
|
17
17
|
* `fileNameToModuleName` corrected).
|
|
18
18
|
*/
|
|
19
19
|
interface PluginCompilerHost extends ts.CompilerHost, Partial<UnifiedModulesHost> {
|
|
@@ -13,7 +13,7 @@ import { ErrorCode } from '../../diagnostics';
|
|
|
13
13
|
import { FullTemplateMapping, NgTemplateDiagnostic, TypeCheckableDirectiveMeta } from './api';
|
|
14
14
|
import { GlobalCompletion } from './completion';
|
|
15
15
|
import { DirectiveInScope, PipeInScope } from './scope';
|
|
16
|
-
import { ElementSymbol,
|
|
16
|
+
import { ElementSymbol, Symbol, TcbLocation, TemplateSymbol } from './symbols';
|
|
17
17
|
/**
|
|
18
18
|
* Interface to the Angular Template Type Checker to extract diagnostics and intelligence from the
|
|
19
19
|
* compiler's understanding of component templates.
|
|
@@ -51,7 +51,7 @@ export interface TemplateTypeChecker {
|
|
|
51
51
|
* Given a `shim` and position within the file, returns information for mapping back to a template
|
|
52
52
|
* location.
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
getTemplateMappingAtTcbLocation(tcbLocation: TcbLocation): FullTemplateMapping | null;
|
|
55
55
|
/**
|
|
56
56
|
* Get all `ts.Diagnostic`s currently available that pertain to the given component.
|
|
57
57
|
*
|
|
@@ -98,16 +98,16 @@ export interface TemplateTypeChecker {
|
|
|
98
98
|
*/
|
|
99
99
|
getGlobalCompletions(context: TmplAstTemplate | null, component: ts.ClassDeclaration, node: AST | TmplAstNode): GlobalCompletion | null;
|
|
100
100
|
/**
|
|
101
|
-
* For the given expression node, retrieve a `
|
|
101
|
+
* For the given expression node, retrieve a `TcbLocation` that can be used to perform
|
|
102
102
|
* autocompletion at that point in the expression, if such a location exists.
|
|
103
103
|
*/
|
|
104
|
-
getExpressionCompletionLocation(expr: PropertyRead | SafePropertyRead, component: ts.ClassDeclaration):
|
|
104
|
+
getExpressionCompletionLocation(expr: PropertyRead | SafePropertyRead, component: ts.ClassDeclaration): TcbLocation | null;
|
|
105
105
|
/**
|
|
106
106
|
* For the given node represents a `LiteralPrimitive`(the `TextAttribute` represents a string
|
|
107
|
-
* literal), retrieve a `
|
|
107
|
+
* literal), retrieve a `TcbLocation` that can be used to perform autocompletion at that point in
|
|
108
108
|
* the node, if such a location exists.
|
|
109
109
|
*/
|
|
110
|
-
getLiteralCompletionLocation(strNode: LiteralPrimitive | TmplAstTextAttribute, component: ts.ClassDeclaration):
|
|
110
|
+
getLiteralCompletionLocation(strNode: LiteralPrimitive | TmplAstTextAttribute, component: ts.ClassDeclaration): TcbLocation | null;
|
|
111
111
|
/**
|
|
112
112
|
* Get basic metadata on the directives which are in scope for the given component.
|
|
113
113
|
*/
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
/// <amd-module name="@angular/compiler-cli/src/ngtsc/typecheck/api/completion" />
|
|
9
9
|
import { TmplAstReference, TmplAstVariable } from '@angular/compiler';
|
|
10
|
-
import {
|
|
10
|
+
import { TcbLocation } from './symbols';
|
|
11
11
|
/**
|
|
12
12
|
* An autocompletion source of any kind.
|
|
13
13
|
*/
|
|
@@ -51,7 +51,7 @@ export interface GlobalCompletion {
|
|
|
51
51
|
* A location within the type-checking shim where TypeScript's completion APIs can be used to
|
|
52
52
|
* access completions for the template's component context (component class members).
|
|
53
53
|
*/
|
|
54
|
-
componentContext:
|
|
54
|
+
componentContext: TcbLocation;
|
|
55
55
|
/**
|
|
56
56
|
* `Map` of local references and variables that are visible at the requested level of the
|
|
57
57
|
* template.
|
|
@@ -65,5 +65,5 @@ export interface GlobalCompletion {
|
|
|
65
65
|
* A location within the type-checking shim where TypeScript's completion APIs can be used to
|
|
66
66
|
* access completions for the AST node of the cursor position (primitive constants).
|
|
67
67
|
*/
|
|
68
|
-
nodeContext:
|
|
68
|
+
nodeContext: TcbLocation | null;
|
|
69
69
|
}
|