Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(language-service): remove tsickle dependency
Removes the tsickle dependency added when tsickle was added to the transform compiler. Added a test to ensure stray dependencies are not added and no errors are introduced during module flattening.
- Loading branch information
Showing
14 changed files
with
77 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
const ts = require('typescript'); | ||
const Module = require('module'); | ||
|
||
const existingRequire = Module.prototype.require; | ||
|
||
const recordedRequires: string[] = []; | ||
|
||
function recordingRequire(path: string) { | ||
recordedRequires.push(path); | ||
return existingRequire.call(this, path); | ||
} | ||
|
||
Module.prototype.require = recordingRequire; | ||
|
||
try { | ||
const lsf = require('@angular/language-service'); | ||
const ls = lsf({typescript: ts}); | ||
|
||
// Assert that the only module that should have been required are '@angular/langauge-service', 'fs', and 'path' | ||
|
||
const allowedLoads = new Set(["@angular/language-service", "fs", "path"]); | ||
|
||
const invalidModules = recordedRequires.filter(m => !allowedLoads.has(m)); | ||
|
||
if (invalidModules.length > 0) { | ||
console.error(`FAILED: Loading the language service required: ${invalidModules.join(', ')}`); | ||
process.exit(1); | ||
} | ||
} catch (e) { | ||
console.error(`FAILED: Loading the language service caused the following exception: ${e.stack || e}`); | ||
process.exit(1); | ||
} | ||
|
||
console.log('SUCCESS: Loading passed') | ||
process.exit(0); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
}, | ||
"files": [ | ||
"typescript_host.ts", | ||
"typescript_validator.ts" | ||
"typescript_validator.ts", | ||
"load_test.ts" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* @license | ||
* Copyright Google Inc. All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
/* | ||
The API from compiler-cli that language-service can see. | ||
It is important that none the exported modules require anything other than | ||
Angular modules and Typescript as this will indirectly add a dependency | ||
to the language service. | ||
*/ | ||
|
||
export {AngularCompilerOptions} from '@angular/tsc-wrapped'; | ||
export {CompilerHost, CompilerHostContext, MetadataProvider, ModuleResolutionHostAdapter, NodeCompilerHostContext} from './compiler_host'; | ||
export {TypeChecker} from './diagnostics/check_types'; | ||
export {DiagnosticTemplateInfo, ExpressionDiagnostic, getExpressionDiagnostics, getExpressionScope, getTemplateExpressionDiagnostics} from './diagnostics/expression_diagnostics'; | ||
export {AstType, DiagnosticKind, ExpressionDiagnosticsContext, TypeDiagnostic} from './diagnostics/expression_type'; | ||
export {BuiltinType, DeclarationKind, Definition, Location, PipeInfo, Pipes, Signature, Span, Symbol, SymbolDeclaration, SymbolQuery, SymbolTable} from './diagnostics/symbols'; | ||
export {getClassFromStaticSymbol, getClassMembers, getClassMembersFromDeclaration, getPipesTable, getSymbolQuery} from './diagnostics/typescript_symbols'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters