@angular/compiler-cli 17.3.0-next.1 → 17.3.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 (40) hide show
  1. package/bundles/{chunk-YVYW546M.js → chunk-3ESFLGKJ.js} +61 -31
  2. package/bundles/chunk-3ESFLGKJ.js.map +6 -0
  3. package/bundles/{chunk-7VU7HCQZ.js → chunk-6X7GQ6BQ.js} +2 -1
  4. package/bundles/{chunk-7VU7HCQZ.js.map → chunk-6X7GQ6BQ.js.map} +1 -1
  5. package/bundles/{chunk-IIZOI4XA.js → chunk-E5DF5SRS.js} +3 -3
  6. package/bundles/{chunk-FPKC3HSK.js → chunk-GQ63H5AL.js} +2 -2
  7. package/bundles/{chunk-2CAUFIKU.js → chunk-OXIOYWLB.js} +3 -3
  8. package/bundles/{chunk-5A5Y7O22.js → chunk-X6GFRI46.js} +187 -132
  9. package/bundles/chunk-X6GFRI46.js.map +6 -0
  10. package/bundles/{chunk-Q5Y7HH3O.js → chunk-YUMIYLNL.js} +1 -1
  11. package/bundles/{chunk-Q5Y7HH3O.js.map → chunk-YUMIYLNL.js.map} +1 -1
  12. package/bundles/index.js +6 -6
  13. package/bundles/linker/babel/index.js +2 -2
  14. package/bundles/linker/index.js +2 -2
  15. package/bundles/private/migrations.js +3 -3
  16. package/bundles/private/tooling.js +3 -3
  17. package/bundles/src/bin/ng_xi18n.js +5 -5
  18. package/bundles/src/bin/ngc.js +5 -5
  19. package/bundles_metadata.json +1 -1
  20. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  21. package/package.json +2 -2
  22. package/src/ngtsc/annotations/component/src/handler.d.ts +2 -0
  23. package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +9 -4
  24. package/src/ngtsc/core/src/compiler.d.ts +1 -7
  25. package/src/ngtsc/reflection/index.d.ts +1 -1
  26. package/src/ngtsc/reflection/src/type_to_value.d.ts +1 -0
  27. package/src/ngtsc/transform/src/api.d.ts +2 -0
  28. package/src/ngtsc/transform/src/compilation.d.ts +1 -2
  29. package/src/ngtsc/typecheck/api/checker.d.ts +6 -1
  30. package/src/ngtsc/typecheck/src/checker.d.ts +2 -1
  31. package/src/ngtsc/typecheck/src/oob.d.ts +1 -3
  32. package/src/ngtsc/typecheck/src/symbol_util.d.ts +10 -0
  33. package/src/ngtsc/typecheck/template_semantics/api/api.d.ts +18 -0
  34. package/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.d.ts +15 -0
  35. package/bundles/chunk-5A5Y7O22.js.map +0 -6
  36. package/bundles/chunk-YVYW546M.js.map +0 -6
  37. package/src/ngtsc/typecheck/src/template_semantics.d.ts +0 -21
  38. /package/bundles/{chunk-IIZOI4XA.js.map → chunk-E5DF5SRS.js.map} +0 -0
  39. /package/bundles/{chunk-FPKC3HSK.js.map → chunk-GQ63H5AL.js.map} +0 -0
  40. /package/bundles/{chunk-2CAUFIKU.js.map → chunk-OXIOYWLB.js.map} +0 -0
@@ -12,6 +12,7 @@ import {
12
12
  Reference,
13
13
  assertSuccessfulReferenceEmit,
14
14
  attachDefaultImportDeclaration,
15
+ entityNameToValue,
15
16
  filterToMembersWithDecorator,
16
17
  getDefaultImportDeclaration,
17
18
  getSourceFile,
@@ -29,7 +30,7 @@ import {
29
30
  translateStatement,
30
31
  translateType,
31
32
  typeNodeToValueExpr
32
- } from "./chunk-7VU7HCQZ.js";
33
+ } from "./chunk-6X7GQ6BQ.js";
33
34
  import {
34
35
  PerfEvent,
35
36
  PerfPhase
@@ -2531,7 +2532,7 @@ var TraitCompiler = class {
2531
2532
  }
2532
2533
  }
2533
2534
  }
