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.
This commit is contained in:
parent
75d484e29d
commit
bc22ff1517
|
@ -9,6 +9,11 @@ source scripts/env.sh
|
||||||
HOST="node tools/typescript_host.js"
|
HOST="node tools/typescript_host.js"
|
||||||
VALIDATE="node tools/typescript_validator.js"
|
VALIDATE="node tools/typescript_validator.js"
|
||||||
|
|
||||||
|
# Ensure the languages service can load correctly in node before typescript loads it.
|
||||||
|
# This verifies its dependencies and emits any exceptions, both of which are only
|
||||||
|
# emitted to the typescript logs (not the validated output).
|
||||||
|
node tools/load_test.js
|
||||||
|
|
||||||
for TYPESCRIPT in ${TYPESCRIPTS[@]}
|
for TYPESCRIPT in ${TYPESCRIPTS[@]}
|
||||||
do
|
do
|
||||||
SERVER="node typescripts/$TYPESCRIPT/node_modules/typescript/lib/tsserver.js"
|
SERVER="node typescripts/$TYPESCRIPT/node_modules/typescript/lib/tsserver.js"
|
||||||
|
|
|
@ -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);
|
|
@ -13,6 +13,7 @@
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"typescript_host.ts",
|
"typescript_host.ts",
|
||||||
"typescript_validator.ts"
|
"typescript_validator.ts",
|
||||||
|
"load_test.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -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';
|
|
@ -33,6 +33,7 @@
|
||||||
"index.ts",
|
"index.ts",
|
||||||
"src/main.ts",
|
"src/main.ts",
|
||||||
"src/extract_i18n.ts",
|
"src/extract_i18n.ts",
|
||||||
|
"src/language_services.ts",
|
||||||
"../../node_modules/@types/node/index.d.ts",
|
"../../node_modules/@types/node/index.d.ts",
|
||||||
"../../node_modules/@types/jasmine/index.d.ts",
|
"../../node_modules/@types/jasmine/index.d.ts",
|
||||||
"../../node_modules/zone.js/dist/zone.js.d.ts"
|
"../../node_modules/zone.js/dist/zone.js.d.ts"
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AST, AstPath, AttrAst, Attribute, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, CssSelector, DirectiveAst, Element, ElementAst, EmbeddedTemplateAst, ImplicitReceiver, NAMED_ENTITIES, NgContentAst, Node as HtmlAst, NullTemplateVisitor, ParseSpan, PropertyRead, ReferenceAst, SelectorMatcher, TagContentType, TemplateAst, TemplateAstVisitor, Text, TextAst, VariableAst, findNode, getHtmlTagDefinition, splitNsName, templateVisitAll} from '@angular/compiler';
|
import {AST, AstPath, AttrAst, Attribute, BoundDirectivePropertyAst, BoundElementPropertyAst, BoundEventAst, BoundTextAst, CssSelector, DirectiveAst, Element, ElementAst, EmbeddedTemplateAst, ImplicitReceiver, NAMED_ENTITIES, NgContentAst, Node as HtmlAst, NullTemplateVisitor, ParseSpan, PropertyRead, ReferenceAst, SelectorMatcher, TagContentType, TemplateAst, TemplateAstVisitor, Text, TextAst, VariableAst, findNode, getHtmlTagDefinition, splitNsName, templateVisitAll} from '@angular/compiler';
|
||||||
import {DiagnosticTemplateInfo, getExpressionScope} from '@angular/compiler-cli';
|
import {DiagnosticTemplateInfo, getExpressionScope} from '@angular/compiler-cli/src/language_services';
|
||||||
|
|
||||||
import {AstResult, AttrInfo, SelectorInfo, TemplateInfo} from './common';
|
import {AstResult, AttrInfo, SelectorInfo, TemplateInfo} from './common';
|
||||||
import {getExpressionCompletions} from './expressions';
|
import {getExpressionCompletions} from './expressions';
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {NgAnalyzedModules, StaticSymbol} from '@angular/compiler';
|
import {NgAnalyzedModules, StaticSymbol} from '@angular/compiler';
|
||||||
import {DiagnosticTemplateInfo, getTemplateExpressionDiagnostics} from '@angular/compiler-cli';
|
import {DiagnosticTemplateInfo, getTemplateExpressionDiagnostics} from '@angular/compiler-cli/src/language_services';
|
||||||
|
|
||||||
import {AstResult} from './common';
|
import {AstResult} from './common';
|
||||||
import {Declarations, Diagnostic, DiagnosticKind, Diagnostics, Span, TemplateSource} from './types';
|
import {Declarations, Diagnostic, DiagnosticKind, Diagnostics, Span, TemplateSource} from './types';
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AST, ASTWithSource, AstPath as AstPathBase, NullAstVisitor, visitAstChildren} from '@angular/compiler';
|
import {AST, ASTWithSource, AstPath as AstPathBase, NullAstVisitor, visitAstChildren} from '@angular/compiler';
|
||||||
import {AstType} from '@angular/compiler-cli';
|
import {AstType} from '@angular/compiler-cli/src/language_services';
|
||||||
|
|
||||||
import {BuiltinType, Span, Symbol, SymbolQuery, SymbolTable} from './types';
|
import {BuiltinType, Span, Symbol, SymbolQuery, SymbolTable} from './types';
|
||||||
import {inSpan} from './utils';
|
import {inSpan} from './utils';
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AST, Attribute, BoundDirectivePropertyAst, BoundEventAst, ElementAst, TemplateAst, TemplateAstPath, findNode, tokenReference} from '@angular/compiler';
|
import {AST, Attribute, BoundDirectivePropertyAst, BoundEventAst, ElementAst, TemplateAst, TemplateAstPath, findNode, tokenReference} from '@angular/compiler';
|
||||||
import {getExpressionScope} from '@angular/compiler-cli';
|
import {getExpressionScope} from '@angular/compiler-cli/src/language_services';
|
||||||
|
|
||||||
import {TemplateInfo} from './common';
|
import {TemplateInfo} from './common';
|
||||||
import {getExpressionSymbol} from './expressions';
|
import {getExpressionSymbol} from './expressions';
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AngularCompilerOptions, AotCompilerHost, CompilerHost, ModuleResolutionHostAdapter} from '@angular/compiler-cli';
|
import {AotCompilerHost} from '@angular/compiler';
|
||||||
|
import {AngularCompilerOptions, CompilerHost, ModuleResolutionHostAdapter} from '@angular/compiler-cli/src/language_services';
|
||||||
import * as ts from 'typescript';
|
import * as ts from 'typescript';
|
||||||
|
|
||||||
class ReflectorModuleModuleResolutionHost implements ts.ModuleResolutionHost {
|
class ReflectorModuleModuleResolutionHost implements ts.ModuleResolutionHost {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {CompileDirectiveMetadata, CompileMetadataResolver, CompilePipeSummary, NgAnalyzedModules, StaticSymbol} from '@angular/compiler';
|
import {CompileDirectiveMetadata, CompileMetadataResolver, CompilePipeSummary, NgAnalyzedModules, StaticSymbol} from '@angular/compiler';
|
||||||
import {BuiltinType, DeclarationKind, Definition, PipeInfo, Pipes, Signature, Span, Symbol, SymbolDeclaration, SymbolQuery, SymbolTable} from '@angular/compiler-cli';
|
import {BuiltinType, DeclarationKind, Definition, PipeInfo, Pipes, Signature, Span, Symbol, SymbolDeclaration, SymbolQuery, SymbolTable} from '@angular/compiler-cli/src/language_services';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
BuiltinType,
|
BuiltinType,
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AotSummaryResolver, CompileMetadataResolver, CompilerConfig, DEFAULT_INTERPOLATION_CONFIG, DirectiveNormalizer, DirectiveResolver, DomElementSchemaRegistry, HtmlParser, InterpolationConfig, JitSummaryResolver, NgAnalyzedModules, NgModuleResolver, ParseTreeResult, PipeResolver, ResourceLoader, StaticReflector, StaticSymbol, StaticSymbolCache, StaticSymbolResolver, SummaryResolver, analyzeNgModules, createOfflineCompileUrlResolver, extractProgramSymbols} from '@angular/compiler';
|
import {AotSummaryResolver, CompileMetadataResolver, CompilerConfig, DEFAULT_INTERPOLATION_CONFIG, DirectiveNormalizer, DirectiveResolver, DomElementSchemaRegistry, HtmlParser, InterpolationConfig, JitSummaryResolver, NgAnalyzedModules, NgModuleResolver, ParseTreeResult, PipeResolver, ResourceLoader, StaticReflector, StaticSymbol, StaticSymbolCache, StaticSymbolResolver, SummaryResolver, analyzeNgModules, createOfflineCompileUrlResolver, extractProgramSymbols} from '@angular/compiler';
|
||||||
import {AngularCompilerOptions, getClassMembersFromDeclaration, getPipesTable, getSymbolQuery} from '@angular/compiler-cli';
|
import {AngularCompilerOptions, getClassMembersFromDeclaration, getPipesTable, getSymbolQuery} from '@angular/compiler-cli/src/language_services';
|
||||||
import {ViewEncapsulation, ɵConsole as Console} from '@angular/core';
|
import {ViewEncapsulation, ɵConsole as Console} from '@angular/core';
|
||||||
import * as fs from 'fs';
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import {AstPath, CompileDirectiveSummary, CompileTypeMetadata, CssSelector, DirectiveAst, ElementAst, EmbeddedTemplateAst, HtmlAstPath, Node as HtmlNode, ParseSourceSpan, RecursiveTemplateAstVisitor, RecursiveVisitor, TemplateAst, TemplateAstPath, identifierName, templateVisitAll, visitAll} from '@angular/compiler';
|
import {AstPath, CompileDirectiveSummary, CompileTypeMetadata, CssSelector, DirectiveAst, ElementAst, EmbeddedTemplateAst, HtmlAstPath, Node as HtmlNode, ParseSourceSpan, RecursiveTemplateAstVisitor, RecursiveVisitor, TemplateAst, TemplateAstPath, identifierName, templateVisitAll, visitAll} from '@angular/compiler';
|
||||||
import {DiagnosticTemplateInfo} from '@angular/compiler-cli';
|
import {DiagnosticTemplateInfo} from '@angular/compiler-cli/src/language_services';
|
||||||
import * as ts from 'typescript';
|
import * as ts from 'typescript';
|
||||||
|
|
||||||
import {SelectorInfo, TemplateInfo} from './common';
|
import {SelectorInfo, TemplateInfo} from './common';
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
"@angular/common": ["../../dist/packages/common"],
|
"@angular/common": ["../../dist/packages/common"],
|
||||||
"@angular/compiler": ["../../dist/packages/compiler"],
|
"@angular/compiler": ["../../dist/packages/compiler"],
|
||||||
"@angular/compiler-cli": ["../../dist/packages/compiler-cli"],
|
"@angular/compiler-cli": ["../../dist/packages/compiler-cli"],
|
||||||
|
"@angular/compiler-cli/*": ["../../dist/packages/compiler-cli/*"],
|
||||||
"@angular/http": ["../../dist/packages/http"],
|
"@angular/http": ["../../dist/packages/http"],
|
||||||
"@angular/platform-server": ["../../dist/packages/platform-server"],
|
"@angular/platform-server": ["../../dist/packages/platform-server"],
|
||||||
"@angular/platform-browser": ["../../dist/packages/platform-browser"],
|
"@angular/platform-browser": ["../../dist/packages/platform-browser"],
|
||||||
|
|
Loading…
Reference in New Issue