@angular/compiler-cli 17.1.0-next.4 → 17.1.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.
Files changed (52) hide show
  1. package/bundles/{chunk-HQUXRCDO.js → chunk-75SXFAVW.js} +56 -30
  2. package/bundles/chunk-75SXFAVW.js.map +6 -0
  3. package/bundles/{chunk-YGXKICXB.js → chunk-AJU3W7PS.js} +93 -10
  4. package/bundles/chunk-AJU3W7PS.js.map +6 -0
  5. package/bundles/{chunk-5QWOGIJL.js → chunk-FIHKBAQF.js} +2 -2
  6. package/bundles/{chunk-EFMKZSXJ.js → chunk-OQ7ITPZT.js} +817 -2
  7. package/bundles/chunk-OQ7ITPZT.js.map +6 -0
  8. package/bundles/chunk-Q5Y7HH3O.js +62 -0
  9. package/bundles/chunk-Q5Y7HH3O.js.map +6 -0
  10. package/bundles/{chunk-OZXTEOXW.js → chunk-R5FBSX7J.js} +21 -3
  11. package/bundles/chunk-R5FBSX7J.js.map +6 -0
  12. package/bundles/{chunk-U4EFDEE4.js → chunk-YS2EFQ7B.js} +94 -102
  13. package/bundles/chunk-YS2EFQ7B.js.map +6 -0
  14. package/bundles/index.js +8 -6
  15. package/bundles/index.js.map +1 -1
  16. package/bundles/linker/babel/index.js +5 -3
  17. package/bundles/linker/babel/index.js.map +1 -1
  18. package/bundles/linker/index.js +2 -3
  19. package/bundles/private/migrations.js +6 -5
  20. package/bundles/private/tooling.js +6 -2
  21. package/bundles/src/bin/ng_xi18n.js +5 -5
  22. package/bundles/src/bin/ngc.js +5 -5
  23. package/bundles_metadata.json +1 -1
  24. package/linker/babel/src/ast/babel_ast_host.d.ts +1 -0
  25. package/linker/src/ast/ast_host.d.ts +4 -0
  26. package/linker/src/ast/ast_value.d.ts +8 -1
  27. package/linker/src/ast/typescript/typescript_ast_host.d.ts +1 -0
  28. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  29. package/package.json +2 -2
  30. package/private/tooling.d.ts +22 -6
  31. package/src/ngtsc/annotations/directive/index.d.ts +1 -0
  32. package/src/ngtsc/annotations/directive/src/input_function.d.ts +4 -13
  33. package/src/ngtsc/annotations/directive/src/shared.d.ts +2 -2
  34. package/src/ngtsc/annotations/index.d.ts +2 -2
  35. package/src/ngtsc/diagnostics/src/error_code.d.ts +6 -0
  36. package/src/ngtsc/transform/index.d.ts +1 -0
  37. package/src/ngtsc/transform/src/utils.d.ts +1 -1
  38. package/src/ngtsc/translator/src/api/ast_factory.d.ts +1 -1
  39. package/src/ngtsc/translator/src/import_manager.d.ts +2 -1
  40. package/src/ngtsc/typecheck/src/oob.d.ts +3 -3
  41. package/src/ngtsc/typecheck/src/tcb_util.d.ts +1 -1
  42. package/src/transformers/{downlevel_decorators_transform → jit_transforms}/index.d.ts +1 -0
  43. package/src/transformers/jit_transforms/signal_inputs_metadata_transform.d.ts +21 -0
  44. package/bundles/chunk-EFMKZSXJ.js.map +0 -6
  45. package/bundles/chunk-HQUXRCDO.js.map +0 -6
  46. package/bundles/chunk-MFE4YVWE.js +0 -831
  47. package/bundles/chunk-MFE4YVWE.js.map +0 -6
  48. package/bundles/chunk-OZXTEOXW.js.map +0 -6
  49. package/bundles/chunk-U4EFDEE4.js.map +0 -6
  50. package/bundles/chunk-YGXKICXB.js.map +0 -6
  51. /package/bundles/{chunk-5QWOGIJL.js.map → chunk-FIHKBAQF.js.map} +0 -0
  52. /package/src/transformers/{downlevel_decorators_transform → jit_transforms}/downlevel_decorators_transform.d.ts +0 -0
@@ -3,8 +3,14 @@
3
3
  const require = __cjsCompatRequire(import.meta.url);
4
4
 
