@angular/compiler-cli 15.1.1 → 15.2.0-next.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.
Files changed (32) hide show
  1. package/bundles/{chunk-RUBM3IRF.js → chunk-3WT7ICUD.js} +2 -2
  2. package/bundles/{chunk-RUBM3IRF.js.map → chunk-3WT7ICUD.js.map} +0 -0
  3. package/bundles/chunk-NEQOZOZQ.js +2 -2
  4. package/bundles/{chunk-2SEOGDKD.js → chunk-SQCRAYKM.js} +157 -65
  5. package/bundles/chunk-SQCRAYKM.js.map +6 -0
  6. package/bundles/{chunk-P6RV7WPP.js → chunk-TNUB43C4.js} +52 -5
  7. package/bundles/chunk-TNUB43C4.js.map +6 -0
  8. package/bundles/{chunk-SOIGFD6W.js → chunk-UOX4HXHH.js} +3 -3
  9. package/bundles/{chunk-SOIGFD6W.js.map → chunk-UOX4HXHH.js.map} +0 -0
  10. package/bundles/{chunk-ZIYE3XC2.js → chunk-UUYR4OJT.js} +3 -3
  11. package/bundles/{chunk-ZIYE3XC2.js.map → chunk-UUYR4OJT.js.map} +0 -0
  12. package/bundles/index.js +5 -4
  13. package/bundles/index.js.map +1 -1
  14. package/bundles/ngcc/index.js +4 -4
  15. package/bundles/ngcc/main-ngcc.js +4 -4
  16. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +3 -3
  17. package/bundles/private/migrations.js +5 -1
  18. package/bundles/src/bin/ng_xi18n.js +3 -3
  19. package/bundles/src/bin/ngc.js +3 -3
  20. package/bundles_metadata.json +1 -1
  21. package/ngcc/src/packages/build_marker.d.ts +1 -1
  22. package/package.json +2 -2
  23. package/private/migrations.d.ts +1 -0
  24. package/src/ngtsc/metadata/src/api.d.ts +8 -2
  25. package/src/ngtsc/metadata/src/ng_module_index.d.ts +25 -0
  26. package/src/ngtsc/metadata/src/registry.d.ts +1 -1
  27. package/src/ngtsc/typecheck/api/api.d.ts +1 -0
  28. package/src/ngtsc/typecheck/api/checker.d.ts +21 -2
  29. package/src/ngtsc/typecheck/api/scope.d.ts +13 -0
  30. package/src/ngtsc/typecheck/src/checker.d.ts +12 -6
  31. package/bundles/chunk-2SEOGDKD.js.map +0 -6
  32. package/bundles/chunk-P6RV7WPP.js.map +0 -6
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-2SEOGDKD.js";
15
+ } from "./chunk-SQCRAYKM.js";
16
16
 
17
17
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/main.mjs
18
18
  import ts2 from "typescript";
