@angular/compiler-cli 18.2.0-next.1 → 18.2.0-next.3

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.
Files changed (40) hide show
  1. package/bundles/{chunk-AOEZR223.js → chunk-5DVL3S3Z.js} +108 -25
  2. package/bundles/chunk-5DVL3S3Z.js.map +6 -0
  3. package/bundles/{chunk-K6EUU7R4.js → chunk-AQRCENAS.js} +75 -20
  4. package/bundles/{chunk-K6EUU7R4.js.map → chunk-AQRCENAS.js.map} +3 -3
  5. package/bundles/{chunk-HXUTQSG7.js → chunk-B4ZOGV3N.js} +3 -3
  6. package/bundles/{chunk-GKWXRLYL.js → chunk-EFWQF5B3.js} +36 -20
  7. package/bundles/chunk-EFWQF5B3.js.map +6 -0
  8. package/bundles/{chunk-MAWNNEES.js → chunk-FL7B5BOI.js} +2 -2
  9. package/bundles/{chunk-Z5UNTO33.js → chunk-KQXJFD6L.js} +2 -2
  10. package/bundles/{chunk-SJE2NFCG.js → chunk-O4UKU4TQ.js} +3 -3
  11. package/bundles/index.js +6 -6
  12. package/bundles/linker/babel/index.js +2 -2
  13. package/bundles/linker/index.js +2 -2
  14. package/bundles/private/migrations.js +4 -2
  15. package/bundles/private/tooling.js +4 -4
  16. package/bundles/src/bin/ng_xi18n.js +5 -5
  17. package/bundles/src/bin/ngc.js +5 -5
  18. package/bundles_metadata.json +1 -1
  19. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  20. package/package.json +3 -3
  21. package/private/migrations.d.ts +1 -0
  22. package/src/ngtsc/annotations/component/src/metadata.d.ts +1 -0
  23. package/src/ngtsc/annotations/directive/src/handler.d.ts +1 -0
  24. package/src/ngtsc/annotations/directive/src/shared.d.ts +1 -0
  25. package/src/ngtsc/annotations/ng_module/src/handler.d.ts +3 -2
  26. package/src/ngtsc/core/api/src/options.d.ts +5 -0
  27. package/src/ngtsc/diagnostics/src/error_code.d.ts +12 -0
  28. package/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.d.ts +2 -1
  29. package/src/ngtsc/metadata/src/api.d.ts +5 -0
  30. package/src/ngtsc/translator/src/api/import_generator.d.ts +10 -0
  31. package/src/ngtsc/translator/src/import_manager/import_manager.d.ts +18 -2
  32. package/src/ngtsc/translator/src/import_manager/import_typescript_transform.d.ts +1 -0
  33. package/src/ngtsc/typecheck/extended/api/api.d.ts +10 -0
  34. package/src/ngtsc/typecheck/extended/checks/unused_let_declaration/index.d.ts +10 -0
  35. package/bundles/chunk-AOEZR223.js.map +0 -6
  36. package/bundles/chunk-GKWXRLYL.js.map +0 -6
  37. /package/bundles/{chunk-HXUTQSG7.js.map → chunk-B4ZOGV3N.js.map} +0 -0
  38. /package/bundles/{chunk-MAWNNEES.js.map → chunk-FL7B5BOI.js.map} +0 -0
  39. /package/bundles/{chunk-Z5UNTO33.js.map → chunk-KQXJFD6L.js.map} +0 -0
  40. /package/bundles/{chunk-SJE2NFCG.js.map → chunk-O4UKU4TQ.js.map} +0 -0
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-SJE2NFCG.js";
7
+ } from "./chunk-O4UKU4TQ.js";
8
8
  import {
9
9
  CompilationMode,
10
10
  ComponentDecoratorHandler,
@@ -51,7 +51,7 @@ import {
51
51
  retagAllTsFiles,
52
52
  tryParseInitializerApi,
53
53
  untagAllTsFiles
54
- } from "./chunk-GKWXRLYL.js";
54
+ } from "./chunk-EFWQF5B3.js";
55
55
  import {
56
56
  AbsoluteModuleStrategy,
57
57
  AliasStrategy,
@@ -87,7 +87,7 @@ import {
87
87
  relativePathBetween,
88
88
  replaceTsWithNgInErrors,
89
89
  toUnredirectedSourceFile
90
- } from "./chunk-AOEZR223.js";
90
+ } from "./chunk-5DVL3S3Z.js";
91
91
  import {
92
92
  ActivePerfRecorder,
93
93
  DelegatingPerfRecorder,
@@ -2487,6 +2487,9 @@ function isSignalSymbol(symbol) {
2487
2487
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/api/api.mjs
2488
2488
  import { ASTWithSource as ASTWithSource2, RecursiveAstVisitor as RecursiveAstVisitor2, TmplAstBoundDeferredTrigger as TmplAstBoundDeferredTrigger2 } from "@angular/compiler";
2489
2489
  var TemplateCheckWithVisitor = class {
2490
+ constructor() {
2491
+ this.canVisitStructuralAttributes = true;
2492
+ }
2490
2493
  run(ctx, component, template) {
2491
2494
  const visitor = new TemplateVisitor2(ctx, component, this);
2492
2495
  return visitor.getDiagnostics(template);
@@ -2523,10 +2526,13 @@ var TemplateVisitor2 = class extends RecursiveAstVisitor2 {
2523
2526
  this.visitAllNodes(element.children);
2524
2527
  }
2525
2528
  visitTemplate(template) {
2529
+ const isInlineTemplate = template.tagName === "ng-template";
2526
2530
  this.visitAllNodes(template.attributes);
2527
- if (template.tagName === "ng-template") {
2531
+ if (isInlineTemplate) {
2528
2532
  this.visitAllNodes(template.inputs);
2529
2533
  this.visitAllNodes(template.outputs);
2534
+ }
2535
+ if (this.check.canVisitStructuralAttributes || isInlineTemplate) {
2530
2536
  this.visitAllNodes(template.templateAttrs);
2531
2537
  }
2532
2538
  this.visitAllNodes(template.variables);
@@ -2774,6 +2780,7 @@ import ts17 from "typescript";
2774
2780
  var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
2775
2781
  constructor() {
2776
2782
  super(...arguments);
2783
+ this.canVisitStructuralAttributes = false;
2777
2784
  this.code = ErrorCode.NULLISH_COALESCING_NOT_NULLABLE;
2778
2785
  }
2779
2786
  visitNode(ctx, component, node) {
@@ -2819,6 +2826,7 @@ import ts18 from "typescript";
2819
2826
  var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
2820
2827
  constructor() {
2821
2828
  super(...arguments);
2829
+ this.canVisitStructuralAttributes = false;
2822
2830
  this.code = ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE;
2823
2831
  }
2824
2832
  visitNode(ctx, component, node) {
@@ -2974,6 +2982,51 @@ var factory9 = {
2974
2982
  create: () => new UninvokedFunctionInEventBindingSpec()
2975
2983
  };
2976
2984
 
2985
+ // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/checks/unused_let_declaration/index.mjs
2986
+ import { AST, ASTWithSource as ASTWithSource5, TmplAstLetDeclaration } from "@angular/compiler";
2987
+ var UnusedLetDeclarationCheck = class extends TemplateCheckWithVisitor {
2988
+ constructor() {
2989
+ super(...arguments);
2990
+ this.code = ErrorCode.UNUSED_LET_DECLARATION;
2991
+ this.analysis = /* @__PURE__ */ new Map();
2992
+ }
2993
+ run(ctx, component, template) {
2994
+ super.run(ctx, component, template);
2995
+ const diagnostics = [];
2996
+ const { allLetDeclarations, usedLetDeclarations } = this.getAnalysis(component);
2997
+ for (const decl of allLetDeclarations) {
2998
+ if (!usedLetDeclarations.has(decl)) {
2999
+ diagnostics.push(ctx.makeTemplateDiagnostic(decl.sourceSpan, `@let ${decl.name} is declared but its value is never read.`));
3000
+ }
3001
+ }
3002
+ this.analysis.clear();
3003
+ return diagnostics;
3004
+ }
3005
+ visitNode(ctx, component, node) {
3006
+ if (node instanceof TmplAstLetDeclaration) {
3007
+ this.getAnalysis(component).allLetDeclarations.add(node);
3008
+ } else if (node instanceof AST) {
3009
+ const unwrappedNode = node instanceof ASTWithSource5 ? node.ast : node;
3010
+ const target = ctx.templateTypeChecker.getExpressionTarget(unwrappedNode, component);
3011
+ if (target !== null && target instanceof TmplAstLetDeclaration) {
3012
+ this.getAnalysis(component).usedLetDeclarations.add(target);
3013
+ }
3014
+ }
3015
+ return [];
3016
+ }
3017
+ getAnalysis(node) {
3018
+ if (!this.analysis.has(node)) {
3019
+ this.analysis.set(node, { allLetDeclarations: /* @__PURE__ */ new Set(), usedLetDeclarations: /* @__PURE__ */ new Set() });
3020
+ }
3021
+ return this.analysis.get(node);
3022
+ }
3023
+ };
3024
+ var factory10 = {
3025
+ code: ErrorCode.UNUSED_LET_DECLARATION,
3026
+ name: ExtendedTemplateDiagnosticName.UNUSED_LET_DECLARATION,
3027
+ create: () => new UnusedLetDeclarationCheck()
3028
+ };
3029
+
2977
3030
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.mjs
2978
3031
  import ts19 from "typescript";
2979
3032
 
@@ -2991,12 +3044,12 @@ var ExtendedTemplateCheckerImpl = class {
2991
3044
  var _a, _b, _c, _d, _e;
2992
3045
  this.partialCtx = { templateTypeChecker, typeChecker };
2993
3046
  this.templateChecks = /* @__PURE__ */ new Map();
2994
- for (const factory10 of templateCheckFactories) {
2995
- const category = diagnosticLabelToCategory((_e = (_d = (_b = (_a = options == null ? void 0 : options.extendedDiagnostics) == null ? void 0 : _a.checks) == null ? void 0 : _b[factory10.name]) != null ? _d : (_c = options == null ? void 0 : options.extendedDiagnostics) == null ? void 0 : _c.defaultCategory) != null ? _e : DiagnosticCategoryLabel.Warning);
3047
+ for (const factory11 of templateCheckFactories) {
3048
+ const category = diagnosticLabelToCategory((_e = (_d = (_b = (_a = options == null ? void 0 : options.extendedDiagnostics) == null ? void 0 : _a.checks) == null ? void 0 : _b[factory11.name]) != null ? _d : (_c = options == null ? void 0 : options.extendedDiagnostics) == null ? void 0 : _c.defaultCategory) != null ? _e : DiagnosticCategoryLabel.Warning);
2996
3049
  if (category === null) {
2997
3050
  continue;
2998
3051
  }
2999
- const check = factory10.create(options);
3052
+ const check = factory11.create(options);
3000
3053
  if (check === null) {
3001
3054
  continue;
3002
3055
  }
@@ -3048,15 +3101,16 @@ var ALL_DIAGNOSTIC_FACTORIES = [
3048
3101
  factory4,
3049
3102
  factory7,
3050
3103
  factory,
3051
- factory9
3104
+ factory9,
3105
+ factory10
3052
3106
  ];
3053
3107
  var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
3054
3108
  ExtendedTemplateDiagnosticName.CONTROL_FLOW_PREVENTING_CONTENT_PROJECTION,
3055
- ...ALL_DIAGNOSTIC_FACTORIES.map((factory10) => factory10.name)
3109
+ ...ALL_DIAGNOSTIC_FACTORIES.map((factory11) => factory11.name)
3056
3110
  ]);
3057
3111
 
3058
3112
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.mjs
3059
- import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver2, ParsedEventType as ParsedEventType2, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration, TmplAstRecursiveVisitor as TmplAstRecursiveVisitor2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
3113
+ import { ASTWithSource as ASTWithSource6, ImplicitReceiver as ImplicitReceiver2, ParsedEventType as ParsedEventType2, RecursiveAstVisitor as RecursiveAstVisitor3, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstRecursiveVisitor as TmplAstRecursiveVisitor2, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
3060
3114
  import ts20 from "typescript";
3061
3115
  var TemplateSemanticsCheckerImpl = class {
3062
3116
  constructor(templateTypeChecker) {
@@ -3115,7 +3169,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor3 {
3115
3169
  }
3116
3170
  const target = this.templateTypeChecker.getExpressionTarget(ast, this.component);
3117
3171
  const isVariable = target instanceof TmplAstVariable2;
3118
- const isLet = target instanceof TmplAstLetDeclaration;
3172
+ const isLet = target instanceof TmplAstLetDeclaration2;
3119
3173
  if (!isVariable && !isLet) {
3120
3174
  return;
3121
3175
  }
@@ -3143,7 +3197,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor3 {
3143
3197
  }
3144
3198
  };
3145
3199
  function unwrapAstWithSource(ast) {
3146
- return ast instanceof ASTWithSource5 ? ast.ast : ast;
3200
+ return ast instanceof ASTWithSource6 ? ast.ast : ast;
3147
3201
  }
3148
3202
 
3149
3203
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.mjs
@@ -3335,7 +3389,7 @@ var NgCompiler = class {
3335
3389
  }
3336
3390
  }
3337
3391
  constructor(adapter, options, inputProgram, programDriver, incrementalStrategy, incrementalCompilation, enableTemplateTypeChecker, usePoisonedData, livePerfRecorder) {
3338
- var _a, _b, _c, _d;
3392
+ var _a, _b, _c;
3339
3393
  this.adapter = adapter;
3340
3394
  this.options = options;
3341
3395
  this.inputProgram = inputProgram;
@@ -3348,10 +3402,11 @@ var NgCompiler = class {
3348
3402
  this.constructionDiagnostics = [];
3349
3403
  this.nonTemplateDiagnostics = null;
3350
3404
  this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
3351
- this.enableTemplateTypeChecker = enableTemplateTypeChecker || ((_a = options["_enableTemplateTypeChecker"]) != null ? _a : false);
3352
- this.enableBlockSyntax = (_b = options["_enableBlockSyntax"]) != null ? _b : true;
3353
- this.enableLetSyntax = (_c = options["_enableLetSyntax"]) != null ? _c : true;
3354
- this.angularCoreVersion = (_d = options["_angularCoreVersion"]) != null ? _d : null;
3405
+ this.usePoisonedData = usePoisonedData || !!options._compilePoisonedComponents;
3406
+ this.enableTemplateTypeChecker = enableTemplateTypeChecker || !!options._enableTemplateTypeChecker;
3407
+ this.enableBlockSyntax = (_a = options["_enableBlockSyntax"]) != null ? _a : true;
3408
+ this.enableLetSyntax = (_b = options["_enableLetSyntax"]) != null ? _b : true;
3409
+ this.angularCoreVersion = (_c = options["_angularCoreVersion"]) != null ? _c : null;
3355
3410
  this.constructionDiagnostics.push(...this.adapter.constructionDiagnostics, ...verifyCompatibleTypeCheckOptions(this.options));
3356
3411
  this.currentProgram = inputProgram;
3357
3412
  this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
@@ -3537,6 +3592,7 @@ var NgCompiler = class {
3537
3592
  }
3538
3593
  prepareEmit() {
3539
3594
  const compilation = this.ensureAnalyzed();
3595
+ untagAllTsFiles(this.inputProgram);
3540
3596
  const coreImportsFrom = compilation.isCore ? getR3SymbolsFile(this.inputProgram) : null;
3541
3597
  let importRewriter;
3542
3598
  if (coreImportsFrom !== null) {
@@ -3891,7 +3947,7 @@ var NgCompiler = class {
3891
3947
  new DirectiveDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, metaReader, injectableRegistry, refEmitter, referencesRegistry, isCore, strictCtorDeps, semanticDepGraphUpdater, this.closureCompilerEnabled, this.delegatingPerfRecorder, importTracker, supportTestBed, compilationMode, jitDeclarationRegistry),
3892
3948
  new PipeDecoratorHandler(reflector, evaluator, metaRegistry, ngModuleScopeRegistry, injectableRegistry, isCore, this.delegatingPerfRecorder, supportTestBed, compilationMode, !!this.options.generateExtraImportsInLocalMode),
3893
3949
  new InjectableDecoratorHandler(reflector, evaluator, isCore, strictCtorDeps, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, compilationMode),
3894
- new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (_d = this.options.onlyPublishPublicTypingsForNgModules) != null ? _d : false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, supportJitMode, compilationMode, localCompilationExtraImportsTracker)
3950
+ new NgModuleDecoratorHandler(reflector, evaluator, metaReader, metaRegistry, ngModuleScopeRegistry, referencesRegistry, exportedProviderStatusResolver, semanticDepGraphUpdater, isCore, refEmitter, this.closureCompilerEnabled, (_d = this.options.onlyPublishPublicTypingsForNgModules) != null ? _d : false, injectableRegistry, this.delegatingPerfRecorder, supportTestBed, supportJitMode, compilationMode, localCompilationExtraImportsTracker, jitDeclarationRegistry)
3895
3951
  ];
3896
3952
  const traitCompiler = new TraitCompiler(handlers, reflector, this.delegatingPerfRecorder, this.incrementalCompilation, this.options.compileNonExportedClasses !== false, compilationMode, dtsTransforms, semanticDepGraphUpdater, this.adapter);
3897
3953
  const notifyingDriver = new NotifyingProgramDriverWrapper(this.programDriver, (program) => {
@@ -4369,7 +4425,6 @@ var NgtscProgram = class {
4369
4425
  };
4370
4426
  }
4371
4427
  }
4372
- untagAllTsFiles(this.tsProgram);
4373
4428
  const forceEmit = (_a = opts == null ? void 0 : opts.forceEmit) != null ? _a : false;
4374
4429
  this.compiler.perfRecorder.memory(PerfCheckpoint.PreEmit);
4375
4430
  const res = this.compiler.perfRecorder.inPhase(PerfPhase.TypeScriptEmit, () => {
@@ -4703,4 +4758,4 @@ export {
4703
4758
  * Use of this source code is governed by an MIT-style license that can be
4704
4759
  * found in the LICENSE file at https://angular.io/license
4705
4760
  */
4706
- //# sourceMappingURL=chunk-K6EUU7R4.js.map
4761
+ //# sourceMappingURL=chunk-AQRCENAS.js.map