5
5
  import {
6
- CompilationMode,
7
6
  CompletionKind,
7
+ OptimizeFor,
8
+ PotentialImportKind,
9
+ PotentialImportMode,
10
+ SymbolKind
11
+ } from "./chunk-Q5Y7HH3O.js";
12
+ import {
13
+ CompilationMode,
8
14
  ComponentDecoratorHandler,
9
15
  ComponentScopeKind,
10
16
  CompoundComponentScopeReader,
@@ -23,27 +29,16 @@ import {
23
29
  MetadataDtsModuleScopeResolver,
24
30
  NgModuleDecoratorHandler,
25
31
  NoopReferencesRegistry,
26
- OptimizeFor,
27
32
  PartialEvaluator,
28
33
  PipeDecoratorHandler,
29
- PotentialImportKind,
30
- PotentialImportMode,
31
34
  ResourceRegistry,
32
35
  SemanticDepGraphUpdater,
33
- SymbolKind,
34
36
  TraitCompiler,
35
37
  TypeCheckScopeRegistry,
36
38
  aliasTransformFactory,
37
39
  declarationTransformFactory,
38
40
  ivyTransformFactory
39
- } from "./chunk-U4EFDEE4.js";
40
- import {
41
- ImportManager,
42
- TypeEmitter,
43
- canEmitType,
44
- translateExpression,
45
- translateType
46
- } from "./chunk-MFE4YVWE.js";
41
+ } from "./chunk-YS2EFQ7B.js";
47
42
  import {
48
43
  AbsoluteModuleStrategy,
49
44
  AliasStrategy,
@@ -56,6 +51,7 @@ import {
56
51
  ExtendedTemplateDiagnosticName,
57
52
  FatalDiagnosticError,
58
53
  ImportFlags,
54
+ ImportManager,
59
55
  LocalIdentifierStrategy,
60
56
  LogicalProjectStrategy,
61
57
  ModuleResolver,
@@ -65,11 +61,13 @@ import {
65
61
  Reference,
66
62
  ReferenceEmitter,
67
63
  RelativePathStrategy,
64
+ TypeEmitter,
68
65
  TypeScriptReflectionHost,
69
66
  UnifiedModulesAliasingHost,
70
67
  UnifiedModulesStrategy,
71
68
  addDiagnosticChain,
72
69
  assertSuccessfulReferenceEmit,
70
+ canEmitType,
73
71
  getRootDirs,
74
72
  getSourceFileOrNull,
75
73
  getTokenAtPosition,
@@ -85,8 +83,10 @@ import {
85
83
  normalizeSeparators,
86
84
  relativePathBetween,
87
85
  replaceTsWithNgInErrors,
88
- toUnredirectedSourceFile
89
- } from "./chunk-EFMKZSXJ.js";
86
+ toUnredirectedSourceFile,
87
+ translateExpression,
88
+ translateType
89
+ } from "./chunk-OQ7ITPZT.js";
90
90
  import {
91
91
  ActivePerfRecorder,
92
92
  DelegatingPerfRecorder,
@@ -3313,8 +3313,8 @@ function constructTypeCtorParameter(env, meta, rawType) {
3313
3313
  const plainKeys = [];
3314
3314
  const coercedKeys = [];
3315
3315
  const signalInputKeys = [];
3316
- for (const { classPropertyName, transform, isSignal } of meta.fields.inputs) {
3317
- if (isSignal) {
3316
+ for (const { classPropertyName, transform, isSignal: isSignal2 } of meta.fields.inputs) {
3317
+ if (isSignal2) {
3318
3318
  signalInputKeys.push(ts22.factory.createLiteralTypeNode(ts22.factory.createStringLiteral(classPropertyName)));
3319
3319
  } else if (!meta.coercedInputFields.has(classPropertyName)) {
3320
3320
  plainKeys.push(ts22.factory.createLiteralTypeNode(ts22.factory.createStringLiteral(classPropertyName)));
@@ -3451,7 +3451,7 @@ var Environment = class extends ReferenceEmitEnvironment {
3451
3451
  };
3452
3452
 
3453
3453
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/oob.mjs
3454
- import { TmplAstElement as TmplAstElement2, TmplAstIfBlockBranch } from "@angular/compiler";
3454
+ import { TmplAstElement as TmplAstElement2, TmplAstForLoopBlock, TmplAstForLoopBlockEmpty } from "@angular/compiler";
3455
3455
  import ts24 from "typescript";
3456
3456
  var OutOfBandDiagnosticRecorderImpl = class {
3457
3457
  constructor(resolver) {
@@ -3598,7 +3598,14 @@ Deferred blocks can only access triggers in same view, a parent embedded view or
3598
3598
  this._diagnostics.push(makeTemplateDiagnostic(templateId, this.resolver.getSourceMapping(templateId), trigger.sourceSpan, ts24.DiagnosticCategory.Error, ngErrorCode(ErrorCode.INACCESSIBLE_DEFERRED_TRIGGER_ELEMENT), message));
3599
3599
  }
3600
3600
  controlFlowPreventingContentProjection(templateId, category, projectionNode, componentName, slotSelector, controlFlowNode, preservesWhitespaces) {
3601
- const blockName = controlFlowNode instanceof TmplAstIfBlockBranch ? "@if" : "@for";
3601
+ let blockName;
3602
+ if (controlFlowNode instanceof TmplAstForLoopBlockEmpty) {
3603
+ blockName = "@empty";
3604
+ } else if (controlFlowNode instanceof TmplAstForLoopBlock) {
3605
+ blockName = "@for";
3606
+ } else {
3607
+ blockName = "@if";
3608
+ }
3602
3609
  const lines = [
3603
3610
  `Node matches the "${slotSelector}" slot of the "${componentName}" component, but will not be projected into the specific slot because the surrounding ${blockName} has more than one node at its root. To project the node in the right slot, you can:
3604
3611
  `,
@@ -3640,7 +3647,7 @@ var TypeCheckShimGenerator = class {
3640
3647
  };
3641
3648
 
3642
3649
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.mjs
3643
- import { BindingPipe, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch as TmplAstIfBlockBranch2, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2, TransplantedType } from "@angular/compiler";
3650
+ import { BindingPipe, Call as Call2, createCssSelectorFromNode, CssSelector, DYNAMIC_TYPE, ImplicitReceiver as ImplicitReceiver4, PropertyRead as PropertyRead4, PropertyWrite as PropertyWrite3, R3Identifiers as R3Identifiers3, SafeCall, SafePropertyRead as SafePropertyRead3, SelectorMatcher, ThisReceiver, TmplAstBoundAttribute, TmplAstBoundText, TmplAstDeferredBlock, TmplAstElement as TmplAstElement3, TmplAstForLoopBlock as TmplAstForLoopBlock2, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstReference as TmplAstReference3, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2, TmplAstText, TmplAstTextAttribute as TmplAstTextAttribute2, TmplAstVariable as TmplAstVariable2, TransplantedType } from "@angular/compiler";
3644
3651
  import ts28 from "typescript";
3645
3652
 
3646
3653
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/diagnostics.mjs
@@ -4400,7 +4407,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
4400
4407
  for (const attr of boundAttrs) {
4401
4408
  const expr = widenBinding(translateInput(attr.attribute, this.tcb, this.scope), this.tcb);
4402
4409
  let assignment = wrapForDiagnostics(expr);
4403
- for (const { fieldName, required, transformType, isSignal } of attr.inputs) {
4410
+ for (const { fieldName, required, transformType, isSignal: isSignal2 } of attr.inputs) {
4404
4411
  let target;
4405
4412
  if (required) {
4406
4413
  seenRequiredInputs.add(fieldName);
@@ -4440,7 +4447,7 @@ var TcbDirectiveInputsOp = class extends TcbOp {
4440
4447
  }
4441
4448
  target = this.dir.stringLiteralInputFields.has(fieldName) ? ts28.factory.createElementAccessExpression(dirId, ts28.factory.createStringLiteral(fieldName)) : ts28.factory.createPropertyAccessExpression(dirId, ts28.factory.createIdentifier(fieldName));
4442
4449
  }
4443
- if (isSignal) {
4450
+ if (isSignal2) {
4444
4451
  const inputSignalBrandWriteSymbol = this.tcb.env.referenceExternalSymbol(R3Identifiers3.InputSignalBrandWriteType.moduleName, R3Identifiers3.InputSignalBrandWriteType.name);
4445
4452
  if (!ts28.isIdentifier(inputSignalBrandWriteSymbol) && !ts28.isPropertyAccessExpression(inputSignalBrandWriteSymbol)) {
4446
4453
  throw new Error(`Expected identifier or property access for reference to ${R3Identifiers3.InputSignalBrandWriteType.name}`);
@@ -4557,8 +4564,13 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
4557
4564
  const result = [];
4558
4565
  for (const child of this.element.children) {
4559
4566
  let eligibleNode = null;
4560
- if (child instanceof TmplAstForLoopBlock) {
4561
- eligibleNode = child;
4567
+ if (child instanceof TmplAstForLoopBlock2) {
4568
+ if (this.shouldCheck(child)) {
4569
+ result.push(child);
4570
+ }
4571
+ if (child.empty !== null && this.shouldCheck(child.empty)) {
4572
+ result.push(child.empty);
4573
+ }
4562
4574
  } else if (child instanceof TmplAstIfBlock) {
4563
4575
  eligibleNode = child.branches[0];
4564
4576
  }
@@ -4577,6 +4589,18 @@ var TcbControlFlowContentProjectionOp = class extends TcbOp {
4577
4589
  }
4578
4590
  return result;
4579
4591
  }
4592
+ shouldCheck(node) {
4593
+ if (node.children.length < 2) {
4594
+ return false;
4595
+ }
4596
+ const rootNodeCount = node.children.reduce((count, node2) => {
4597
+ if (!(node2 instanceof TmplAstText) || this.tcb.hostPreserveWhitespaces || node2.value.trim().length > 0) {
4598
+ count++;
4599
+ }
4600
+ return count;
4601
+ }, 0);
4602
+ return rootNodeCount > 1;
4603
+ }
4580
4604
  };
4581
4605
  var ATTR_TO_PROP = new Map(Object.entries({
4582
4606
  "class": "className",
@@ -4964,12 +4988,12 @@ var _Scope = class {
4964
4988
  }
4965
4989
  this.registerVariable(scope, v, new TcbTemplateVariableOp(tcb, scope, scopedNode, v));
4966
4990
  }
4967
- } else if (scopedNode instanceof TmplAstIfBlockBranch2) {
4991
+ } else if (scopedNode instanceof TmplAstIfBlockBranch) {
4968
4992
  const { expression, expressionAlias } = scopedNode;
4969
4993
  if (expression !== null && expressionAlias !== null) {
4970
4994
  this.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
4971
4995
  }
4972
- } else if (scopedNode instanceof TmplAstForLoopBlock) {
4996
+ } else if (scopedNode instanceof TmplAstForLoopBlock2) {
4973
4997
  const loopInitializer = tcb.allocateId();
4974
4998
  addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
4975
4999
  scope.varMap.set(scopedNode.item, loopInitializer);
@@ -5102,7 +5126,7 @@ var _Scope = class {
5102
5126
  this.opQueue.push(new TcbIfOp(this.tcb, this, node));
5103
5127
  } else if (node instanceof TmplAstSwitchBlock) {
5104
5128
  this.opQueue.push(new TcbExpressionOp(this.tcb, this, node.expression), new TcbSwitchOp(this.tcb, this, node));
5105
- } else if (node instanceof TmplAstForLoopBlock) {
5129
+ } else if (node instanceof TmplAstForLoopBlock2) {
5106
5130
  this.opQueue.push(new TcbForOfOp(this.tcb, this, node));
5107
5131
  node.empty && this.appendChildren(node.empty);
5108
5132
  } else if (node instanceof TmplAstBoundText) {
@@ -7218,10 +7242,12 @@ var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
7218
7242
  return [];
7219
7243
  }
7220
7244
  };
7245
+ function isSignal(symbol) {
7246
+ return ((symbol == null ? void 0 : symbol.escapedName) === "WritableSignal" || (symbol == null ? void 0 : symbol.escapedName) === "Signal") && symbol.parent.escapedName.includes("@angular/core");
7247
+ }
7221
7248
  function buildDiagnosticForSignal(ctx, node, component) {
7222
- var _a, _b;
7223
7249
  const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
7224
- if ((symbol == null ? void 0 : symbol.kind) === SymbolKind.Expression && (((_a = symbol.tsType.symbol) == null ? void 0 : _a.escapedName) === "WritableSignal" || ((_b = symbol.tsType.symbol) == null ? void 0 : _b.escapedName) === "Signal") && symbol.tsType.symbol.parent.escapedName.includes("@angular/core")) {
7250
+ if ((symbol == null ? void 0 : symbol.kind) === SymbolKind.Expression && (isSignal(symbol.tsType.symbol) || isSignal(symbol.tsType.aliasSymbol))) {
7225
7251
  const templateMapping = ctx.templateTypeChecker.getTemplateMappingAtTcbLocation(symbol.tcbLocation);
7226
7252
  const errorString = `${node.name} is a function and should be invoked: ${node.name}()`;
7227
7253
  const diagnostic = ctx.makeTemplateDiagnostic(templateMapping.span, errorString);
@@ -8939,4 +8965,4 @@ export {
8939
8965
  * Use of this source code is governed by an MIT-style license that can be
8940
8966
  * found in the LICENSE file at https://angular.io/license
8941
8967
  */
8942
- //# sourceMappingURL=chunk-HQUXRCDO.js.map
8968
+ //# sourceMappingURL=chunk-75SXFAVW.js.map