@angular/core 21.0.0-next.7 → 21.0.0-next.8
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/fesm2022/_attribute-chunk.mjs +1 -1
- package/fesm2022/_attribute-chunk.mjs.map +1 -1
- package/fesm2022/_debug_node-chunk.mjs +265 -155
- package/fesm2022/_debug_node-chunk.mjs.map +1 -1
- package/fesm2022/_effect-chunk.mjs +1 -1
- package/fesm2022/_effect-chunk.mjs.map +1 -1
- package/fesm2022/_not_found-chunk.mjs +1 -1
- package/fesm2022/_not_found-chunk.mjs.map +1 -1
- package/fesm2022/_resource-chunk.mjs +1 -1
- package/fesm2022/_resource-chunk.mjs.map +1 -1
- package/fesm2022/_root_effect_scheduler-chunk.mjs +7 -2
- package/fesm2022/_root_effect_scheduler-chunk.mjs.map +1 -1
- package/fesm2022/_signal-chunk.mjs +1 -1
- package/fesm2022/_signal-chunk.mjs.map +1 -1
- package/fesm2022/_weak_ref-chunk.mjs +1 -1
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -1
- package/fesm2022/core.mjs +8 -12
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives-di.mjs +1 -1
- package/fesm2022/primitives-di.mjs.map +1 -1
- package/fesm2022/primitives-event-dispatch.mjs +1 -1
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives-signals.mjs +1 -1
- package/fesm2022/primitives-signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +2 -2
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +5 -5
- package/schematics/bundles/application-config-core.cjs +5 -5
- package/schematics/bundles/{apply_import_manager-D_4NSuRa.cjs → apply_import_manager-CBLmogDD.cjs} +3 -3
- package/schematics/bundles/bootstrap-options-migration.cjs +5 -5
- package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
- package/schematics/bundles/{compiler_host-C1KRWoxv.cjs → compiler_host-T6xncpiw.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +4 -4
- package/schematics/bundles/imports-DwPXlGFl.cjs +1 -1
- package/schematics/bundles/{index-BFENxhdR.cjs → index-BnmACOsq.cjs} +237 -98
- package/schematics/bundles/{index-DYqR8Lpq.cjs → index-DWSaRJdz.cjs} +4 -4
- package/schematics/bundles/inject-migration.cjs +3 -3
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-CemH7A8e.cjs → migrate_ts_type_references-Cu-FR4L5.cjs} +47 -5
- package/schematics/bundles/{ng_component_template-AYs8YXuT.cjs → ng_component_template-BkWiUuGG.cjs} +2 -2
- package/schematics/bundles/ng_decorators-BI0uV7KI.cjs +1 -1
- package/schematics/bundles/ngclass-to-class-migration.cjs +7 -7
- package/schematics/bundles/ngstyle-to-style-migration.cjs +7 -7
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/{parse_html-6-AB4O-A.cjs → parse_html-C97tKKp3.cjs} +2 -2
- package/schematics/bundles/{project_paths-EiOrjlNS.cjs → project_paths-C6g3lqjX.cjs} +3 -3
- package/schematics/bundles/{project_tsconfig_paths-BbVhi4fG.cjs → project_tsconfig_paths-CdhVNYMk.cjs} +326 -46
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +3 -3
- package/schematics/bundles/router-current-navigation.cjs +4 -4
- package/schematics/bundles/router-last-successful-navigation.cjs +4 -4
- package/schematics/bundles/router-testing-module-migration.cjs +513 -0
- package/schematics/bundles/self-closing-tags-migration.cjs +6 -6
- package/schematics/bundles/signal-input-migration.cjs +7 -7
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +4 -4
- package/schematics/bundles/symbol-BObKoqes.cjs +1 -1
- package/schematics/collection.json +5 -0
- package/schematics/migrations/router-testing-module-migration/schema.json +14 -0
- package/types/_api-chunk.d.ts +1 -1
- package/types/_chrome_dev_tools_performance-chunk.d.ts +3 -1
- package/types/_discovery-chunk.d.ts +51 -9
- package/types/_effect-chunk.d.ts +1 -1
- package/types/_event_dispatcher-chunk.d.ts +1 -1
- package/types/_formatter-chunk.d.ts +1 -1
- package/types/_weak_ref-chunk.d.ts +1 -1
- package/types/core.d.ts +21 -15
- package/types/primitives-di.d.ts +1 -1
- package/types/primitives-event-dispatch.d.ts +1 -1
- package/types/primitives-signals.d.ts +1 -1
- package/types/rxjs-interop.d.ts +1 -1
- package/types/testing.d.ts +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.8
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
9
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CdhVNYMk.cjs');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
var p = require('path');
|
|
12
12
|
require('os');
|
|
@@ -888,7 +888,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
888
888
|
function compileDeclareClassMetadata(metadata) {
|
|
889
889
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
890
890
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
891
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
891
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.8'));
|
|
892
892
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
893
893
|
definitionMap.set('type', metadata.type);
|
|
894
894
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -906,7 +906,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
906
906
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? project_tsconfig_paths.literal(null));
|
|
907
907
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? project_tsconfig_paths.literal(null));
|
|
908
908
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
909
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
909
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.8'));
|
|
910
910
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
911
911
|
definitionMap.set('type', metadata.type);
|
|
912
912
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -1001,7 +1001,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
1001
1001
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1002
1002
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
1003
1003
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(minVersion));
|
|
1004
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1004
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.8'));
|
|
1005
1005
|
// e.g. `type: MyDirective`
|
|
1006
1006
|
definitionMap.set('type', meta.type.value);
|
|
1007
1007
|
if (meta.isStandalone !== undefined) {
|
|
@@ -1414,7 +1414,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
1414
1414
|
function compileDeclareFactoryFunction(meta) {
|
|
1415
1415
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1416
1416
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
1417
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1417
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.8'));
|
|
1418
1418
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1419
1419
|
definitionMap.set('type', meta.type.value);
|
|
1420
1420
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -1449,7 +1449,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
1449
1449
|
function createInjectableDefinitionMap(meta) {
|
|
1450
1450
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1451
1451
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
1452
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1452
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.8'));
|
|
1453
1453
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1454
1454
|
definitionMap.set('type', meta.type.value);
|
|
1455
1455
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -1500,7 +1500,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
1500
1500
|
function createInjectorDefinitionMap(meta) {
|
|
1501
1501
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1502
1502
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
1503
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1503
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.8'));
|
|
1504
1504
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1505
1505
|
definitionMap.set('type', meta.type.value);
|
|
1506
1506
|
definitionMap.set('providers', meta.providers);
|
|
@@ -1533,7 +1533,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
1533
1533
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
1534
1534
|
}
|
|
1535
1535
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
1536
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1536
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.8'));
|
|
1537
1537
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1538
1538
|
definitionMap.set('type', meta.type.value);
|
|
1539
1539
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -1584,7 +1584,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
1584
1584
|
function createPipeDefinitionMap(meta) {
|
|
1585
1585
|
const definitionMap = new project_tsconfig_paths.DefinitionMap();
|
|
1586
1586
|
definitionMap.set('minVersion', project_tsconfig_paths.literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
1587
|
-
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.
|
|
1587
|
+
definitionMap.set('version', project_tsconfig_paths.literal('21.0.0-next.8'));
|
|
1588
1588
|
definitionMap.set('ngImport', project_tsconfig_paths.importExpr(project_tsconfig_paths.Identifiers.core));
|
|
1589
1589
|
// e.g. `type: MyPipe`
|
|
1590
1590
|
definitionMap.set('type', meta.type.value);
|
|
@@ -5617,7 +5617,7 @@ class InjectableClassRegistry {
|
|
|
5617
5617
|
* If no such metadata is present, this function returns `null`. Otherwise, the call is returned
|
|
5618
5618
|
* as a `Statement` for inclusion along with the class.
|
|
5619
5619
|
*/
|
|
5620
|
-
function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompiler, angularDecoratorTransform = (dec) => dec) {
|
|
5620
|
+
function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompiler, angularDecoratorTransform = (dec) => dec, undecoratedMetadataExtractor = () => null) {
|
|
5621
5621
|
if (!reflection.isClass(clazz)) {
|
|
5622
5622
|
return null;
|
|
5623
5623
|
}
|
|
@@ -5651,21 +5651,47 @@ function extractClassMetadata(clazz, reflection, isCore, annotateForClosureCompi
|
|
|
5651
5651
|
// Do the same for property decorators.
|
|
5652
5652
|
let metaPropDecorators = null;
|
|
5653
5653
|
const classMembers = reflection.getMembersOfClass(clazz).filter((member) => !member.isStatic &&
|
|
5654
|
-
member.decorators !== null &&
|
|
5655
|
-
member.decorators.length > 0 &&
|
|
5656
5654
|
// Private fields are not supported in the metadata emit
|
|
5657
5655
|
member.accessLevel !== project_tsconfig_paths.ClassMemberAccessLevel.EcmaScriptPrivate);
|
|
5658
|
-
const
|
|
5659
|
-
|
|
5656
|
+
const decoratedMembers = [];
|
|
5657
|
+
const seenMemberNames = new Set();
|
|
5658
|
+
let duplicateDecoratedMembers = null;
|
|
5659
|
+
for (const member of classMembers) {
|
|
5660
|
+
const shouldQuoteName = member.nameNode !== null && ts.isStringLiteralLike(member.nameNode);
|
|
5661
|
+
if (member.decorators !== null && member.decorators.length > 0) {
|
|
5662
|
+
decoratedMembers.push({
|
|
5663
|
+
key: member.name,
|
|
5664
|
+
quoted: shouldQuoteName,
|
|
5665
|
+
value: decoratedClassMemberToMetadata(member.decorators, isCore),
|
|
5666
|
+
});
|
|
5667
|
+
if (seenMemberNames.has(member.name)) {
|
|
5668
|
+
duplicateDecoratedMembers ??= [];
|
|
5669
|
+
duplicateDecoratedMembers.push(member);
|
|
5670
|
+
}
|
|
5671
|
+
else {
|
|
5672
|
+
seenMemberNames.add(member.name);
|
|
5673
|
+
}
|
|
5674
|
+
}
|
|
5675
|
+
else {
|
|
5676
|
+
const undecoratedMetadata = undecoratedMetadataExtractor(member);
|
|
5677
|
+
if (undecoratedMetadata !== null) {
|
|
5678
|
+
decoratedMembers.push({
|
|
5679
|
+
key: member.name,
|
|
5680
|
+
quoted: shouldQuoteName,
|
|
5681
|
+
value: undecoratedMetadata,
|
|
5682
|
+
});
|
|
5683
|
+
}
|
|
5684
|
+
}
|
|
5685
|
+
}
|
|
5686
|
+
if (duplicateDecoratedMembers !== null) {
|
|
5660
5687
|
// This should theoretically never happen, because the only way to have duplicate instance
|
|
5661
5688
|
// member names is getter/setter pairs and decorators cannot appear in both a getter and the
|
|
5662
5689
|
// corresponding setter.
|
|
5663
5690
|
throw new project_tsconfig_paths.FatalDiagnosticError(project_tsconfig_paths.ErrorCode.DUPLICATE_DECORATED_PROPERTIES, duplicateDecoratedMembers[0].nameNode ?? clazz, `Duplicate decorated properties found on class '${clazz.name.text}': ` +
|
|
5664
5691
|
duplicateDecoratedMembers.map((member) => member.name).join(', '));
|
|
5665
5692
|
}
|
|
5666
|
-
const decoratedMembers = classMembers.map((member) => classMemberToMetadata(member.nameNode ?? member.name, member.decorators, isCore));
|
|
5667
5693
|
if (decoratedMembers.length > 0) {
|
|
5668
|
-
metaPropDecorators =
|
|
5694
|
+
metaPropDecorators = project_tsconfig_paths.literalMap(decoratedMembers);
|
|
5669
5695
|
}
|
|
5670
5696
|
return {
|
|
5671
5697
|
type: new project_tsconfig_paths.WrappedNodeExpr(id),
|
|
@@ -5699,12 +5725,11 @@ function ctorParameterToMetadata(param, isCore) {
|
|
|
5699
5725
|
/**
|
|
5700
5726
|
* Convert a reflected class member to metadata.
|
|
5701
5727
|
*/
|
|
5702
|
-
function
|
|
5728
|
+
function decoratedClassMemberToMetadata(decorators, isCore) {
|
|
5703
5729
|
const ngDecorators = decorators
|
|
5704
5730
|
.filter((dec) => isAngularDecorator$1(dec, isCore))
|
|
5705
|
-
.map((decorator) => decoratorToMetadata(decorator));
|
|
5706
|
-
|
|
5707
|
-
return ts.factory.createPropertyAssignment(name, decoratorMeta);
|
|
5731
|
+
.map((decorator) => new project_tsconfig_paths.WrappedNodeExpr(decoratorToMetadata(decorator)));
|
|
5732
|
+
return new project_tsconfig_paths.LiteralArrayExpr(ngDecorators);
|
|
5708
5733
|
}
|
|
5709
5734
|
/**
|
|
5710
5735
|
* Convert a reflected decorator to metadata.
|
|
@@ -7879,9 +7904,11 @@ class DirectiveDecoratorHandler {
|
|
|
7879
7904
|
this.usePoisonedData = usePoisonedData;
|
|
7880
7905
|
this.typeCheckHostBindings = typeCheckHostBindings;
|
|
7881
7906
|
this.emitDeclarationOnly = emitDeclarationOnly;
|
|
7907
|
+
this.undecoratedMetadataExtractor = project_tsconfig_paths.getDirectiveUndecoratedMetadataExtractor(reflector, importTracker);
|
|
7882
7908
|
}
|
|
7883
7909
|
precedence = project_tsconfig_paths.HandlerPrecedence.PRIMARY;
|
|
7884
7910
|
name = 'DirectiveDecoratorHandler';
|
|
7911
|
+
undecoratedMetadataExtractor;
|
|
7885
7912
|
detect(node, decorators) {
|
|
7886
7913
|
// If a class is undecorated but uses Angular features, we detect it as an
|
|
7887
7914
|
// abstract directive. This is an unsupported pattern as of v10, but we want
|
|
@@ -7934,7 +7961,7 @@ class DirectiveDecoratorHandler {
|
|
|
7934
7961
|
hostDirectives: directiveResult.hostDirectives,
|
|
7935
7962
|
rawHostDirectives: directiveResult.rawHostDirectives,
|
|
7936
7963
|
classMetadata: this.includeClassMetadata
|
|
7937
|
-
? extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler)
|
|
7964
|
+
? extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, undefined, this.undecoratedMetadataExtractor)
|
|
7938
7965
|
: null,
|
|
7939
7966
|
baseClass: project_tsconfig_paths.readBaseClass(node, this.reflector, this.evaluator),
|
|
7940
7967
|
typeCheckMeta: project_tsconfig_paths.extractDirectiveTypeCheckMeta(node, directiveResult.inputs, this.reflector),
|
|
@@ -10265,6 +10292,7 @@ class ComponentDecoratorHandler {
|
|
|
10265
10292
|
enableSelectorless: this.enableSelectorless,
|
|
10266
10293
|
preserveSignificantWhitespace: this.i18nPreserveSignificantWhitespace,
|
|
10267
10294
|
};
|
|
10295
|
+
this.undecoratedMetadataExtractor = project_tsconfig_paths.getDirectiveUndecoratedMetadataExtractor(reflector, importTracker);
|
|
10268
10296
|
// Dependencies can't be deferred during HMR, because the HMR update module can't have
|
|
10269
10297
|
// dynamic imports and its dependencies need to be passed in directly. If dependencies
|
|
10270
10298
|
// are deferred, their imports will be deleted so we may lose the reference to them.
|
|
@@ -10272,6 +10300,7 @@ class ComponentDecoratorHandler {
|
|
|
10272
10300
|
}
|
|
10273
10301
|
literalCache = new Map();
|
|
10274
10302
|
elementSchemaRegistry = new project_tsconfig_paths.DomElementSchemaRegistry();
|
|
10303
|
+
undecoratedMetadataExtractor;
|
|
10275
10304
|
/**
|
|
10276
10305
|
* During the asynchronous preanalyze phase, it's necessary to parse the template to extract
|
|
10277
10306
|
* any potential <link> tags which might need to be loaded. This cache ensures that work is not
|
|
@@ -10731,7 +10760,7 @@ class ComponentDecoratorHandler {
|
|
|
10731
10760
|
},
|
|
10732
10761
|
typeCheckMeta: project_tsconfig_paths.extractDirectiveTypeCheckMeta(node, inputs, this.reflector),
|
|
10733
10762
|
classMetadata: this.includeClassMetadata
|
|
10734
|
-
? extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorResources(dec, component, styles, template))
|
|
10763
|
+
? extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler, (dec) => transformDecoratorResources(dec, component, styles, template), this.undecoratedMetadataExtractor)
|
|
10735
10764
|
: null,
|
|
10736
10765
|
classDebugInfo: extractClassDebugInfo(node, this.reflector, this.compilerHost, this.rootDirs,
|
|
10737
10766
|
/* forbidOrphanRenderering */ this.forbidOrphanRendering),
|
|
@@ -12321,7 +12350,7 @@ class PipeDecoratorHandler {
|
|
|
12321
12350
|
* @description
|
|
12322
12351
|
* Entry point for all public APIs of the compiler-cli package.
|
|
12323
12352
|
*/
|
|
12324
|
-
new project_tsconfig_paths.Version('21.0.0-next.
|
|
12353
|
+
new project_tsconfig_paths.Version('21.0.0-next.8');
|
|
12325
12354
|
|
|
12326
12355
|
/**
|
|
12327
12356
|
* Whether a given decorator should be treated as an Angular decorator.
|
|
@@ -16358,16 +16387,6 @@ function isSignalSymbol(symbol) {
|
|
|
16358
16387
|
* This abstract class provides a base implementation for the run method.
|
|
16359
16388
|
*/
|
|
16360
16389
|
class TemplateCheckWithVisitor {
|
|
16361
|
-
/**
|
|
16362
|
-
* When extended diagnostics were first introduced, the visitor wasn't implemented correctly
|
|
16363
|
-
* which meant that it wasn't visiting the `templateAttrs` of structural directives (e.g.
|
|
16364
|
-
* the expression of `*ngIf`). Fixing the issue causes a lot of internal breakages and will likely
|
|
16365
|
-
* need to be done in a major version to avoid external breakages. This flag is used to opt out
|
|
16366
|
-
* pre-existing diagnostics from the correct behavior until the breakages have been fixed while
|
|
16367
|
-
* ensuring that newly-written diagnostics are correct from the beginning.
|
|
16368
|
-
* TODO(crisbeto): remove this flag and fix the internal brekages.
|
|
16369
|
-
*/
|
|
16370
|
-
canVisitStructuralAttributes = true;
|
|
16371
16390
|
/**
|
|
16372
16391
|
* Base implementation for run function, visits all nodes in template and calls
|
|
16373
16392
|
* `visitNode()` for each one.
|
|
@@ -16406,11 +16425,8 @@ class TemplateVisitor extends project_tsconfig_paths.CombinedRecursiveAstVisitor
|
|
|
16406
16425
|
this.visitAllTemplateNodes(template.outputs);
|
|
16407
16426
|
}
|
|
16408
16427
|
this.visitAllTemplateNodes(template.directives);
|
|
16409
|
-
//
|
|
16410
|
-
|
|
16411
|
-
// `templateAttrs` aren't transferred over to the inner element so we always have to visit them.
|
|
16412
|
-
this.visitAllTemplateNodes(template.templateAttrs);
|
|
16413
|
-
}
|
|
16428
|
+
// `templateAttrs` aren't transferred over to the inner element so we always have to visit them.
|
|
16429
|
+
this.visitAllTemplateNodes(template.templateAttrs);
|
|
16414
16430
|
this.visitAllTemplateNodes(template.variables);
|
|
16415
16431
|
this.visitAllTemplateNodes(template.references);
|
|
16416
16432
|
this.visitAllTemplateNodes(template.children);
|
|
@@ -16442,32 +16458,23 @@ class InterpolatedSignalCheck extends TemplateCheckWithVisitor {
|
|
|
16442
16458
|
.filter((item) => item instanceof project_tsconfig_paths.PropertyRead)
|
|
16443
16459
|
.flatMap((item) => buildDiagnosticForSignal(ctx, item, component));
|
|
16444
16460
|
}
|
|
16445
|
-
// bound
|
|
16446
|
-
else if (node instanceof project_tsconfig_paths.
|
|
16447
|
-
const
|
|
16448
|
-
|
|
16449
|
-
|
|
16450
|
-
|
|
16451
|
-
|
|
16452
|
-
|
|
16453
|
-
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16459
|
-
|
|
16460
|
-
|
|
16461
|
-
|
|
16462
|
-
// or an attribute binding like `[attr.role]="mySignal"`
|
|
16463
|
-
node.type === project_tsconfig_paths.BindingType.Attribute ||
|
|
16464
|
-
// or an animation binding like `[animate.enter]="mySignal"`
|
|
16465
|
-
node.type === project_tsconfig_paths.BindingType.Animation ||
|
|
16466
|
-
// or an animation binding like `[@myAnimation]="mySignal"`
|
|
16467
|
-
node.type === project_tsconfig_paths.BindingType.LegacyAnimation) &&
|
|
16468
|
-
nodeAst) {
|
|
16469
|
-
return buildDiagnosticForSignal(ctx, nodeAst, component);
|
|
16470
|
-
}
|
|
16461
|
+
// check bound inputs like `[prop]="mySignal"` on an element or inline template
|
|
16462
|
+
else if (node instanceof project_tsconfig_paths.Element$1 && node.inputs.length > 0) {
|
|
16463
|
+
const directivesOfElement = ctx.templateTypeChecker.getDirectivesOfNode(component, node);
|
|
16464
|
+
return node.inputs.flatMap((input) => checkBoundAttribute(ctx, component, directivesOfElement, input));
|
|
16465
|
+
}
|
|
16466
|
+
else if (node instanceof project_tsconfig_paths.Template && node.tagName === 'ng-template') {
|
|
16467
|
+
const directivesOfElement = ctx.templateTypeChecker.getDirectivesOfNode(component, node);
|
|
16468
|
+
const inputDiagnostics = node.inputs.flatMap((input) => {
|
|
16469
|
+
return checkBoundAttribute(ctx, component, directivesOfElement, input);
|
|
16470
|
+
});
|
|
16471
|
+
const templateAttrDiagnostics = node.templateAttrs.flatMap((attr) => {
|
|
16472
|
+
if (!(attr instanceof project_tsconfig_paths.BoundAttribute)) {
|
|
16473
|
+
return [];
|
|
16474
|
+
}
|
|
16475
|
+
return checkBoundAttribute(ctx, component, directivesOfElement, attr);
|
|
16476
|
+
});
|
|
16477
|
+
return inputDiagnostics.concat(templateAttrDiagnostics);
|
|
16471
16478
|
}
|
|
16472
16479
|
// if blocks like `@if(mySignal) { ... }`
|
|
16473
16480
|
else if (node instanceof project_tsconfig_paths.IfBlock) {
|
|
@@ -16493,6 +16500,32 @@ class InterpolatedSignalCheck extends TemplateCheckWithVisitor {
|
|
|
16493
16500
|
return [];
|
|
16494
16501
|
}
|
|
16495
16502
|
}
|
|
16503
|
+
function checkBoundAttribute(ctx, component, directivesOfElement, node) {
|
|
16504
|
+
// we skip the check if the node is an input binding
|
|
16505
|
+
if (directivesOfElement !== null &&
|
|
16506
|
+
directivesOfElement.some((dir) => dir.inputs.getByBindingPropertyName(node.name) !== null)) {
|
|
16507
|
+
return [];
|
|
16508
|
+
}
|
|
16509
|
+
// otherwise, we check if the node is
|
|
16510
|
+
const nodeAst = isPropertyReadNodeAst(node);
|
|
16511
|
+
if (
|
|
16512
|
+
// a bound property like `[prop]="mySignal"`
|
|
16513
|
+
(node.type === project_tsconfig_paths.BindingType.Property ||
|
|
16514
|
+
// or a class binding like `[class.myClass]="mySignal"`
|
|
16515
|
+
node.type === project_tsconfig_paths.BindingType.Class ||
|
|
16516
|
+
// or a style binding like `[style.width]="mySignal"`
|
|
16517
|
+
node.type === project_tsconfig_paths.BindingType.Style ||
|
|
16518
|
+
// or an attribute binding like `[attr.role]="mySignal"`
|
|
16519
|
+
node.type === project_tsconfig_paths.BindingType.Attribute ||
|
|
16520
|
+
// or an animation binding like `[animate.enter]="mySignal"`
|
|
16521
|
+
node.type === project_tsconfig_paths.BindingType.Animation ||
|
|
16522
|
+
// or an animation binding like `[@myAnimation]="mySignal"`
|
|
16523
|
+
node.type === project_tsconfig_paths.BindingType.LegacyAnimation) &&
|
|
16524
|
+
nodeAst) {
|
|
16525
|
+
return buildDiagnosticForSignal(ctx, nodeAst, component);
|
|
16526
|
+
}
|
|
16527
|
+
return [];
|
|
16528
|
+
}
|
|
16496
16529
|
function isPropertyReadNodeAst(node) {
|
|
16497
16530
|
if (node.value instanceof project_tsconfig_paths.ASTWithSource === false) {
|
|
16498
16531
|
return undefined;
|
|
@@ -16525,9 +16558,11 @@ function buildDiagnosticForSignal(ctx, node, component) {
|
|
|
16525
16558
|
// error.
|
|
16526
16559
|
// We also check for `{{ mySignal.set }}` or `{{ mySignal.update }}` or
|
|
16527
16560
|
// `{{ mySignal.asReadonly }}` as these are the names of instance properties of Signal
|
|
16561
|
+
if (!isFunctionInstanceProperty(node.name) && !isSignalInstanceProperty(node.name)) {
|
|
16562
|
+
return [];
|
|
16563
|
+
}
|
|
16528
16564
|
const symbolOfReceiver = ctx.templateTypeChecker.getSymbolOfNode(node.receiver, component);
|
|
16529
|
-
if (
|
|
16530
|
-
symbolOfReceiver !== null &&
|
|
16565
|
+
if (symbolOfReceiver !== null &&
|
|
16531
16566
|
symbolOfReceiver.kind === project_tsconfig_paths.SymbolKind.Expression &&
|
|
16532
16567
|
isSignalReference(symbolOfReceiver)) {
|
|
16533
16568
|
const templateMapping = ctx.templateTypeChecker.getSourceMappingAtTcbLocation(symbolOfReceiver.tcbLocation);
|
|
@@ -16537,7 +16572,7 @@ function buildDiagnosticForSignal(ctx, node, component) {
|
|
|
16537
16572
|
}
|
|
16538
16573
|
return [];
|
|
16539
16574
|
}
|
|
16540
|
-
const factory$
|
|
16575
|
+
const factory$f = {
|
|
16541
16576
|
code: project_tsconfig_paths.ErrorCode.INTERPOLATED_SIGNAL_NOT_INVOKED,
|
|
16542
16577
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.INTERPOLATED_SIGNAL_NOT_INVOKED,
|
|
16543
16578
|
create: () => new InterpolatedSignalCheck(),
|
|
@@ -16563,7 +16598,7 @@ class InvalidBananaInBoxCheck extends TemplateCheckWithVisitor {
|
|
|
16563
16598
|
return [diagnostic];
|
|
16564
16599
|
}
|
|
16565
16600
|
}
|
|
16566
|
-
const factory$
|
|
16601
|
+
const factory$e = {
|
|
16567
16602
|
code: project_tsconfig_paths.ErrorCode.INVALID_BANANA_IN_BOX,
|
|
16568
16603
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.INVALID_BANANA_IN_BOX,
|
|
16569
16604
|
create: () => new InvalidBananaInBoxCheck(),
|
|
@@ -16624,7 +16659,7 @@ class MissingControlFlowDirectiveCheck extends TemplateCheckWithVisitor {
|
|
|
16624
16659
|
return [diagnostic];
|
|
16625
16660
|
}
|
|
16626
16661
|
}
|
|
16627
|
-
const factory$
|
|
16662
|
+
const factory$d = {
|
|
16628
16663
|
code: project_tsconfig_paths.ErrorCode.MISSING_CONTROL_FLOW_DIRECTIVE,
|
|
16629
16664
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.MISSING_CONTROL_FLOW_DIRECTIVE,
|
|
16630
16665
|
create: (options) => {
|
|
@@ -16657,7 +16692,7 @@ class MissingNgForOfLetCheck extends TemplateCheckWithVisitor {
|
|
|
16657
16692
|
return [diagnostic];
|
|
16658
16693
|
}
|
|
16659
16694
|
}
|
|
16660
|
-
const factory$
|
|
16695
|
+
const factory$c = {
|
|
16661
16696
|
code: project_tsconfig_paths.ErrorCode.MISSING_NGFOROF_LET,
|
|
16662
16697
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.MISSING_NGFOROF_LET,
|
|
16663
16698
|
create: () => new MissingNgForOfLetCheck(),
|
|
@@ -16712,7 +16747,7 @@ class MissingStructuralDirectiveCheck extends TemplateCheckWithVisitor {
|
|
|
16712
16747
|
return [ctx.makeTemplateDiagnostic(sourceSpan, errorMessage)];
|
|
16713
16748
|
}
|
|
16714
16749
|
}
|
|
16715
|
-
const factory$
|
|
16750
|
+
const factory$b = {
|
|
16716
16751
|
code: project_tsconfig_paths.ErrorCode.MISSING_STRUCTURAL_DIRECTIVE,
|
|
16717
16752
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.MISSING_STRUCTURAL_DIRECTIVE,
|
|
16718
16753
|
create: () => new MissingStructuralDirectiveCheck(),
|
|
@@ -16725,7 +16760,6 @@ const factory$a = {
|
|
|
16725
16760
|
* otherwise it would produce inaccurate results.
|
|
16726
16761
|
*/
|
|
16727
16762
|
class NullishCoalescingNotNullableCheck extends TemplateCheckWithVisitor {
|
|
16728
|
-
canVisitStructuralAttributes = false;
|
|
16729
16763
|
code = project_tsconfig_paths.ErrorCode.NULLISH_COALESCING_NOT_NULLABLE;
|
|
16730
16764
|
visitNode(ctx, component, node) {
|
|
16731
16765
|
if (!(node instanceof project_tsconfig_paths.Binary) || node.operation !== '??')
|
|
@@ -16757,7 +16791,7 @@ class NullishCoalescingNotNullableCheck extends TemplateCheckWithVisitor {
|
|
|
16757
16791
|
return [diagnostic];
|
|
16758
16792
|
}
|
|
16759
16793
|
}
|
|
16760
|
-
const factory$
|
|
16794
|
+
const factory$a = {
|
|
16761
16795
|
code: project_tsconfig_paths.ErrorCode.NULLISH_COALESCING_NOT_NULLABLE,
|
|
16762
16796
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.NULLISH_COALESCING_NOT_NULLABLE,
|
|
16763
16797
|
create: (options) => {
|
|
@@ -16778,7 +16812,6 @@ const factory$9 = {
|
|
|
16778
16812
|
*/
|
|
16779
16813
|
class OptionalChainNotNullableCheck extends TemplateCheckWithVisitor {
|
|
16780
16814
|
noUncheckedIndexedAccess;
|
|
16781
|
-
canVisitStructuralAttributes = false;
|
|
16782
16815
|
code = project_tsconfig_paths.ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE;
|
|
16783
16816
|
constructor(noUncheckedIndexedAccess) {
|
|
16784
16817
|
super();
|
|
@@ -16825,7 +16858,7 @@ class OptionalChainNotNullableCheck extends TemplateCheckWithVisitor {
|
|
|
16825
16858
|
return [diagnostic];
|
|
16826
16859
|
}
|
|
16827
16860
|
}
|
|
16828
|
-
const factory$
|
|
16861
|
+
const factory$9 = {
|
|
16829
16862
|
code: project_tsconfig_paths.ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE,
|
|
16830
16863
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.OPTIONAL_CHAIN_NOT_NULLABLE,
|
|
16831
16864
|
create: (options) => {
|
|
@@ -16866,7 +16899,7 @@ class NgSkipHydrationSpec extends TemplateCheckWithVisitor {
|
|
|
16866
16899
|
return [];
|
|
16867
16900
|
}
|
|
16868
16901
|
}
|
|
16869
|
-
const factory$
|
|
16902
|
+
const factory$8 = {
|
|
16870
16903
|
code: project_tsconfig_paths.ErrorCode.SKIP_HYDRATION_NOT_STATIC,
|
|
16871
16904
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.SKIP_HYDRATION_NOT_STATIC,
|
|
16872
16905
|
create: () => new NgSkipHydrationSpec(),
|
|
@@ -16890,7 +16923,7 @@ class SuffixNotSupportedCheck extends TemplateCheckWithVisitor {
|
|
|
16890
16923
|
return [diagnostic];
|
|
16891
16924
|
}
|
|
16892
16925
|
}
|
|
16893
|
-
const factory$
|
|
16926
|
+
const factory$7 = {
|
|
16894
16927
|
code: project_tsconfig_paths.ErrorCode.SUFFIX_NOT_SUPPORTED,
|
|
16895
16928
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.SUFFIX_NOT_SUPPORTED,
|
|
16896
16929
|
create: () => new SuffixNotSupportedCheck(),
|
|
@@ -16935,7 +16968,7 @@ class TextAttributeNotBindingSpec extends TemplateCheckWithVisitor {
|
|
|
16935
16968
|
return [diagnostic];
|
|
16936
16969
|
}
|
|
16937
16970
|
}
|
|
16938
|
-
const factory$
|
|
16971
|
+
const factory$6 = {
|
|
16939
16972
|
code: project_tsconfig_paths.ErrorCode.TEXT_ATTRIBUTE_NOT_BINDING,
|
|
16940
16973
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.TEXT_ATTRIBUTE_NOT_BINDING,
|
|
16941
16974
|
create: () => new TextAttributeNotBindingSpec(),
|
|
@@ -16995,7 +17028,7 @@ function assertExpressionInvoked$1(expression, component, node, expressionText,
|
|
|
16995
17028
|
function generateStringFromExpression$1(expression, source) {
|
|
16996
17029
|
return source.substring(expression.span.start, expression.span.end);
|
|
16997
17030
|
}
|
|
16998
|
-
const factory$
|
|
17031
|
+
const factory$5 = {
|
|
16999
17032
|
code: project_tsconfig_paths.ErrorCode.UNINVOKED_FUNCTION_IN_EVENT_BINDING,
|
|
17000
17033
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.UNINVOKED_FUNCTION_IN_EVENT_BINDING,
|
|
17001
17034
|
create: () => new UninvokedFunctionInEventBindingSpec(),
|
|
@@ -17028,7 +17061,7 @@ class UnparenthesizedNullishCoalescing extends TemplateCheckWithVisitor {
|
|
|
17028
17061
|
return [];
|
|
17029
17062
|
}
|
|
17030
17063
|
}
|
|
17031
|
-
const factory$
|
|
17064
|
+
const factory$4 = {
|
|
17032
17065
|
code: project_tsconfig_paths.ErrorCode.UNPARENTHESIZED_NULLISH_COALESCING,
|
|
17033
17066
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.UNPARENTHESIZED_NULLISH_COALESCING,
|
|
17034
17067
|
create: () => new UnparenthesizedNullishCoalescing(),
|
|
@@ -17072,7 +17105,7 @@ class UnusedLetDeclarationCheck extends TemplateCheckWithVisitor {
|
|
|
17072
17105
|
return this.analysis.get(node);
|
|
17073
17106
|
}
|
|
17074
17107
|
}
|
|
17075
|
-
const factory$
|
|
17108
|
+
const factory$3 = {
|
|
17076
17109
|
code: project_tsconfig_paths.ErrorCode.UNUSED_LET_DECLARATION,
|
|
17077
17110
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.UNUSED_LET_DECLARATION,
|
|
17078
17111
|
create: () => new UnusedLetDeclarationCheck(),
|
|
@@ -17110,7 +17143,7 @@ class UninvokedTrackFunctionCheck extends TemplateCheckWithVisitor {
|
|
|
17110
17143
|
function generateStringFromExpression(expression, source) {
|
|
17111
17144
|
return source.substring(expression.span.start, expression.span.end);
|
|
17112
17145
|
}
|
|
17113
|
-
const factory$
|
|
17146
|
+
const factory$2 = {
|
|
17114
17147
|
code: project_tsconfig_paths.ErrorCode.UNINVOKED_TRACK_FUNCTION,
|
|
17115
17148
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.UNINVOKED_TRACK_FUNCTION,
|
|
17116
17149
|
create: () => new UninvokedTrackFunctionCheck(),
|
|
@@ -17140,12 +17173,98 @@ function assertExpressionInvoked(expression, component, ctx) {
|
|
|
17140
17173
|
}
|
|
17141
17174
|
return [];
|
|
17142
17175
|
}
|
|
17143
|
-
const factory = {
|
|
17176
|
+
const factory$1 = {
|
|
17144
17177
|
code: project_tsconfig_paths.ErrorCode.UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION,
|
|
17145
17178
|
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION,
|
|
17146
17179
|
create: () => new UninvokedFunctionInTextInterpolation(),
|
|
17147
17180
|
};
|
|
17148
17181
|
|
|
17182
|
+
/**
|
|
17183
|
+
* This check implements warnings for unreachable or redundant @defer triggers.
|
|
17184
|
+
* Emits ErrorCode.DEFER_TRIGGER_MISCONFIGURATION with messages matching the project's
|
|
17185
|
+
* expected text.
|
|
17186
|
+
*/
|
|
17187
|
+
class DeferTriggerMisconfiguration extends TemplateCheckWithVisitor {
|
|
17188
|
+
code = project_tsconfig_paths.ErrorCode.DEFER_TRIGGER_MISCONFIGURATION;
|
|
17189
|
+
visitNode(ctx, component, node) {
|
|
17190
|
+
if (!(node instanceof project_tsconfig_paths.DeferredBlock))
|
|
17191
|
+
return [];
|
|
17192
|
+
const mainKeys = Object.keys(node.triggers);
|
|
17193
|
+
const prefetchKeys = Object.keys(node.prefetchTriggers);
|
|
17194
|
+
// Gather actual trigger objects for mains and prefetch (only defined ones)
|
|
17195
|
+
const mains = mainKeys
|
|
17196
|
+
.map((k) => node.triggers[k])
|
|
17197
|
+
.filter((t) => t !== undefined && t !== null);
|
|
17198
|
+
const prefetches = prefetchKeys
|
|
17199
|
+
.map((k) => node.prefetchTriggers[k])
|
|
17200
|
+
.filter((t) => t !== undefined && t !== null);
|
|
17201
|
+
const diags = [];
|
|
17202
|
+
// 'on immediate' dominance
|
|
17203
|
+
const hasImmediateMain = mains.some((t) => t instanceof project_tsconfig_paths.ImmediateDeferredTrigger);
|
|
17204
|
+
if (hasImmediateMain) {
|
|
17205
|
+
if (mains.length > 1) {
|
|
17206
|
+
const msg = `The 'immediate' trigger makes additional triggers redundant.`;
|
|
17207
|
+
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, msg));
|
|
17208
|
+
}
|
|
17209
|
+
if (prefetches.length > 0) {
|
|
17210
|
+
const msg = `Prefetch triggers have no effect because 'immediate' executes earlier.`;
|
|
17211
|
+
diags.push(ctx.makeTemplateDiagnostic(node.sourceSpan, msg));
|
|
17212
|
+
}
|
|
17213
|
+
}
|
|
17214
|
+
// If there is exactly one main and at least one prefetch, compare them.
|
|
17215
|
+
if (mains.length === 1 && prefetches.length > 0) {
|
|
17216
|
+
const main = mains[0];
|
|
17217
|
+
for (const pre of prefetches) {
|
|
17218
|
+
// Timer vs Timer: warn when prefetch delay >= main delay
|
|
17219
|
+
const isTimerTriggger = main instanceof project_tsconfig_paths.TimerDeferredTrigger && pre instanceof project_tsconfig_paths.TimerDeferredTrigger;
|
|
17220
|
+
if (isTimerTriggger) {
|
|
17221
|
+
const mainDelay = main.delay;
|
|
17222
|
+
const preDelay = pre.delay;
|
|
17223
|
+
if (preDelay >= mainDelay) {
|
|
17224
|
+
const msg = `The Prefetch 'timer(${preDelay}ms)' is not scheduled before the main 'timer(${mainDelay}ms)', so it won’t run prior to rendering. Lower the prefetch delay or remove it.`;
|
|
17225
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
17226
|
+
}
|
|
17227
|
+
}
|
|
17228
|
+
// Reference-based triggers (hover/interaction/viewport): only warn if both
|
|
17229
|
+
// have a reference and the references are identical. If references differ
|
|
17230
|
+
// (or one is missing), the prefetch targets a different element and
|
|
17231
|
+
// provides potential value.
|
|
17232
|
+
const isHoverTrigger = main instanceof project_tsconfig_paths.HoverDeferredTrigger && pre instanceof project_tsconfig_paths.HoverDeferredTrigger;
|
|
17233
|
+
const isInteractionTrigger = main instanceof project_tsconfig_paths.InteractionDeferredTrigger &&
|
|
17234
|
+
pre instanceof project_tsconfig_paths.InteractionDeferredTrigger;
|
|
17235
|
+
const isViewportTrigger = main instanceof project_tsconfig_paths.ViewportDeferredTrigger &&
|
|
17236
|
+
pre instanceof project_tsconfig_paths.ViewportDeferredTrigger;
|
|
17237
|
+
if (isHoverTrigger || isInteractionTrigger || isViewportTrigger) {
|
|
17238
|
+
const mainRef = main.reference;
|
|
17239
|
+
const preRef = pre.reference;
|
|
17240
|
+
if (mainRef && preRef && mainRef === preRef) {
|
|
17241
|
+
const kindName = main.constructor.name.replace('DeferredTrigger', '').toLowerCase();
|
|
17242
|
+
const msg = `Prefetch '${kindName}' matches the main trigger and provides no benefit. Remove the prefetch modifier.`;
|
|
17243
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
17244
|
+
}
|
|
17245
|
+
// otherwise, different references or missing reference => no warning
|
|
17246
|
+
continue;
|
|
17247
|
+
}
|
|
17248
|
+
// Syntactic identical: same class for immediate/idle/never etc. (timers handled above)
|
|
17249
|
+
if (main.constructor === pre.constructor &&
|
|
17250
|
+
!(main instanceof project_tsconfig_paths.TimerDeferredTrigger)) {
|
|
17251
|
+
const kind = main instanceof project_tsconfig_paths.ImmediateDeferredTrigger
|
|
17252
|
+
? 'immediate'
|
|
17253
|
+
: main.constructor.name.replace('DeferredTrigger', '').toLowerCase();
|
|
17254
|
+
const msg = `Prefetch '${kind}' matches the main trigger and provides no benefit. Remove the prefetch modifier.`;
|
|
17255
|
+
diags.push(ctx.makeTemplateDiagnostic(pre.sourceSpan ?? node.sourceSpan, msg));
|
|
17256
|
+
}
|
|
17257
|
+
}
|
|
17258
|
+
}
|
|
17259
|
+
return diags;
|
|
17260
|
+
}
|
|
17261
|
+
}
|
|
17262
|
+
const factory = {
|
|
17263
|
+
code: project_tsconfig_paths.ErrorCode.DEFER_TRIGGER_MISCONFIGURATION,
|
|
17264
|
+
name: project_tsconfig_paths.ExtendedTemplateDiagnosticName.DEFER_TRIGGER_MISCONFIGURATION,
|
|
17265
|
+
create: () => new DeferTriggerMisconfiguration(),
|
|
17266
|
+
};
|
|
17267
|
+
|
|
17149
17268
|
/**
|
|
17150
17269
|
* A label referring to a `ts.DiagnosticCategory` or `'suppress'`, meaning the associated diagnostic
|
|
17151
17270
|
* should not be displayed at all.
|
|
@@ -17233,19 +17352,20 @@ function assertNever(value) {
|
|
|
17233
17352
|
}
|
|
17234
17353
|
|
|
17235
17354
|
const ALL_DIAGNOSTIC_FACTORIES = [
|
|
17236
|
-
factory$
|
|
17355
|
+
factory$e,
|
|
17356
|
+
factory$a,
|
|
17237
17357
|
factory$9,
|
|
17238
|
-
factory$
|
|
17358
|
+
factory$d,
|
|
17359
|
+
factory$6,
|
|
17239
17360
|
factory$c,
|
|
17240
|
-
factory$5,
|
|
17241
17361
|
factory$b,
|
|
17242
|
-
factory$a,
|
|
17243
|
-
factory$6,
|
|
17244
|
-
factory$e,
|
|
17245
|
-
factory$4,
|
|
17246
|
-
factory$2,
|
|
17247
17362
|
factory$7,
|
|
17363
|
+
factory$f,
|
|
17364
|
+
factory$5,
|
|
17248
17365
|
factory$3,
|
|
17366
|
+
factory$8,
|
|
17367
|
+
factory$4,
|
|
17368
|
+
factory$2,
|
|
17249
17369
|
factory$1,
|
|
17250
17370
|
factory,
|
|
17251
17371
|
];
|
|
@@ -18040,6 +18160,10 @@ function requireIdentifiers () {
|
|
|
18040
18160
|
|
|
18041
18161
|
const numeric = /^[0-9]+$/;
|
|
18042
18162
|
const compareIdentifiers = (a, b) => {
|
|
18163
|
+
if (typeof a === 'number' && typeof b === 'number') {
|
|
18164
|
+
return a === b ? 0 : a < b ? -1 : 1
|
|
18165
|
+
}
|
|
18166
|
+
|
|
18043
18167
|
const anum = numeric.test(a);
|
|
18044
18168
|
const bnum = numeric.test(b);
|
|
18045
18169
|
|
|
@@ -18182,11 +18306,25 @@ function requireSemver$1 () {
|
|
|
18182
18306
|
other = new SemVer(other, this.options);
|
|
18183
18307
|
}
|
|
18184
18308
|
|
|
18185
|
-
|
|
18186
|
-
|
|
18187
|
-
|
|
18188
|
-
|
|
18189
|
-
|
|
18309
|
+
if (this.major < other.major) {
|
|
18310
|
+
return -1
|
|
18311
|
+
}
|
|
18312
|
+
if (this.major > other.major) {
|
|
18313
|
+
return 1
|
|
18314
|
+
}
|
|
18315
|
+
if (this.minor < other.minor) {
|
|
18316
|
+
return -1
|
|
18317
|
+
}
|
|
18318
|
+
if (this.minor > other.minor) {
|
|
18319
|
+
return 1
|
|
18320
|
+
}
|
|
18321
|
+
if (this.patch < other.patch) {
|
|
18322
|
+
return -1
|
|
18323
|
+
}
|
|
18324
|
+
if (this.patch > other.patch) {
|
|
18325
|
+
return 1
|
|
18326
|
+
}
|
|
18327
|
+
return 0
|
|
18190
18328
|
}
|
|
18191
18329
|
|
|
18192
18330
|
comparePre (other) {
|
|
@@ -19207,6 +19345,7 @@ function requireRange () {
|
|
|
19207
19345
|
// already replaced the hyphen ranges
|
|
19208
19346
|
// turn into a set of JUST comparators.
|
|
19209
19347
|
const parseComparator = (comp, options) => {
|
|
19348
|
+
comp = comp.replace(re[t.BUILD], '');
|
|
19210
19349
|
debug('comp', comp, options);
|
|
19211
19350
|
comp = replaceCarets(comp, options);
|
|
19212
19351
|
debug('caret', comp);
|
|
@@ -20425,7 +20564,7 @@ var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
|
|
|
20425
20564
|
* @param minVersion Minimum required version for the feature.
|
|
20426
20565
|
*/
|
|
20427
20566
|
function coreVersionSupportsFeature(coreVersion, minVersion) {
|
|
20428
|
-
// A version of `21.0.0-next.
|
|
20567
|
+
// A version of `21.0.0-next.8` usually means that core is at head so it supports
|
|
20429
20568
|
// all features. Use string interpolation prevent the placeholder from being replaced
|
|
20430
20569
|
// with the current version during build time.
|
|
20431
20570
|
if (coreVersion === `0.0.0-${'PLACEHOLDER'}`) {
|