@angular/language-service 12.1.2 → 12.1.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.
package/bundles/ivy.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.1.2
2
+ * @license Angular v12.1.3
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -19925,7 +19925,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
19925
19925
  * Use of this source code is governed by an MIT-style license that can be
19926
19926
  * found in the LICENSE file at https://angular.io/license
19927
19927
  */
19928
- const VERSION$1 = new Version('12.1.2');
19928
+ const VERSION$1 = new Version('12.1.3');
19929
19929
 
19930
19930
  /**
19931
19931
  * @license
@@ -20564,7 +20564,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
20564
20564
  function compileDeclareClassMetadata(metadata) {
20565
20565
  const definitionMap = new DefinitionMap();
20566
20566
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
20567
- definitionMap.set('version', literal('12.1.2'));
20567
+ definitionMap.set('version', literal('12.1.3'));
20568
20568
  definitionMap.set('ngImport', importExpr(Identifiers.core));
20569
20569
  definitionMap.set('type', metadata.type);
20570
20570
  definitionMap.set('decorators', metadata.decorators);
@@ -20604,7 +20604,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
20604
20604
  function createDirectiveDefinitionMap(meta) {
20605
20605
  const definitionMap = new DefinitionMap();
20606
20606
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
20607
- definitionMap.set('version', literal('12.1.2'));
20607
+ definitionMap.set('version', literal('12.1.3'));
20608
20608
  // e.g. `type: MyDirective`
20609
20609
  definitionMap.set('type', meta.internalType);
20610
20610
  // e.g. `selector: 'some-dir'`
@@ -20821,7 +20821,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
20821
20821
  function compileDeclareFactoryFunction(meta) {
20822
20822
  const definitionMap = new DefinitionMap();
20823
20823
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
20824
- definitionMap.set('version', literal('12.1.2'));
20824
+ definitionMap.set('version', literal('12.1.3'));
20825
20825
  definitionMap.set('ngImport', importExpr(Identifiers.core));
20826
20826
  definitionMap.set('type', meta.internalType);
20827
20827
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -20863,7 +20863,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
20863
20863
  function createInjectableDefinitionMap(meta) {
20864
20864
  const definitionMap = new DefinitionMap();
20865
20865
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
20866
- definitionMap.set('version', literal('12.1.2'));
20866
+ definitionMap.set('version', literal('12.1.3'));
20867
20867
  definitionMap.set('ngImport', importExpr(Identifiers.core));
20868
20868
  definitionMap.set('type', meta.internalType);
20869
20869
  // Only generate providedIn property if it has a non-null value
@@ -20942,7 +20942,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
20942
20942
  function createInjectorDefinitionMap(meta) {
20943
20943
  const definitionMap = new DefinitionMap();
20944
20944
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
20945
- definitionMap.set('version', literal('12.1.2'));
20945
+ definitionMap.set('version', literal('12.1.3'));
20946
20946
  definitionMap.set('ngImport', importExpr(Identifiers.core));
20947
20947
  definitionMap.set('type', meta.internalType);
20948
20948
  definitionMap.set('providers', meta.providers);
@@ -20979,7 +20979,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
20979
20979
  function createNgModuleDefinitionMap(meta) {
20980
20980
  const definitionMap = new DefinitionMap();
20981
20981
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
20982
- definitionMap.set('version', literal('12.1.2'));
20982
+ definitionMap.set('version', literal('12.1.3'));
20983
20983
  definitionMap.set('ngImport', importExpr(Identifiers.core));
20984
20984
  definitionMap.set('type', meta.internalType);
20985
20985
  // We only generate the keys in the metadata if the arrays contain values.
@@ -21037,7 +21037,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
21037
21037
  function createPipeDefinitionMap(meta) {
21038
21038
  const definitionMap = new DefinitionMap();
21039
21039
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21040
- definitionMap.set('version', literal('12.1.2'));
21040
+ definitionMap.set('version', literal('12.1.3'));
21041
21041
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21042
21042
  // e.g. `type: MyPipe`
21043
21043
  definitionMap.set('type', meta.internalType);
@@ -21069,7 +21069,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
21069
21069
  * Use of this source code is governed by an MIT-style license that can be
21070
21070
  * found in the LICENSE file at https://angular.io/license
21071
21071
  */
21072
- const VERSION$2 = new Version('12.1.2');
21072
+ const VERSION$2 = new Version('12.1.3');
21073
21073
 
