fix(language-service): Remove tsserverlibrary from rollup globals (#30123)
This PR removes `tsserverlibrary` from rollup globals since the symbol should not appear by the time rollup is invoked. `tsserverlibrary` is used for types only, so the import statement should not be emitted by tsc. PR Close #30123
This commit is contained in:
parent
fc2dd5482e
commit
124e49752f
@ -7,7 +7,6 @@ ls_rollup_bundle(
|
|||||||
"fs": "fs",
|
"fs": "fs",
|
||||||
"path": "path",
|
"path": "path",
|
||||||
"typescript": "ts",
|
"typescript": "ts",
|
||||||
"typescript/lib/tsserverlibrary": "tsserverlibrary",
|
|
||||||
},
|
},
|
||||||
license_banner = "banner.js.txt",
|
license_banner = "banner.js.txt",
|
||||||
visibility = ["//packages/language-service:__pkg__"],
|
visibility = ["//packages/language-service:__pkg__"],
|
||||||
|
@ -6,15 +6,16 @@
|
|||||||
* found in the LICENSE file at https://angular.io/license
|
* found in the LICENSE file at https://angular.io/license
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as ts from 'typescript/lib/tsserverlibrary';
|
import * as ts from 'typescript'; // used as value, passed in by tsserver at runtime
|
||||||
|
import * as tss from 'typescript/lib/tsserverlibrary'; // used as type only
|
||||||
|
|
||||||
import {createLanguageService} from './language_service';
|
import {createLanguageService} from './language_service';
|
||||||
import {Completion, Diagnostic, DiagnosticMessageChain} from './types';
|
import {Completion, Diagnostic, DiagnosticMessageChain} from './types';
|
||||||
import {TypeScriptServiceHost} from './typescript_host';
|
import {TypeScriptServiceHost} from './typescript_host';
|
||||||
|
|
||||||
const projectHostMap = new WeakMap<ts.server.Project, TypeScriptServiceHost>();
|
const projectHostMap = new WeakMap<tss.server.Project, TypeScriptServiceHost>();
|
||||||
|
|
||||||
export function getExternalFiles(project: ts.server.Project): string[]|undefined {
|
export function getExternalFiles(project: tss.server.Project): string[]|undefined {
|
||||||
const host = projectHostMap.get(project);
|
const host = projectHostMap.get(project);
|
||||||
if (host) {
|
if (host) {
|
||||||
const externalFiles = host.getTemplateReferences();
|
const externalFiles = host.getTemplateReferences();
|
||||||
@ -63,7 +64,7 @@ function diagnosticToDiagnostic(d: Diagnostic, file: ts.SourceFile): ts.Diagnost
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function create(info: ts.server.PluginCreateInfo): ts.LanguageService {
|
export function create(info: tss.server.PluginCreateInfo): ts.LanguageService {
|
||||||
const oldLS: ts.LanguageService = info.languageService;
|
const oldLS: ts.LanguageService = info.languageService;
|
||||||
const proxy: ts.LanguageService = Object.assign({}, oldLS);
|
const proxy: ts.LanguageService = Object.assign({}, oldLS);
|
||||||
const logger = info.project.projectService.logger;
|
const logger = info.project.projectService.logger;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user