@angular/language-service 12.0.2 → 12.0.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.0.2
2
+ * @license Angular v12.0.3
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -17918,7 +17918,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
17918
17918
  * Use of this source code is governed by an MIT-style license that can be
17919
17919
  * found in the LICENSE file at https://angular.io/license
17920
17920
  */
17921
- const VERSION$1 = new Version('12.0.2');
17921
+ const VERSION$1 = new Version('12.0.3');
17922
17922
 
17923
17923
  /**
17924
17924
  * @license
@@ -18557,7 +18557,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
18557
18557
  function compileDeclareClassMetadata(metadata) {
18558
18558
  const definitionMap = new DefinitionMap();
18559
18559
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
18560
- definitionMap.set('version', literal('12.0.2'));
18560
+ definitionMap.set('version', literal('12.0.3'));
18561
18561
  definitionMap.set('ngImport', importExpr(Identifiers.core));
18562
18562
  definitionMap.set('type', metadata.type);
18563
18563
  definitionMap.set('decorators', metadata.decorators);
@@ -18597,7 +18597,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
18597
18597
  function createDirectiveDefinitionMap(meta) {
18598
18598
  const definitionMap = new DefinitionMap();
18599
18599
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
18600
- definitionMap.set('version', literal('12.0.2'));
18600
+ definitionMap.set('version', literal('12.0.3'));
18601
18601
  // e.g. `type: MyDirective`
18602
18602
  definitionMap.set('type', meta.internalType);
18603
18603
  // e.g. `selector: 'some-dir'`
@@ -18814,7 +18814,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
18814
18814
  function compileDeclareFactoryFunction(meta) {
18815
18815
  const definitionMap = new DefinitionMap();
18816
18816
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
18817
- definitionMap.set('version', literal('12.0.2'));
18817
+ definitionMap.set('version', literal('12.0.3'));
18818
18818
  definitionMap.set('ngImport', importExpr(Identifiers.core));
18819
18819
  definitionMap.set('type', meta.internalType);
18820
18820
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -18856,7 +18856,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
18856
18856
  function createInjectableDefinitionMap(meta) {
18857
18857
  const definitionMap = new DefinitionMap();
18858
18858
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
18859
- definitionMap.set('version', literal('12.0.2'));
18859
+ definitionMap.set('version', literal('12.0.3'));
18860
18860
  definitionMap.set('ngImport', importExpr(Identifiers.core));
18861
18861
  definitionMap.set('type', meta.internalType);
18862
18862
  // Only generate providedIn property if it has a non-null value
@@ -18935,7 +18935,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
18935
18935
  function createInjectorDefinitionMap(meta) {
18936
18936
  const definitionMap = new DefinitionMap();
18937
18937
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
18938
- definitionMap.set('version', literal('12.0.2'));
18938
+ definitionMap.set('version', literal('12.0.3'));
18939
18939
  definitionMap.set('ngImport', importExpr(Identifiers.core));
18940
18940
  definitionMap.set('type', meta.internalType);
18941
18941
  definitionMap.set('providers', meta.providers);
@@ -18972,7 +18972,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
18972
18972
  function createNgModuleDefinitionMap(meta) {
18973
18973
  const definitionMap = new DefinitionMap();
18974
18974
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
18975
- definitionMap.set('version', literal('12.0.2'));
18975
+ definitionMap.set('version', literal('12.0.3'));
18976
18976
  definitionMap.set('ngImport', importExpr(Identifiers.core));
18977
18977
  definitionMap.set('type', meta.internalType);
18978
18978
  // We only generate the keys in the metadata if the arrays contain values.
@@ -19030,7 +19030,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
19030
19030
  function createPipeDefinitionMap(meta) {
19031
19031
  const definitionMap = new DefinitionMap();
19032
19032
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
19033
- definitionMap.set('version', literal('12.0.2'));
19033
+ definitionMap.set('version', literal('12.0.3'));
19034
19034
  definitionMap.set('ngImport', importExpr(Identifiers.core));
19035
19035
  // e.g. `type: MyPipe`
19036
19036
  definitionMap.set('type', meta.internalType);
@@ -19062,7 +19062,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
19062
19062
  * Use of this source code is governed by an MIT-style license that can be
19063
19063
  * found in the LICENSE file at https://angular.io/license
19064
19064
  */