21074
21074
  /**
21075
21075
  * @license
@@ -25219,10 +25219,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
25219
25219
  if (expr === null) {
25220
25220
  return DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(node.expression, lhs));
25221
25221
  }
25222
- // If the function is declared in a different file, resolve the foreign function expression
25223
- // using the absolute module name of that file (if any).
25224
- if (lhs.bestGuessOwningModule !== null) {
25225
- context = Object.assign(Object.assign({}, context), { absoluteModuleName: lhs.bestGuessOwningModule.specifier, resolutionContext: node.getSourceFile().fileName });
25222
+ // If the foreign expression occurs in a different file, then assume that the owning module
25223
+ // of the call expression should also be used for the resolved foreign expression.
25224
+ if (expr.getSourceFile() !== node.expression.getSourceFile() &&
25225
+ lhs.bestGuessOwningModule !== null) {
25226
+ context = Object.assign(Object.assign({}, context), { absoluteModuleName: lhs.bestGuessOwningModule.specifier, resolutionContext: lhs.bestGuessOwningModule.resolutionContext });
25226
25227
  }
25227
25228
  return this.visitFfrExpression(expr, context);
25228
25229
  }
@@ -31557,6 +31558,13 @@ Either add the @Injectable() decorator to '${provider.node.name
31557
31558
  class CycleAnalyzer {
31558
31559
  constructor(importGraph) {
31559
31560
  this.importGraph = importGraph;
31561
+ /**
31562
+ * Cycle detection is requested with the same `from` source file for all used directives and pipes
31563
+ * within a component, which makes it beneficial to cache the results as long as the `from` source
31564
+ * file has not changed. This avoids visiting the import graph that is reachable from multiple
31565
+ * directives/pipes more than once.
31566
+ */
31567
+ this.cachedResults = null;
31560
31568
  }
31561
31569
  /**
31562
31570
  * Check for a cycle to be created in the `ts.Program` by adding an import between `from` and
@@ -31566,10 +31574,12 @@ Either add the @Injectable() decorator to '${provider.node.name
31566
31574
  * otherwise.
31567
31575
  */
31568
31576
  wouldCreateCycle(from, to) {
31577
+ // Try to reuse the cached results as long as the `from` source file is the same.
31578
+ if (this.cachedResults === null || this.cachedResults.from !== from) {
31579
+ this.cachedResults = new CycleResults(from, this.importGraph);
31580
+ }
31569
31581
  // Import of 'from' -> 'to' is illegal if an edge 'to' -> 'from' already exists.
31570
- return this.importGraph.transitiveImportsOf(to).has(from) ?
31571
- new Cycle(this.importGraph, from, to) :
31572
- null;
31582
+ return this.cachedResults.wouldBeCyclic(to) ? new Cycle(this.importGraph, from, to) : null;
31573
31583
  }
31574
31584
  /**
31575
31585
  * Record a synthetic import from `from` to `to`.
@@ -31578,9 +31588,73 @@ Either add the @Injectable() decorator to '${provider.node.name
31578
31588
  * import graph for cycle creation.
31579
31589
  */
31580
31590
  recordSyntheticImport(from, to) {
31591
+ this.cachedResults = null;
31581
31592
  this.importGraph.addSyntheticImport(from, to);
31582
31593
  }
31583
31594
  }
