Skip to content

Commit e882dd4

Browse files
authored
build: update dependency to latest v13 release and fix errors (#1516)
* build: update dependency to latest v13 release and fix errors The latest v13 release of the language service removes the option to disable Ivy from the `PluginConfig`. This commit also removes it from the session configuration, but does not add a workaround to continue supporting View Engine. That will need to be done before the v13 release. In addition, the `esModuleInterop` option was enabled, which matches the angular/angular repo. This addresses another build issue due to default import/exports. * fixup! build: update dependency to latest v13 release and fix errors
1 parent f18b5ac commit e882dd4

File tree

13 files changed

+76
-60
lines changed

13 files changed

+76
-60
lines changed

integration/lsp/ivy_spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ describe('Angular Ivy language server', () => {
180180
}))!;
181181
expect(response).not.toBeNull();
182182
expect(response.signatures.length).toEqual(1);
183-
expect(response.signatures[0].label).toEqual('toString(): string');
183+
expect(response.signatures[0].label).toEqual('(): string');
184184
});
185185

186186
it('should show signature help with multiple arguments', async () => {
@@ -203,7 +203,7 @@ describe('Angular Ivy language server', () => {
203203
expect(response).not.toBeNull();
204204
expect(response.signatures.length).toEqual(1);
205205
expect(response.signatures[0].label)
206-
.toEqual('substr(from: number, length?: number | undefined): string');
206+
.toEqual('(from: number, length?: number | undefined): string');
207207
expect(response.signatures[0].parameters).not.toBeUndefined();
208208
expect(response.activeParameter).toBe(1);
209209

integration/lsp/viewengine_spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ import {APP_COMPONENT, FOO_TEMPLATE} from '../test_constants';
1313

1414
import {createConnection, initializeServer, openTextDocument} from './test_utils';
1515

16-
describe('Angular language server', () => {
16+
// TODO(atscott): re-enable when we have a solution in place to continue to support View Engine
17+
xdescribe('Angular language server', () => {
1718
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; /* 10 seconds */
1819

1920
let client: MessageConnection;

integration/tsconfig.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,19 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../dist/integration",
5-
"rootDirs": ["..", "dist"]
5+
"rootDirs": [
6+
"..",
7+
"dist"
8+
]
69
},
710
"references": [
8-
{ "path": "../server/tsconfig.json" }
11+
{
12+
"path": "../server/tsconfig.json"
13+
}
914
],
1015
"include": [
1116
"test_constants.ts",
1217
"e2e",
1318
"lsp"
1419
]
15-
}
20+
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@
183183
"test:syntaxes": "yarn compile:syntaxes-test && yarn build:syntaxes && jasmine dist/syntaxes/test/driver.js"
184184
},
185185
"dependencies": {
186-
"@angular/language-service": "13.0.0-next.3",
186+
"@angular/language-service": "13.0.0-next.9",
187187
"typescript": "4.4.3",
188188
"vscode-jsonrpc": "6.0.0",
189189
"vscode-languageclient": "7.0.0",
@@ -211,4 +211,4 @@
211211
"type": "git",
212212
"url": "https://github.com/angular/vscode-ng-language-service"
213213
}
214-
}
214+
}

server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
"ngserver": "./bin/ngserver"
1616
},
1717
"dependencies": {
18-
"@angular/language-service": "13.0.0-next.3",
18+
"@angular/language-service": "13.0.0-next.9",
1919
"vscode-jsonrpc": "6.0.0",
2020
"vscode-languageserver": "7.0.0",
2121
"vscode-uri": "3.0.2"
2222
},
2323
"publishConfig": {
2424
"registry": "https://wombat-dressing-room.appspot.com"
2525
}
26-
}
26+
}

server/src/session.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
*/
88

99
import {isNgLanguageService, NgLanguageService, PluginConfig} from '@angular/language-service/api';
10-
import * as assert from 'assert';
1110
import * as ts from 'typescript/lib/tsserverlibrary';
1211
import {promisify} from 'util';
1312
import * as lsp from 'vscode-languageserver/node';
@@ -146,12 +145,14 @@ export class Session {
146145
}
147146
});
148147