19065
- const VERSION$2 = new Version('12.0.2');
19065
+ const VERSION$2 = new Version('12.0.3');
19066
19066
 
19067
19067
  /**
19068
19068
  * @license
@@ -19415,14 +19415,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
19415
19415
  const namedNode = node;
19416
19416
  return namedNode.name !== undefined && ts$1.isIdentifier(namedNode.name);
19417
19417
  }
19418
- function isExported(node) {
19419
- let topLevel = node;
19420
- if (ts$1.isVariableDeclaration(node) && ts$1.isVariableDeclarationList(node.parent)) {
19421
- topLevel = node.parent.parent;
19422
- }
19423
- return topLevel.modifiers !== undefined &&
19424
- topLevel.modifiers.some(modifier => modifier.kind === ts$1.SyntaxKind.ExportKeyword);
19425
- }
19426
19418
  function getRootDirs(host, options) {
19427
19419
  const rootDirs = [];
19428
19420
  const cwd = host.getCurrentDirectory();
@@ -21158,6 +21150,32 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
21158
21150
  getAdjacentNameOfClass(clazz) {
21159
21151
  return clazz.name;
21160
21152
  }
21153
+ isStaticallyExported(clazz) {
21154
+ // First check if there's an `export` modifier directly on the class declaration.
21155
+ let topLevel = clazz;
21156
+ if (ts$1.isVariableDeclaration(clazz) && ts$1.isVariableDeclarationList(clazz.parent)) {
21157
+ topLevel = clazz.parent.parent;
21158
+ }
21159
+ if (topLevel.modifiers !== undefined &&
21160
+ topLevel.modifiers.some(modifier => modifier.kind === ts$1.SyntaxKind.ExportKeyword)) {
21161
+ // The node is part of a declaration that's directly exported.
21162
+ return true;
21163
+ }
21164
+ // If `topLevel` is not directly exported via a modifier, then it might be indirectly exported,
21165
+ // e.g.:
21166
+ //
21167
+ // class Foo {}
21168
+ // export {Foo};
21169
+ //
21170
+ // The only way to check this is to look at the module level for exports of the class. As a
21171
+ // performance optimization, this check is only performed if the class is actually declared at
21172
+ // the top level of the file and thus eligible for exporting in the first place.
21173
+ if (topLevel.parent === undefined || !ts$1.isSourceFile(topLevel.parent)) {
21174
+ return false;
21175
+ }
21176
+ const localExports = this.getLocalExportedClassesOfSourceFile(clazz.getSourceFile());
21177
+ return localExports.has(clazz);
21178
+ }
21161
21179
  getDirectImportOfIdentifier(id) {
21162
21180
  const symbol = this.checker.getSymbolAtLocation(id);
21163
21181
  if (symbol === undefined || symbol.declarations === undefined ||
@@ -21358,6 +21376,49 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
21358
21376
  isStatic,
21359
21377
  };
21360
21378
  }
21379
+ /**
21380
+ * Get the set of classes declared in `file` which are exported.
21381
+ */
21382
+ getLocalExportedClassesOfSourceFile(file) {
21383
+ const cacheSf = file;
21384
+ if (cacheSf[LocalExportedClasses] !== undefined) {
21385
+ // TS does not currently narrow symbol-keyed fields, hence the non-null assert is needed.
21386
+ return cacheSf[LocalExportedClasses];
21387
+ }
21388
+ const exportSet = new Set();
21389
+ cacheSf[LocalExportedClasses] = exportSet;
21390
+ const sfSymbol = this.checker.getSymbolAtLocation(cacheSf);
21391
+ if (sfSymbol === undefined || sfSymbol.exports === undefined) {
21392
+ return exportSet;
21393
+ }
21394
+ // Scan the exported symbol of the `ts.SourceFile` for the original `symbol` of the class
21395
+ // declaration.
21396
+ //
21397
+ // Note: when checking multiple classes declared in the same file, this repeats some operations.
21398
+ // In theory, this could be expensive if run in the context of a massive input file (like a
21399
+ // large FESM in ngcc). If performance does become an issue here, it should be possible to
21400
+ // create a `Set<>`
21401
+ // Unfortunately, `ts.Iterator` doesn't implement the iterator protocol, so iteration here is
21402
+ // done manually.
21403
+ const iter = sfSymbol.exports.values();
21404
+ let item = iter.next();
21405
+ while (item.done !== true) {
21406
+ let exportedSymbol = item.value;
21407
+ // If this exported symbol comes from an `export {Foo}` statement, then the symbol is actually
21408
+ // for the export declaration, not the original declaration. Such a symbol will be an alias,
21409
+ // so unwrap aliasing if necessary.
21410
+ if (exportedSymbol.flags & ts$1.SymbolFlags.Alias) {
21411
+ exportedSymbol = this.checker.getAliasedSymbol(exportedSymbol);
21412
+ }
21413
+ if (exportedSymbol.valueDeclaration !== undefined &&
21414
+ exportedSymbol.valueDeclaration.getSourceFile() === file &&
21415
+ this.isClass(exportedSymbol.valueDeclaration)) {
21416
+ exportSet.add(exportedSymbol.valueDeclaration);
21417
+ }
21418
+ item = iter.next();
21419
+ }
21420
+ return exportSet;
21421
+ }
21361
21422
  }