31595
+ const NgCyclicResult = Symbol('NgCyclicResult');
31596
+ /**
31597
+ * Stores the results of cycle detection in a memory efficient manner. A symbol is attached to
31598
+ * source files that indicate what the cyclic analysis result is, as indicated by two markers that
31599
+ * are unique to this instance. This alleviates memory pressure in large import graphs, as each
31600
+ * execution is able to store its results in the same memory location (i.e. in the symbol
31601
+ * on the source file) as earlier executions.
31602
+ */
31603
+ class CycleResults {
31604
+ constructor(from, importGraph) {
31605
+ this.from = from;
31606
+ this.importGraph = importGraph;
31607
+ this.cyclic = {};
31608
+ this.acyclic = {};
31609
+ }
31610
+ wouldBeCyclic(sf) {
31611
+ const cached = this.getCachedResult(sf);
31612
+ if (cached !== null) {
31613
+ // The result for this source file has already been computed, so return its result.
31614
+ return cached;
31615
+ }
31616
+ if (sf === this.from) {
31617
+ // We have reached the source file that we want to create an import from, which means that
31618
+ // doing so would create a cycle.
31619
+ return true;
31620
+ }
31621
+ // Assume for now that the file will be acyclic; this prevents infinite recursion in the case
31622
+ // that `sf` is visited again as part of an existing cycle in the graph.
31623
+ this.markAcyclic(sf);
31624
+ const imports = this.importGraph.importsOf(sf);
31625
+ for (const imported of imports) {
31626
+ if (this.wouldBeCyclic(imported)) {
31627
+ this.markCyclic(sf);
31628
+ return true;
31629
+ }
31630
+ }
31631
+ return false;
31632
+ }
31633
+ /**
31634
+ * Returns whether the source file is already known to be cyclic, or `null` if the result is not
31635
+ * yet known.
31636
+ */
31637
+ getCachedResult(sf) {
31638
+ const result = sf[NgCyclicResult];
31639
+ if (result === this.cyclic) {
31640
+ return true;
31641
+ }
31642
+ else if (result === this.acyclic) {
31643
+ return false;
31644
+ }
31645
+ else {
31646
+ // Either the symbol is missing or its value does not correspond with one of the current
31647
+ // result markers. As such, the result is unknown.
31648
+ return null;
31649
+ }
31650
+ }
31651
+ markCyclic(sf) {
31652
+ sf[NgCyclicResult] = this.cyclic;
31653
+ }
31654
+ markAcyclic(sf) {
31655
+ sf[NgCyclicResult] = this.acyclic;
31656
+ }
31657
+ }
31584
31658
  /**
31585
31659
  * Represents an import cycle between `from` and `to` in the program.
31586
31660
  *
@@ -31621,7 +31695,7 @@ Either add the @Injectable() decorator to '${provider.node.name
31621
31695
  constructor(checker, perf) {
31622
31696
  this.checker = checker;
31623
31697
  this.perf = perf;
31624
- this.map = new Map();
31698
+ this.imports = new Map();
31625
31699
  }
31626
31700
  /**
31627
31701
  * List the direct (not transitive) imports of a given `ts.SourceFile`.
@@ -31629,27 +31703,10 @@ Either add the @Injectable() decorator to '${provider.node.name
31629
31703
  * This operation is cached.
31630
31704
  */
31631
31705
  importsOf(sf) {
31632
- if (!this.map.has(sf)) {
31633
- this.map.set(sf, this.scanImports(sf));
31706
+ if (!this.imports.has(sf)) {
31707
+ this.imports.set(sf, this.scanImports(sf));
31634
31708
  }
31635
- return this.map.get(sf);
31636
- }
31637
- /**
31638
- * Lists the transitive imports of a given `ts.SourceFile`.
31639
- */
31640
- transitiveImportsOf(sf) {
31641
- const imports = new Set();
31642
- this.transitiveImportsOfHelper(sf, imports);
31643
- return imports;
31644
- }
31645
- transitiveImportsOfHelper(sf, results) {
31646
- if (results.has(sf)) {
31647
- return;
31648
- }
31649
- results.add(sf);
31650
- this.importsOf(sf).forEach(imported => {
31651
- this.transitiveImportsOfHelper(imported, results);
31652
- });
31709
+ return this.imports.get(sf);
31653
31710
  }
31654
31711
  /**
31655
31712
  * Find an import path from the `start` SourceFile to the `end` SourceFile.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.1.2
2
+ * @license Angular v12.1.3
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -21466,7 +21466,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
21466
21466
  * Use of this source code is governed by an MIT-style license that can be
21467
21467
  * found in the LICENSE file at https://angular.io/license
21468
21468
  */
21469
- const VERSION$1 = new Version('12.1.2');
21469
+ const VERSION$1 = new Version('12.1.3');
21470
21470
 
21471
21471
  /**
21472
21472
  * @license
@@ -37544,7 +37544,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
37544
37544
  /**
37545
37545
  * @publicApi
37546
37546
  */
37547
- const VERSION$2 = new Version$1('12.1.2');
37547
+ const VERSION$2 = new Version$1('12.1.3');
37548
37548
 
37549
37549
  /**
37550
37550
  * @license
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/language-service",
3
- "version": "12.1.2",
3
+ "version": "12.1.3",
4
4
  "description": "Angular - language services",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",