@@ -375,4 +375,4 @@ export {
375
375
  * Use of this source code is governed by an MIT-style license that can be
376
376
  * found in the LICENSE file at https://angular.io/license
377
377
  */
378
- //# sourceMappingURL=chunk-RUBM3IRF.js.map
378
+ //# sourceMappingURL=chunk-3WT7ICUD.js.map
@@ -848,7 +848,7 @@ var declarationFunctions = [
848
848
  ];
849
849
  function createLinkerMap(environment, sourceUrl, code) {
850
850
  const linkers = /* @__PURE__ */ new Map();
851
- const LATEST_VERSION_RANGE = getRange("<=", "15.1.1");
851
+ const LATEST_VERSION_RANGE = getRange("<=", "15.2.0-next.1");
852
852
  linkers.set(\u0275\u0275ngDeclareDirective, [
853
853
  { range: LATEST_VERSION_RANGE, linker: new PartialDirectiveLinkerVersion1(sourceUrl, code) }
854
854
  ]);
@@ -895,7 +895,7 @@ var PartialLinkerSelector = class {
895
895
  throw new Error(`Unknown partial declaration function ${functionName}.`);
896
896
  }
897
897
  const linkerRanges = this.linkers.get(functionName);
898
- if (version === "15.1.1") {
898
+ if (version === "15.2.0-next.1") {
899
899
  return linkerRanges[linkerRanges.length - 1].linker;
900
900
  }
901
901
  const declarationRange = getRange(">=", minVersion);
@@ -4,6 +4,7 @@
4
4
 
5
5
  import {
6
6
  CompilationMode,
7
+ CompletionKind,
7
8
  ComponentDecoratorHandler,
8
9
  ComponentScopeKind,
9
10
  CompoundComponentScopeReader,
@@ -21,16 +22,20 @@ import {
21
22
  MetadataDtsModuleScopeResolver,
22
23
  NgModuleDecoratorHandler,
23
24
  NoopReferencesRegistry,
25
+ OptimizeFor,
24
26
  PartialEvaluator,
25
27
  PipeDecoratorHandler,
28
+ PotentialImportKind,
29
+ PotentialImportMode,
26
30
  ResourceRegistry,
27
31
  SemanticDepGraphUpdater,
32
+ SymbolKind,
28
33
  TraitCompiler,
29
34
  TypeCheckScopeRegistry,
30
35
  aliasTransformFactory,
31
36
  declarationTransformFactory,
32
37
  ivyTransformFactory
33
- } from "./chunk-P6RV7WPP.js";
38
+ } from "./chunk-TNUB43C4.js";
34
39
  import {
35
40
  TypeScriptReflectionHost,
36
41
  isNamedClassDeclaration
@@ -125,43 +130,6 @@ function createCompilerHost({ options, tsHost = ts.createCompilerHost(options, t
125
130
  return tsHost;
126
131
  }
127
132
 
128
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/checker.mjs
129
- var OptimizeFor;
130
- (function(OptimizeFor2) {
131
- OptimizeFor2[OptimizeFor2["SingleFile"] = 0] = "SingleFile";
132
- OptimizeFor2[OptimizeFor2["WholeProgram"] = 1] = "WholeProgram";
133
- })(OptimizeFor || (OptimizeFor = {}));
134
-
135
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/completion.mjs
136
- var CompletionKind;
137
- (function(CompletionKind2) {
138
- CompletionKind2[CompletionKind2["Reference"] = 0] = "Reference";
139
- CompletionKind2[CompletionKind2["Variable"] = 1] = "Variable";
140
- })(CompletionKind || (CompletionKind = {}));
141
-
142
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/scope.mjs
143
- var PotentialImportKind;
144
- (function(PotentialImportKind2) {
145
- PotentialImportKind2[PotentialImportKind2["NgModule"] = 0] = "NgModule";
146
- PotentialImportKind2[PotentialImportKind2["Standalone"] = 1] = "Standalone";
147
- })(PotentialImportKind || (PotentialImportKind = {}));
148
-
149
- // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/api/symbols.mjs
150
- var SymbolKind;
151
- (function(SymbolKind2) {
152
- SymbolKind2[SymbolKind2["Input"] = 0] = "Input";
153
- SymbolKind2[SymbolKind2["Output"] = 1] = "Output";
154
- SymbolKind2[SymbolKind2["Binding"] = 2] = "Binding";
155
- SymbolKind2[SymbolKind2["Reference"] = 3] = "Reference";
156
- SymbolKind2[SymbolKind2["Variable"] = 4] = "Variable";
157
- SymbolKind2[SymbolKind2["Directive"] = 5] = "Directive";
158
- SymbolKind2[SymbolKind2["Element"] = 6] = "Element";
159
- SymbolKind2[SymbolKind2["Template"] = 7] = "Template";
160
- SymbolKind2[SymbolKind2["Expression"] = 8] = "Expression";
161
- SymbolKind2[SymbolKind2["DomBinding"] = 9] = "DomBinding";
162
- SymbolKind2[SymbolKind2["Pipe"] = 10] = "Pipe";
163
- })(SymbolKind || (SymbolKind = {}));
164
-
165
133
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/program.mjs
166
134
  import { HtmlParser, MessageBundle } from "@angular/compiler";
167
135
  import ts34 from "typescript";
@@ -1755,6 +1723,95 @@ function generateAnalysis(context) {
1755
1723
  return analysis;
1756
1724
  }
1757
1725
 
1726
+ // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/metadata/src/ng_module_index.mjs
1727
+ var NgModuleIndexImpl = class {
1728
+ constructor(metaReader, localReader) {
1729
+ this.metaReader = metaReader;
1730
+ this.localReader = localReader;
1731
+ this.ngModuleAuthoritativeReference = /* @__PURE__ */ new Map();
1732
+ this.typeToExportingModules = /* @__PURE__ */ new Map();
1733
+ this.indexed = false;
1734
+ }
1735
+ updateWith(cache, key, elem) {
1736
+ if (cache.has(key)) {
1737
+ cache.get(key).add(elem);
1738
+ } else {
1739
+ const set = /* @__PURE__ */ new Set();
1740
+ set.add(elem);
1741
+ cache.set(key, set);
1742
+ }
1743
+ }
1744
+ index() {
1745
+ const seenTypesWithReexports = /* @__PURE__ */ new Map();
1746
+ const locallyDeclaredDirsAndNgModules = [
1747
+ ...this.localReader.getKnown(MetaKind.NgModule),
1748
+ ...this.localReader.getKnown(MetaKind.Directive)
1749
+ ];
1750
+ for (const decl of locallyDeclaredDirsAndNgModules) {
1751
+ this.indexTrait(new Reference(decl), seenTypesWithReexports);
1752
+ }
1753
+ this.indexed = true;
1754
+ }
1755
+ indexTrait(ref, seenTypesWithReexports) {
1756
+ var _a, _b, _c;
1757
+ if (seenTypesWithReexports.has(ref.node)) {
1758
+ return;
1759
+ }
1760
+ seenTypesWithReexports.set(ref.node, /* @__PURE__ */ new Set());
1761
+ const meta = (_a = this.metaReader.getDirectiveMetadata(ref)) != null ? _a : this.metaReader.getNgModuleMetadata(ref);
1762
+ if (meta === null) {
1763
+ return;
1764
+ }
1765
+ if (meta.imports !== null) {
1766
+ for (const childRef of meta.imports) {
1767
+ this.indexTrait(childRef, seenTypesWithReexports);
1768
+ }
1769
+ }
1770
+ if (meta.kind === MetaKind.NgModule) {
1771
+ if (!this.ngModuleAuthoritativeReference.has(ref.node)) {
1772
+ this.ngModuleAuthoritativeReference.set(ref.node, ref);
1773
+ }
1774
+ for (const childRef of meta.exports) {
1775
+ this.indexTrait(childRef, seenTypesWithReexports);
1776
+ const childMeta = (_c = (_b = this.metaReader.getDirectiveMetadata(childRef)) != null ? _b : this.metaReader.getPipeMetadata(childRef)) != null ? _c : this.metaReader.getNgModuleMetadata(childRef);
1777
+ if (childMeta === null) {
1778
+ continue;
1779
+ }
1780
+ switch (childMeta.kind) {
1781
+ case MetaKind.Directive:
1782
+ case MetaKind.Pipe:
1783
+ this.updateWith(this.typeToExportingModules, childRef.node, ref.node);
1784
+ this.updateWith(seenTypesWithReexports, ref.node, childRef.node);
1785
+ break;
1786
+ case MetaKind.NgModule:
1787
+ if (seenTypesWithReexports.has(childRef.node)) {
1788
+ for (const reexported of seenTypesWithReexports.get(childRef.node)) {
1789
+ this.updateWith(this.typeToExportingModules, reexported, ref.node);
1790
+ this.updateWith(seenTypesWithReexports, ref.node, reexported);
1791
+ }
1792
+ }
1793
+ break;
1794
+ }
1795
+ }
1796
+ }
1797
+ }
1798
+ getNgModulesExporting(directiveOrPipe) {
1799
+ if (!this.indexed) {
1800
+ this.index();
1801
+ }
1802
+ if (!this.typeToExportingModules.has(directiveOrPipe)) {
1803
+ return [];
1804
+ }
1805
+ const refs = [];
1806
+ for (const ngModule of this.typeToExportingModules.get(directiveOrPipe)) {
1807
+ if (this.ngModuleAuthoritativeReference.has(ngModule)) {
1808
+ refs.push(this.ngModuleAuthoritativeReference.get(ngModule));
1809
+ }
1810
+ }
1811
+ return refs;
1812
+ }
1813
+ };
1814
+
1758
1815
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/resource/src/loader.mjs
1759
1816
  import ts10 from "typescript";
1760
1817
  var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
@@ -5491,7 +5548,7 @@ function sourceSpanEqual(a, b) {
5491
5548
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/typecheck/src/checker.mjs
5492
5549
  var REGISTRY2 = new DomElementSchemaRegistry2();
5493
5550
  var TemplateTypeCheckerImpl = class {
5494
- constructor(originalProgram, programDriver, typeCheckAdapter, config, refEmitter, reflector, compilerHost, priorBuild, metaReader, localMetaReader, componentScopeReader, typeCheckScopeRegistry, perf) {
5551
+ constructor(originalProgram, programDriver, typeCheckAdapter, config, refEmitter, reflector, compilerHost, priorBuild, metaReader, localMetaReader, ngModuleIndex, componentScopeReader, typeCheckScopeRegistry, perf) {
5495
5552
  this.originalProgram = originalProgram;
5496
5553
  this.programDriver = programDriver;
5497
5554
  this.typeCheckAdapter = typeCheckAdapter;
@@ -5502,6 +5559,7 @@ var TemplateTypeCheckerImpl = class {
5502
5559
  this.priorBuild = priorBuild;
5503
5560
  this.metaReader = metaReader;
5504
5561
  this.localMetaReader = localMetaReader;
5562
+ this.ngModuleIndex = ngModuleIndex;
5505
5563
  this.componentScopeReader = componentScopeReader;
5506
5564
  this.typeCheckScopeRegistry = typeCheckScopeRegistry;
5507
5565
  this.perf = perf;
@@ -5519,6 +5577,14 @@ var TemplateTypeCheckerImpl = class {
5519
5577
  }
5520
5578
  return data.template;
5521
5579
  }
5580
+ getUsedDirectives(component) {
5581
+ var _a;
5582
+ return ((_a = this.getLatestComponentState(component).data) == null ? void 0 : _a.boundTarget.getUsedDirectives()) || null;
5583
+ }
5584
+ getUsedPipes(component) {
5585
+ var _a;
5586
+ return ((_a = this.getLatestComponentState(component).data) == null ? void 0 : _a.boundTarget.getUsedPipes()) || null;
5587
+ }
5522
5588
  getLatestComponentState(component) {
5523
5589
  this.ensureShimForComponent(component);
5524
5590
  const sf = component.getSourceFile();
@@ -5888,6 +5954,18 @@ var TemplateTypeCheckerImpl = class {
5888
5954
  }
5889
5955
  return this.typeCheckScopeRegistry.getTypeCheckDirectiveMetadata(new Reference(dir));
5890
5956
  }
5957
+ getNgModuleMetadata(module) {
5958
+ if (!isNamedClassDeclaration(module)) {
5959
+ return null;
5960
+ }
5961
+ return this.metaReader.getNgModuleMetadata(new Reference(module));
5962
+ }
5963
+ getPipeMetadata(pipe) {
5964
+ if (!isNamedClassDeclaration(pipe)) {
5965
+ return null;
5966
+ }
5967
+ return this.metaReader.getPipeMetadata(new Reference(pipe));
5968
+ }
5891
5969
  getPotentialElementTags(component) {
5892
5970
  if (this.elementTagCache.has(component)) {
5893
5971
  return this.elementTagCache.get(component);
@@ -5957,32 +6035,46 @@ var TemplateTypeCheckerImpl = class {
5957
6035
  }
5958
6036
  return scope.ngModule;
5959
6037
  }
5960
- getPotentialImportsFor(toImport, inContext) {
6038
+ emit(kind, refTo, inContext) {
6039
+ const emittedRef = this.refEmitter.emit(refTo, inContext.getSourceFile());
6040
+ if (emittedRef.kind === 1) {
6041
+ return null;
6042
+ }
6043
+ const emitted = emittedRef.expression;
6044
+ if (emitted instanceof WrappedNodeExpr) {
6045
+ return { kind, symbolName: emitted.node.text };
6046
+ } else if (emitted instanceof ExternalExpr2 && emitted.value.moduleName !== null && emitted.value.name !== null) {
6047
+ return {
6048
+ kind,
6049
+ moduleSpecifier: emitted.value.moduleName,
6050
+ symbolName: emitted.value.name
6051
+ };
6052
+ }
6053
+ return null;
6054
+ }
6055
+ getPotentialImportsFor(toImport, inContext, importMode) {
5961
6056
  var _a;
5962
- let ngModuleRef;
5963
- if (toImport.ngModule !== null) {
5964
- ngModuleRef = (_a = this.metaReader.getNgModuleMetadata(new Reference(toImport.ngModule))) == null ? void 0 : _a.ref;
5965
- }
5966
- const kind = ngModuleRef ? PotentialImportKind.NgModule : PotentialImportKind.Standalone;
5967
- const importTarget = ngModuleRef != null ? ngModuleRef : toImport.ref;
5968
- const emittedRef = this.refEmitter.emit(importTarget, inContext.getSourceFile());
5969
- if (emittedRef.kind === 1)
5970
- return [];
5971
- const emittedExpression = emittedRef.expression;
5972
- if (emittedExpression instanceof WrappedNodeExpr) {
5973
- return [{ kind, symbolName: emittedExpression.node.getText() }];
6057
+ const imports = [];
6058
+ const meta = (_a = this.metaReader.getDirectiveMetadata(toImport)) != null ? _a : this.metaReader.getPipeMetadata(toImport);
6059
+ if (meta === null) {
6060
+ return imports;
5974
6061
  }
5975
- if (!(emittedExpression instanceof ExternalExpr2)) {
5976
- return [];
6062
+ if (meta.isStandalone || importMode === PotentialImportMode.ForceDirect) {
6063
+ const emitted = this.emit(PotentialImportKind.Standalone, toImport, inContext);
6064
+ if (emitted !== null) {
6065
+ imports.push(emitted);
6066
+ }
5977
6067
  }
5978
- if (emittedExpression.value.moduleName === null || emittedExpression.value.name === null)
5979
- return [];
5980
- const preferredImport = {
5981
- kind: ngModuleRef ? PotentialImportKind.NgModule : PotentialImportKind.Standalone,
5982
- moduleSpecifier: emittedExpression.value.moduleName,
5983
- symbolName: emittedExpression.value.name
5984
- };
5985
- return [preferredImport];
6068
+ const exportingNgModules = this.ngModuleIndex.getNgModulesExporting(meta.ref.node);
6069
+ if (exportingNgModules !== null) {
6070
+ for (const exporter of exportingNgModules) {
6071
+ const emittedRef = this.emit(PotentialImportKind.NgModule, exporter, inContext);
6072
+ if (emittedRef !== null) {
6073
+ imports.push(emittedRef);
6074
+ }
6075
+ }
6076
+ }
6077
+ return imports;
5986
6078
  }
5987
6079
  getScopeData(component) {
5988
6080
  if (this.scopeCache.has(component)) {
@@ -7042,6 +7134,7 @@ var NgCompiler = class {
7042
7134
  const localMetaReader = localMetaRegistry;
7043
7135
  const depScopeReader = new MetadataDtsModuleScopeResolver(dtsReader, aliasingHost);
7044
7136
  const metaReader = new CompoundMetadataReader([localMetaReader, dtsReader]);
7137
+ const ngModuleIndex = new NgModuleIndexImpl(metaReader, localMetaReader);
7045
7138
  const ngModuleScopeRegistry = new LocalModuleScopeRegistry(localMetaReader, metaReader, depScopeReader, refEmitter, aliasingHost);
7046
7139
  const standaloneScopeReader = new StandaloneComponentScopeReader(metaReader, ngModuleScopeRegistry, depScopeReader);
7047
7140
  const scopeReader = new CompoundComponentScopeReader([ngModuleScopeRegistry, standaloneScopeReader]);
@@ -7075,7 +7168,7 @@ var NgCompiler = class {
7075
7168
  this.incrementalStrategy.setIncrementalState(this.incrementalCompilation.state, program);
7076
7169
  this.currentProgram = program;
7077
7170
  });
7078
- const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, metaReader, localMetaReader, scopeReader, typeCheckScopeRegistry, this.delegatingPerfRecorder);
7171
+ const templateTypeChecker = new TemplateTypeCheckerImpl(this.inputProgram, notifyingDriver, traitCompiler, this.getTypeCheckingConfig(), refEmitter, reflector, this.adapter, this.incrementalCompilation, metaReader, localMetaReader, ngModuleIndex, scopeReader, typeCheckScopeRegistry, this.delegatingPerfRecorder);
7079
7172
  const extendedTemplateChecker = this.constructionDiagnostics.length === 0 ? new ExtendedTemplateCheckerImpl(templateTypeChecker, checker, ALL_DIAGNOSTIC_FACTORIES, this.options) : null;
7080
7173
  return {
7081
7174
  isCore,
@@ -7830,7 +7923,6 @@ export {
7830
7923
  untagAllTsFiles,
7831
7924
  TsCreateProgramDriver,
7832
7925
  PatchedProgramIncrementalBuildStrategy,
7833
- OptimizeFor,
7834
7926
  freshCompilationTicket,
7835
7927
  incrementalFromStateTicket,
7836
7928
  NgCompiler,
@@ -7853,4 +7945,4 @@ export {
7853
7945
  * found in the LICENSE file at https://angular.io/license
7854
7946
  */
7855
7947
  // Closure Compiler ignores @suppress and similar if the comment contains @license.
7856
- //# sourceMappingURL=chunk-2SEOGDKD.js.map
7948
+ //# sourceMappingURL=chunk-SQCRAYKM.js.map