21362
21423
  function reflectTypeEntityToDeclaration(type, checker) {
21363
21424
  let realSymbol = checker.getSymbolAtLocation(type);
@@ -21507,6 +21568,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
21507
21568
  (decl.propertyName !== undefined ? decl.propertyName : decl.name).text :
21508
21569
  originalId.text;
21509
21570
  }
21571
+ const LocalExportedClasses = Symbol('LocalExportedClasses');
21510
21572
 
21511
21573
  /**
21512
21574
  * @license
@@ -24118,7 +24180,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'os', 'typescript', 'fs', '
24118
24180
  this.fileToClasses.get(sf).add(record.node);
24119
24181
  }
24120
24182
  scanClassForTraits(clazz) {
24121
- if (!this.compileNonExportedClasses && !isExported(clazz)) {
24183
+ if (!this.compileNonExportedClasses && !this.reflector.isStaticallyExported(clazz)) {
24122
24184
  return null;
24123
24185
  }
24124
24186
  const decorators = this.reflector.getDecoratorsOfDeclaration(clazz);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.0.2
2
+ * @license Angular v12.0.3
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -19459,7 +19459,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
19459
19459
  * Use of this source code is governed by an MIT-style license that can be
19460
19460
  * found in the LICENSE file at https://angular.io/license
19461
19461
  */
19462
- const VERSION$1 = new Version('12.0.2');
19462
+ const VERSION$1 = new Version('12.0.3');
19463
19463
 
19464
19464
  /**
19465
19465
  * @license
@@ -35527,7 +35527,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
35527
35527
  /**
35528
35528
  * @publicApi
35529
35529
  */
35530
- const VERSION$2 = new Version$1('12.0.2');
35530
+ const VERSION$2 = new Version$1('12.0.3');
35531
35531
 
35532
35532
  /**
35533
35533
  * @license
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/language-service",
3
- "version": "12.0.2",
3
+ "version": "12.0.3",
4
4
  "description": "Angular - language services",
5
5
  "main": "./index.js",
6
6
  "typings": "./index.d.ts",