2534
- extendedTemplateCheck(sf, extendedTemplateChecker) {
2535
+ runAdditionalChecks(sf, check) {
2535
2536
  if (this.compilationMode === CompilationMode.LOCAL) {
2536
2537
  return [];
2537
2538
  }
@@ -2546,10 +2547,10 @@ var TraitCompiler = class {
2546
2547
  }
2547
2548
  const record = this.classes.get(clazz);
2548
2549
  for (const trait of record.traits) {
2549
- if (trait.handler.extendedTemplateCheck === void 0) {
2550
- continue;
2550
+ const result = check(clazz, trait.handler);
2551
+ if (result !== null) {
2552
+ diagnostics.push(...result);
2551
2553
  }
2552
- diagnostics.push(...trait.handler.extendedTemplateCheck(clazz, extendedTemplateChecker));
2553
2554
  }
2554
2555
  }
2555
2556
  return diagnostics;
@@ -4436,58 +4437,71 @@ import ts23 from "typescript";
4436
4437
 
4437
4438
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/initializer_functions.mjs
4438
4439
  import ts20 from "typescript";
4439
- function tryParseInitializerApiMember(fnNames, member, reflector, importTracker) {
4440
+ function tryParseInitializerApiMember(functions, member, reflector, importTracker) {
4440
4441
  if (member.value === null || !ts20.isCallExpression(member.value)) {
4441
4442
  return null;
4442
4443
  }
4443
4444
  const call = member.value;
4444
- const staticResult = parseTopLevelCall(call, fnNames, importTracker) || parseTopLevelRequiredCall(call, fnNames, importTracker) || parseTopLevelCallFromNamespace(call, fnNames, importTracker);
4445
+ const staticResult = parseTopLevelCall(call, functions, importTracker) || parseTopLevelRequiredCall(call, functions, importTracker) || parseTopLevelCallFromNamespace(call, functions, importTracker);
4445
4446
  if (staticResult === null) {
4446
4447
  return null;
4447
4448
  }
4448
- const resolvedImport = reflector.getImportOfIdentifier(staticResult.node);
4449
- if (resolvedImport === null || !fnNames.includes(resolvedImport.name)) {
4449
+ const resolvedImport = reflector.getImportOfIdentifier(staticResult.apiReference);
4450
+ if (resolvedImport === null || staticResult.api.functionName !== resolvedImport.name || staticResult.api.owningModule !== resolvedImport.from) {
4450
4451
  return null;
4451
4452
  }
4452
4453
  return {
4454
+ api: staticResult.api,
4453
4455
  call,
4454
- isRequired: staticResult.isRequired,
4455
- apiName: resolvedImport.name
4456
+ isRequired: staticResult.isRequired
4456
4457
  };
4457
4458
  }
4458
- function parseTopLevelCall(call, fnNames, importTracker) {
4459
+ function parseTopLevelCall(call, functions, importTracker) {
4459
4460
  const node = call.expression;
4460
4461
  if (!ts20.isIdentifier(node)) {
4461
4462
  return null;
4462
4463
  }
4463
- return fnNames.some((name) => importTracker.isPotentialReferenceToNamedImport(node, name, CORE_MODULE)) ? { node, isRequired: false } : null;
4464
+ const matchingApi = functions.find((fn) => importTracker.isPotentialReferenceToNamedImport(node, fn.functionName, fn.owningModule));
4465
+ if (matchingApi === void 0) {
4466
+ return null;
4467
+ }
4468
+ return { api: matchingApi, apiReference: node, isRequired: false };
4464
4469
  }
4465
- function parseTopLevelRequiredCall(call, fnNames, importTracker) {
4470
+ function parseTopLevelRequiredCall(call, functions, importTracker) {
4466
4471
  const node = call.expression;
4467
4472
  if (!ts20.isPropertyAccessExpression(node) || !ts20.isIdentifier(node.expression) || node.name.text !== "required") {
4468
4473
  return null;
4469
4474
  }
4470
4475
  const expression = node.expression;
4471
- const matchesCoreApi = fnNames.some((name) => importTracker.isPotentialReferenceToNamedImport(expression, name, CORE_MODULE));
4472
- return matchesCoreApi ? { node: expression, isRequired: true } : null;
4476
+ const matchingApi = functions.find((fn) => importTracker.isPotentialReferenceToNamedImport(expression, fn.functionName, fn.owningModule));
4477
+ if (matchingApi === void 0) {
4478
+ return null;
4479
+ }
4480
+ return { api: matchingApi, apiReference: expression, isRequired: true };
4473
4481
  }
4474
- function parseTopLevelCallFromNamespace(call, fnNames, importTracker) {
4482
+ function parseTopLevelCallFromNamespace(call, functions, importTracker) {
4475
4483
  const node = call.expression;
4476
4484
  if (!ts20.isPropertyAccessExpression(node)) {
4477
4485
  return null;
4478
4486
  }
4479
4487
  let apiReference = null;
4488
+ let matchingApi = void 0;
4480
4489
  let isRequired = false;
4481
- if (ts20.isIdentifier(node.expression) && ts20.isIdentifier(node.name) && importTracker.isPotentialReferenceToNamespaceImport(node.expression, CORE_MODULE)) {
4490
+ if (ts20.isIdentifier(node.expression) && ts20.isIdentifier(node.name)) {
4491
+ const namespaceRef = node.expression;
4482
4492
  apiReference = node.name;
4483
- } else if (ts20.isPropertyAccessExpression(node.expression) && ts20.isIdentifier(node.expression.expression) && ts20.isIdentifier(node.expression.name) && importTracker.isPotentialReferenceToNamespaceImport(node.expression.expression, CORE_MODULE) && node.name.text === "required") {
4493
+ matchingApi = functions.find((fn) => node.name.text === fn.functionName && importTracker.isPotentialReferenceToNamespaceImport(namespaceRef, fn.owningModule));
4494
+ } else if (ts20.isPropertyAccessExpression(node.expression) && ts20.isIdentifier(node.expression.expression) && ts20.isIdentifier(node.expression.name) && node.name.text === "required") {
4495
+ const potentialName = node.expression.name.text;
4496
+ const namespaceRef = node.expression.expression;
4484
4497
  apiReference = node.expression.name;
4498
+ matchingApi = functions.find((fn) => fn.functionName === potentialName && importTracker.isPotentialReferenceToNamespaceImport(namespaceRef, fn.owningModule));
4485
4499
  isRequired = true;
4486
4500
  }
4487
- if (apiReference === null || !fnNames.includes(apiReference.text)) {
4501
+ if (matchingApi === void 0 || apiReference === null) {
4488
4502
  return null;
4489
4503
  }
4490
- return { node: apiReference, isRequired };
4504
+ return { api: matchingApi, apiReference, isRequired };
4491
4505
  }
4492
4506
 
4493
4507
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_output_parse_options.mjs
@@ -4511,7 +4525,7 @@ function parseAndValidateInputAndOutputOptions(optionsNode) {
4511
4525
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/input_function.mjs
4512
4526
  function tryParseSignalInputMapping(member, reflector, importTracker) {
4513
4527
  var _a;
4514
- const signalInput = tryParseInitializerApiMember(["input"], member, reflector, importTracker);
4528
+ const signalInput = tryParseInitializerApiMember([{ functionName: "input", owningModule: "@angular/core" }], member, reflector, importTracker);
4515
4529
  if (signalInput === null) {
4516
4530
  return null;
4517
4531
  }
@@ -4530,7 +4544,7 @@ function tryParseSignalInputMapping(member, reflector, importTracker) {
4530
4544
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/model_function.mjs
4531
4545
  function tryParseSignalModelMapping(member, reflector, importTracker) {
4532
4546
  var _a;
4533
- const model = tryParseInitializerApiMember(["model"], member, reflector, importTracker);
4547
+ const model = tryParseInitializerApiMember([{ functionName: "model", owningModule: "@angular/core" }], member, reflector, importTracker);
4534
4548
  if (model === null) {
4535
4549
  return null;
4536
4550
  }
@@ -4558,14 +4572,17 @@ function tryParseSignalModelMapping(member, reflector, importTracker) {
4558
4572
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/directive/src/output_function.mjs
4559
4573
  function tryParseInitializerBasedOutput(member, reflector, importTracker) {
4560
4574
  var _a;
4561
- const output = tryParseInitializerApiMember(["output", "\u0275output"], member, reflector, importTracker);
4575
+ const output = tryParseInitializerApiMember([
4576
+ { functionName: "output", owningModule: "@angular/core" },
4577
+ { functionName: "outputFromObservable", owningModule: "@angular/core/rxjs-interop" }
4578
+ ], member, reflector, importTracker);
4562
4579
  if (output === null) {
4563
4580
  return null;
4564
4581
  }
4565
4582
  if (output.isRequired) {
4566
4583
  throw new FatalDiagnosticError(ErrorCode.INITIALIZER_API_NO_REQUIRED_FUNCTION, output.call, `Output does not support ".required()".`);
4567
4584
  }
4568
- const optionsNode = output.call.arguments[0];
4585
+ const optionsNode = output.api.functionName === "output" ? output.call.arguments[0] : output.call.arguments[1];
4569
4586
  const options = optionsNode !== void 0 ? parseAndValidateInputAndOutputOptions(optionsNode) : null;
4570
4587
  const classPropertyName = member.name;
4571
4588
  return {
@@ -4584,11 +4601,13 @@ import ts22 from "typescript";
4584
4601
  var queryFunctionNames = ["viewChild", "viewChildren", "contentChild", "contentChildren"];
4585
4602
  var defaultDescendantsValue = (type) => type !== "contentChildren";
4586
4603
  function tryParseSignalQueryFromInitializer(member, reflector, importTracker) {
4587
- const query = tryParseInitializerApiMember(queryFunctionNames, member, reflector, importTracker);
4604
+ const initializerFns = queryFunctionNames.map((fnName) => ({ functionName: fnName, owningModule: "@angular/core" }));
4605
+ const query = tryParseInitializerApiMember(initializerFns, member, reflector, importTracker);
4588
4606
  if (query === null) {
4589
4607
  return null;
4590
4608
  }
4591
- const isSingleQuery = query.apiName === "viewChild" || query.apiName === "contentChild";
4609
+ const { functionName } = query.api;
4610
+ const isSingleQuery = functionName === "viewChild" || functionName === "contentChild";
4592
4611
  const predicateNode = query.call.arguments[0];
4593
4612
  if (predicateNode === void 0) {
4594
4613
  throw new FatalDiagnosticError(ErrorCode.VALUE_HAS_WRONG_TYPE, query.call, "No locator specified.");
@@ -4599,9 +4618,9 @@ function tryParseSignalQueryFromInitializer(member, reflector, importTracker) {
4599
4618
  }
4600
4619
  const options = optionsNode && reflectObjectLiteral(optionsNode);
4601
4620
  const read = (options == null ? void 0 : options.has("read")) ? parseReadOption(options.get("read")) : null;
4602
- const descendants = (options == null ? void 0 : options.has("descendants")) ? parseDescendantsOption(options.get("descendants")) : defaultDescendantsValue(query.apiName);
4621
+ const descendants = (options == null ? void 0 : options.has("descendants")) ? parseDescendantsOption(options.get("descendants")) : defaultDescendantsValue(functionName);
4603
4622
  return {
4604
- name: query.apiName,
4623
+ name: functionName,
4605
4624
  call: query.call,
4606
4625
  metadata: {
4607
4626
  isSignal: true,
@@ -4626,6 +4645,9 @@ function parseLocator(expression, reflector) {
4626
4645
  return createMayBeForwardRefExpression(new o.WrappedNodeExpr(expression), unwrappedExpression !== null ? 2 : 0);
4627
4646
  }
4628
4647
  function parseReadOption(value) {
4648
+ if (ts22.isExpressionWithTypeArguments(value) || ts22.isParenthesizedExpression(value) || ts22.isAsExpression(value)) {
4649
+ return parseReadOption(value.expression);
4650
+ }
4629
4651
  if (ts22.isPropertyAccessExpression(value) && ts22.isIdentifier(value.expression) || ts22.isIdentifier(value)) {
4630
4652
  return new o.WrappedNodeExpr(value);
4631
4653
  }
@@ -5749,7 +5771,12 @@ function createModuleWithProvidersResolver(reflector, isCore) {
5749
5771
  if (ts24.isTypeLiteralNode(t)) {
5750
5772
  for (const m of t.members) {
5751
5773
  const ngModuleType = ts24.isPropertySignature(m) && ts24.isIdentifier(m.name) && m.name.text === "ngModule" && m.type || null;
5752
- const ngModuleExpression = ngModuleType && typeNodeToValueExpr(ngModuleType);
5774
+ let ngModuleExpression = null;
5775
+ if (ngModuleType !== null && ts24.isTypeQueryNode(ngModuleType)) {
5776
+ ngModuleExpression = entityNameToValue(ngModuleType.exprName);
5777
+ } else if (ngModuleType !== null) {
5778
+ ngModuleExpression = typeNodeToValueExpr(ngModuleType);
5779
+ }
5753
5780
  if (ngModuleExpression) {
5754
5781
  return ngModuleExpression;
5755
5782
  }
@@ -7317,6 +7344,9 @@ var ComponentDecoratorHandler = class {
7317
7344
  extendedTemplateCheck(component, extendedTemplateChecker) {
7318
7345
  return extendedTemplateChecker.getDiagnosticsForComponent(component);
7319
7346
  }
7347
+ templateSemanticsCheck(component, templateSemanticsChecker) {
7348
+ return templateSemanticsChecker.getDiagnosticsForComponent(component);
7349
+ }
7320
7350
  resolve(node, analysis, symbol) {
7321
7351
  const metadata = analysis.meta;
7322
7352
  const diagnostics = [];
@@ -8321,4 +8351,4 @@ export {
8321
8351
  * Use of this source code is governed by an MIT-style license that can be
8322
8352
  * found in the LICENSE file at https://angular.io/license
8323
8353
  */
8324
- //# sourceMappingURL=chunk-YVYW546M.js.map
8354
+ //# sourceMappingURL=chunk-3ESFLGKJ.js.map