148+
// TODO(atscott): The Ivy flag was removed in v13. We need to include a legacy version (some
149+
// v12) of the language service in order to continue supporting view engine.
149150
const pluginConfig: PluginConfig = {
151+
ivy: true,
150152
angularOnly: true,
151-
ivy: options.ivy,
152153
};
153154
if (options.host.isG3) {
154-
assert(options.ivy === true, 'Ivy LS must be used in google3');
155+
options.ivy = true;
155156
pluginConfig.forceStrictTemplates = true;
156157
}
157158
projSvc.configurePlugin({

server/src/tests/tsconfig.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
{
22
"extends": "../../../tsconfig.json",
33
"compilerOptions": {
4-
"outDir": "../../../dist/server/tests"
4+
"outDir": "../../../dist/server/tests",
5+
"esModuleInterop": false
56
},
67
"references": [
7-
{ "path": "../../tsconfig.json" }
8+
{
9+
"path": "../../tsconfig.json"
10+
}
811
],
9-
"include": ["*.ts"]
10-
}
12+
"include": [
13+
"*.ts"
14+
]
15+
}

server/src/version_provider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import * as path from 'path';
1111

1212
import {NodeModule, resolve, Version} from '../common/resolver';
1313

14-
const MIN_TS_VERSION = '4.2';
15-
const MIN_NG_VERSION = '12.0';
14+
const MIN_TS_VERSION = '4.3';
15+
const MIN_NG_VERSION = '13.0';
1616
const TSSERVERLIB = 'typescript/lib/tsserverlibrary';
1717

1818
/**

syntaxes/test/cases.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

syntaxes/test/cases.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
export const cases = [
2+
{
3+
'name': 'inline template',
4+
'scopeName': 'inline-template.ng',
5+
'grammarFiles':
6+
['syntaxes/inline-template.json', 'syntaxes/template.json', 'syntaxes/expression.json'],
7+
'testFile': 'syntaxes/test/data/inline-template.ts'
8+
},
9+
{
10+
'name': 'inline styles',
11+
'scopeName': 'inline-styles.ng',
12+
'grammarFiles': ['syntaxes/inline-styles.json'],
13+
'testFile': 'syntaxes/test/data/inline-styles.ts'
14+
},
15+
{
16+
'name': 'template syntax',
17+
'scopeName': 'template.ng',
18+
'grammarFiles': ['syntaxes/template.json', 'syntaxes/expression.json'],
19+
'testFile': 'syntaxes/test/data/template.html'
20+
},
21+
{
22+
'name': 'expression syntax',
23+
'scopeName': 'template.ng',
24+
'grammarFiles': ['syntaxes/template.json', 'syntaxes/expression.json'],
25+
'testFile': 'syntaxes/test/data/expression.html'
26+
}
27+
];

syntaxes/test/driver.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import 'jasmine';
1010
import * as cp from 'child_process';
1111
import * as fs from 'fs';
1212
import * as path from 'path';
13-
import * as SNAPSHOT_TEST_CASES from './cases.json';
13+
import {cases} from './cases';
1414

1515
interface TestCase {
1616
name: string;
@@ -48,7 +48,7 @@ async function snapshotTest({scopeName, grammarFiles, testFile}: TestCase): Prom
4848
}
4949

5050
describe('snapshot tests', () => {
51-
for (let tc of SNAPSHOT_TEST_CASES) {
51+
for (let tc of cases) {
5252
it(`should work for ${tc.name}`, async () => {
5353
const ec = await snapshotTest(tc);
5454
expect(ec).toBe(0);

tsconfig.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,19 @@
44
"module": "commonjs",
55
"moduleResolution": "node",
66
"sourceMap": true,
7-
"strict": true
7+
"strict": true,
8+
"esModuleInterop": true
89
},
910
"files": [],
1011
"references": [
11-
{ "path": "./client" },
12-
{ "path": "./server" },
13-
{ "path": "./syntaxes" }
12+
{
13+
"path": "./client"
14+
},
15+
{
16+
"path": "./server"
17+
},
18+
{
19+
"path": "./syntaxes"
20+
}
1421
]
15-
}
22+
}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@
5252
yaml "^1.10.0"
5353
yargs "^17.0.0"
5454

55-
"@angular/[email protected].3":
56-
version "13.0.0-next.3"
57-
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-13.0.0-next.3.tgz#80aa3c0f0c1bfeabb04b11ba1a889461f0979cfc"
58-
integrity sha512-etqLlMX0twVI2lZZhS4Kt3gEOmqq4FiAXEMSmpklJaXqKa4qVUrOqjgkNeAXr3vw/d/Knb4DVn7AQiIUoNNLgg==
55+
"@angular/[email protected].9":
56+
version "13.0.0-next.9"
57+
resolved "https://registry.yarnpkg.com/@angular/language-service/-/language-service-13.0.0-next.9.tgz#4a7ad7b1d703d41354796a918b46555d7e31a497"
58+
integrity sha512-QuxolblOcGFXP/wPBIM4HRZ6HaFtOAGhwy4L5ZMaYGLsPIQ2nSYkicHy2pTiVwxNpXmfwSc80c11XrJTVPqBTQ==
5959

6060
"@babel/code-frame@^7.0.0":
6161
version "7.12.13"

0 commit comments

Comments
 (0)