@angular/compiler-cli 14.0.0-rc.2 → 14.0.1

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.
@@ -8,7 +8,7 @@ import {
8
8
  ImportGraph,
9
9
  isShim,
10
10
  readConfiguration
11
- } from "./chunk-VLER5B3O.js";
11
+ } from "./chunk-RT3OZMJ6.js";
12
12
  import {
13
13
  CompilationMode,
14
14
  ComponentDecoratorHandler,
@@ -32,7 +32,7 @@ import {
32
32
  TypeCheckScopeRegistry,
33
33
  forwardRefResolver,
34
34
  readBaseClass
35
- } from "./chunk-VSZPIAX6.js";
35
+ } from "./chunk-NTRR4N4C.js";
36
36
  import {
37
37
  ClassMemberKind,
38
38
  KnownDeclaration,
@@ -5186,4 +5186,4 @@ export {
5186
5186
  * Use of this source code is governed by an MIT-style license that can be
5187
5187
  * found in the LICENSE file at https://angular.io/license
5188
5188
  */
5189
- //# sourceMappingURL=chunk-RV5PLZZB.js.map
5189
+ //# sourceMappingURL=chunk-AXU2Z2WN.js.map
@@ -38,7 +38,7 @@ import {
38
38
  sendMessageToWorker,
39
39
  sortTasksByPriority,
40
40
  stringifyTask
41
- } from "./chunk-RV5PLZZB.js";
41
+ } from "./chunk-AXU2Z2WN.js";
42
42
  import {
43
43
  LogLevel
44
44
  } from "./chunk-7J66ZDC5.js";
@@ -898,7 +898,7 @@ var ProgramBasedEntryPointFinder = class extends TracingEntryPointFinder {
898
898
  };
899
899
 
900
900
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/ngcc/src/packages/build_marker.mjs
901
- var NGCC_VERSION = "14.0.0-rc.2";
901
+ var NGCC_VERSION = "14.0.1";
902
902
  function needsCleaning(packageJson) {
903
903
  return Object.values(packageJson.__processed_by_ivy_ngcc__ || {}).some((value) => value !== NGCC_VERSION);
904
904
  }
@@ -2183,4 +2183,4 @@ export {
2183
2183
  * Use of this source code is governed by an MIT-style license that can be
2184
2184
  * found in the LICENSE file at https://angular.io/license
2185
2185
  */
2186
- //# sourceMappingURL=chunk-GGBQTGO6.js.map
2186
+ //# sourceMappingURL=chunk-EI6PFDB4.js.map
@@ -14,7 +14,7 @@ import {
14
14
  formatDiagnostics,
15
15
  performCompilation,
16
16
  readConfiguration
17
- } from "./chunk-VLER5B3O.js";
17
+ } from "./chunk-RT3OZMJ6.js";
18
18
  import {
19
19
  __spreadProps,
20
20
  __spreadValues
@@ -379,4 +379,4 @@ export {
379
379
  * Use of this source code is governed by an MIT-style license that can be
380
380
  * found in the LICENSE file at https://angular.io/license
381
381
  */
382
- //# sourceMappingURL=chunk-SYV2KBTF.js.map
382
+ //# sourceMappingURL=chunk-KIWI22Y5.js.map
@@ -4578,7 +4578,7 @@ var DirectiveDecoratorHandler = class {
4578
4578
  };
4579
4579
 
4580
4580
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/handler.mjs
4581
- import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr5, FactoryTarget as FactoryTarget2, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, R3Identifiers, R3SelectorScopeMode, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
4581
+ import { compileClassMetadata as compileClassMetadata2, compileDeclareClassMetadata as compileDeclareClassMetadata2, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileInjector, compileNgModule, ExternalExpr as ExternalExpr5, FactoryTarget as FactoryTarget2, FunctionExpr as FunctionExpr2, InvokeFunctionExpr, LiteralArrayExpr as LiteralArrayExpr2, R3Identifiers, R3SelectorScopeMode, ReturnStatement as ReturnStatement2, WrappedNodeExpr as WrappedNodeExpr6 } from "@angular/compiler";
4582
4582
  import ts22 from "typescript";
4583
4583
 
4584
4584
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/ng_module/src/module_with_providers.mjs
@@ -4870,6 +4870,7 @@ var NgModuleDecoratorHandler = class {
4870
4870
  deps: getValidConstructorDependencies(node, this.reflector, this.isCore),
4871
4871
  target: FactoryTarget2.NgModule
4872
4872
  };
4873
+ const remoteScopesMayRequireCycleProtection = declarationRefs.some(isSyntheticReference) || importRefs.some(isSyntheticReference);
4873
4874
  return {
4874
4875
  diagnostics: diagnostics.length > 0 ? diagnostics : void 0,
4875
4876
  analysis: {
@@ -4888,7 +4889,8 @@ var NgModuleDecoratorHandler = class {
4888
4889
  providers: rawProviders,
4889
4890
  providersRequiringFactory: rawProviders ? resolveProvidersRequiringFactory(rawProviders, this.reflector, this.evaluator) : null,
4890
4891
  classMetadata: extractClassMetadata(node, this.reflector, this.isCore, this.annotateForClosureCompiler),
4891
- factorySymbolName: node.name.text
4892
+ factorySymbolName: node.name.text,
4893
+ remoteScopesMayRequireCycleProtection
4892
4894
  }
4893
4895
  };
4894
4896
  }
@@ -4988,7 +4990,7 @@ var NgModuleDecoratorHandler = class {
4988
4990
  };
4989
4991
  }
4990
4992
  }
4991
- compileFull(node, { inj, mod, fac, classMetadata, declarations }, { injectorImports }) {
4993
+ compileFull(node, { inj, mod, fac, classMetadata, declarations, remoteScopesMayRequireCycleProtection }, { injectorImports }) {
4992
4994
  const factoryFn = compileNgFactoryDefField(fac);
4993
4995
  const ngInjectorDef = compileInjector(__spreadProps(__spreadValues({}, inj), {
4994
4996
  imports: injectorImports
@@ -4997,7 +4999,7 @@ var NgModuleDecoratorHandler = class {
4997
4999
  const statements = ngModuleDef.statements;
4998
5000
  const metadata = classMetadata !== null ? compileClassMetadata2(classMetadata) : null;
4999
5001
  this.insertMetadataStatement(statements, metadata);
5000
- this.appendRemoteScopingStatements(statements, node, declarations);
5002
+ this.appendRemoteScopingStatements(statements, node, declarations, remoteScopesMayRequireCycleProtection);
5001
5003
  return this.compileNgModule(factoryFn, ngInjectorDef, ngModuleDef);
5002
5004
  }
5003
5005
  compilePartial(node, { inj, fac, mod, classMetadata }, { injectorImports }) {
@@ -5015,7 +5017,7 @@ var NgModuleDecoratorHandler = class {
5015
5017
  ngModuleStatements.unshift(metadata.toStmt());
5016
5018
  }
5017
5019
  }
5018
- appendRemoteScopingStatements(ngModuleStatements, node, declarations) {
5020
+ appendRemoteScopingStatements(ngModuleStatements, node, declarations, remoteScopesMayRequireCycleProtection) {
5019
5021
  const context = getSourceFile(node);
5020
5022
  for (const decl of declarations) {
5021
5023
  const remoteScope = this.scopeRegistry.getRemoteScope(decl.node);
@@ -5032,11 +5034,13 @@ var NgModuleDecoratorHandler = class {
5032
5034
  });
5033
5035
  const directiveArray = new LiteralArrayExpr2(directives);
5034
5036
  const pipesArray = new LiteralArrayExpr2(pipes);
5037
+ const directiveExpr = remoteScopesMayRequireCycleProtection && directives.length > 0 ? new FunctionExpr2([], [new ReturnStatement2(directiveArray)]) : directiveArray;
5038
+ const pipesExpr = remoteScopesMayRequireCycleProtection && pipes.length > 0 ? new FunctionExpr2([], [new ReturnStatement2(pipesArray)]) : pipesArray;
5035
5039
  const componentType = this.refEmitter.emit(decl, context);
5036
5040
  assertSuccessfulReferenceEmit(componentType, node, "component");
5037
5041
  const declExpr = componentType.expression;
5038
5042
  const setComponentScope = new ExternalExpr5(R3Identifiers.setComponentScope);
5039
- const callExpr = new InvokeFunctionExpr(setComponentScope, [declExpr, directiveArray, pipesArray]);
5043
+ const callExpr = new InvokeFunctionExpr(setComponentScope, [declExpr, directiveExpr, pipesExpr]);
5040
5044
  ngModuleStatements.push(callExpr.toStmt());
5041
5045
  }
5042
5046
  }
@@ -5122,6 +5126,9 @@ function makeStandaloneBootstrapDiagnostic(ngModuleClass, bootstrappedClassRef,
5122
5126
  const relatedInformation = [makeRelatedInformation(ngModuleClass, `The 'bootstrap' array is present on this NgModule.`)];
5123
5127
  return makeDiagnostic(ErrorCode.NGMODULE_BOOTSTRAP_IS_STANDALONE, getDiagnosticNode(bootstrappedClassRef, rawBootstrapExpr), message, relatedInformation);
5124
5128
  }
5129
+ function isSyntheticReference(ref) {
5130
+ return ref.synthetic;
5131
+ }
5125
5132
 
5126
5133
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/component/src/diagnostics.mjs
5127
5134
  function makeCyclicImportInfo(ref, type, cycle) {
@@ -6037,12 +6044,14 @@ var ComponentDecoratorHandler = class {
6037
6044
  }
6038
6045
  }
6039
6046
  }
6047
+ const standaloneImportMayBeForwardDeclared = analysis.resolvedImports !== null && analysis.resolvedImports.some((ref) => ref.synthetic);
6040
6048
  const cycleDetected = cyclesFromDirectives.size !== 0 || cyclesFromPipes.size !== 0;
6041
6049
  if (!cycleDetected) {
6042
6050
  for (const { type, importedFile } of declarations) {
6043
6051
  this.maybeRecordSyntheticImport(importedFile, type, context);
6044
6052
  }
6045
- const wrapDirectivesAndPipesInClosure = declarations.some((decl) => isExpressionForwardReference(decl.type, node.name, context));
6053
+ const declarationIsForwardDeclared = declarations.some((decl) => isExpressionForwardReference(decl.type, node.name, context));
6054
+ const wrapDirectivesAndPipesInClosure = declarationIsForwardDeclared || standaloneImportMayBeForwardDeclared;
6046
6055
  data.declarations = declarations;
6047
6056
  data.declarationListEmitMode = wrapDirectivesAndPipesInClosure ? 1 : 0;
6048
6057
  } else {
@@ -6569,4 +6578,4 @@ export {
6569
6578
  * Use of this source code is governed by an MIT-style license that can be
6570
6579
  * found in the LICENSE file at https://angular.io/license
6571
6580
  */
6572
- //# sourceMappingURL=chunk-VSZPIAX6.js.map
6581
+ //# sourceMappingURL=chunk-NTRR4N4C.js.map