Skip to content

Commit

Permalink
refactor(language-service): Replace tsserverlibrary -> typescript
Browse files Browse the repository at this point in the history
Typescript recently consolidated `tsserverlibrary` into `typescript`: [blog post](https://devblogs.microsoft.com/typescript/announcing-typescript-5-3/#consolidation-between-tsserverlibrary-js-and-typescript-js)

In this commit, we remove all references to `tsserverlibrary` accordingly. This should be safe, since v18 and later support TS 5.3+.
  • Loading branch information
dylhunn committed Mar 6, 2024
1 parent 3b1ab20 commit ac78398
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 23 deletions.
3 changes: 1 addition & 2 deletions packages/language-service/bundles/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ module.exports = function(provided) {
if (m === 'exports') {
return results;
}
if (m === 'typescript' || m === 'typescript/lib/tsserverlibrary') {
if (m === 'typescript') {
return ts;
}
return require(m);
Expand All @@ -49,7 +49,6 @@ const external = [
'fs',
'path',
'typescript',
'typescript/lib/tsserverlibrary',
];

const config = {
Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/override_rename_ts_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

function isAngularCore(path: string): boolean {
return isExternalAngularCore(path) || isInternalAngularCore(path);
Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/plugin-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {NgLanguageService, PluginConfig} from './api';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/src/adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {AbsoluteFsPath, FileStats, PathSegment, PathString} from '@angular/compi
import {isShim} from '@angular/compiler-cli/src/ngtsc/shims';
import {getRootDirs} from '@angular/compiler-cli/src/ngtsc/util/src/typescript';
import * as p from 'path';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {isTypeScriptFile} from './utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/src/codefixes/code_fixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {NgCompiler} from '@angular/compiler-cli/src/ngtsc/core';
import tss from 'typescript/lib/tsserverlibrary';
import tss from 'typescript';

import {TemplateInfo} from '../utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {TmplAstBoundEvent} from '@angular/compiler';
import {ErrorCode, ngErrorCode} from '@angular/compiler-cli/src/ngtsc/diagnostics';
import tss from 'typescript/lib/tsserverlibrary';
import tss from 'typescript';

import {getTargetAtPosition, TargetNodeKind} from '../template_target';
import {getTemplateInfoAtPosition, TemplateInfo} from '../utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import ts from 'typescript';
import tss from 'typescript/lib/tsserverlibrary';
import tss from 'typescript';

import {getTargetAtPosition, getTcbNodesOfTemplateAtPosition, TargetNodeKind} from '../template_target';
import {getTemplateInfoAtPosition} from '../utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/src/codefixes/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {absoluteFrom} from '@angular/compiler-cli';
import {NgCompiler} from '@angular/compiler-cli/src/ngtsc/core';
import tss from 'typescript/lib/tsserverlibrary';
import tss from 'typescript';

import {TemplateInfo} from '../utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/src/language_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {PerfPhase} from '@angular/compiler-cli/src/ngtsc/perf';
import {FileUpdate, ProgramDriver} from '@angular/compiler-cli/src/ngtsc/program_driver';
import {isNamedClassDeclaration} from '@angular/compiler-cli/src/ngtsc/reflection';
import {OptimizeFor} from '@angular/compiler-cli/src/ngtsc/typecheck/api';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {GetComponentLocationsForTemplateResponse, GetTcbResponse, GetTemplateLocationForComponentResponse, PluginConfig} from '../api';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/src/signature_help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {Call, SafeCall} from '@angular/compiler';
import {NgCompiler} from '@angular/compiler-cli/src/ngtsc/core';
import {getSourceFileOrError} from '@angular/compiler-cli/src/ngtsc/file_system';
import {SymbolKind} from '@angular/compiler-cli/src/ngtsc/typecheck/api';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {getTargetAtPosition, TargetNodeKind} from './template_target';
import {findTightestNode} from './ts_utils';
Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/src/template_target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {AbsoluteSourceSpan, AST, ASTWithSource, Call, ImplicitReceiver, ParseSourceSpan, ParseSpan, PropertyRead, RecursiveAstVisitor, SafeCall, TmplAstBoundAttribute, TmplAstBoundDeferredTrigger, TmplAstBoundEvent, TmplAstBoundText, TmplAstContent, TmplAstDeferredBlock, TmplAstDeferredBlockError, TmplAstDeferredBlockLoading, TmplAstDeferredBlockPlaceholder, TmplAstDeferredTrigger, TmplAstElement, TmplAstForLoopBlock, TmplAstForLoopBlockEmpty, TmplAstIcu, TmplAstIfBlock, TmplAstIfBlockBranch, TmplAstNode, TmplAstReference, TmplAstSwitchBlock, TmplAstSwitchBlockCase, TmplAstTemplate, TmplAstText, TmplAstTextAttribute, TmplAstUnknownBlock, TmplAstVariable, tmplAstVisitAll, TmplAstVisitor} from '@angular/compiler';
import {NgCompiler} from '@angular/compiler-cli/src/ngtsc/core';
import {findFirstMatchingNode} from '@angular/compiler-cli/src/ngtsc/typecheck/src/comments';
import tss from 'typescript/lib/tsserverlibrary';
import tss from 'typescript';

import {isBoundEventWithSyntheticHandler, isTemplateNodeWithKeyAndValue, isWithin, isWithinKeyValue, TemplateInfo} from './utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/src/ts_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {GetComponentLocationsForTemplateResponse, GetTcbResponse, GetTemplateLocationForComponentResponse, isNgLanguageService, NgLanguageService} from '../api';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/test/adapters_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {LSParseConfigHost} from '../src/adapters';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {APP_COMPONENT, MockService, setup, TEST_TEMPLATE} from './mock_host';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {ErrorCode, ngErrorCode} from '@angular/compiler-cli/src/ngtsc/diagnostics';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {LanguageService} from '../../src/language_service';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/test/legacy/mock_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {NgCompilerOptions} from '@angular/compiler-cli/src/ngtsc/core/api';
import {join} from 'path';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {isTypeScriptFile} from '../../src/utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/test/legacy/mock_host_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {APP_COMPONENT, APP_MAIN, MockService, setup, TEST_SRCDIR} from './mock_host';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/test/quick_info_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*/

import {initMockFileSystem} from '@angular/compiler-cli/src/ngtsc/file_system/testing';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {createModuleAndProjectWithDeclarations, LanguageServiceTestEnv, Project} from '../testing';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/testing/src/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {LanguageService} from '../../src/language_service';

Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/testing/src/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {getFileSystem} from '@angular/compiler-cli/src/ngtsc/file_system';
import {MockFileSystem} from '@angular/compiler-cli/src/ngtsc/file_system/testing';
import {loadStandardTestFiles} from '@angular/compiler-cli/src/ngtsc/testing';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {MockServerHost} from './host';
import {Project, ProjectFiles, TestableOptions} from './project';
Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/testing/src/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {absoluteFrom} from '@angular/compiler-cli/src/ngtsc/file_system';
import {MockFileSystem} from '@angular/compiler-cli/src/ngtsc/file_system/testing';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

const NOOP_FILE_WATCHER: ts.FileWatcher = {
close() {}
Expand Down
2 changes: 1 addition & 1 deletion packages/language-service/testing/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {InternalOptions, LegacyNgcOptions, StrictTemplateOptions} from '@angular/compiler-cli/src/ngtsc/core/api';
import {absoluteFrom, AbsoluteFsPath, FileSystem, getFileSystem, getSourceFileOrError} from '@angular/compiler-cli/src/ngtsc/file_system';
import {OptimizeFor, TemplateTypeChecker} from '@angular/compiler-cli/src/ngtsc/typecheck/api';
import ts from 'typescript/lib/tsserverlibrary';
import ts from 'typescript';

import {LanguageService} from '../../src/language_service';

Expand Down

0 comments on commit ac78398

Please sign in to comment.