Skip to content

Commit 6768466

Browse files
clydinKeen Yee Liau
authored andcommitted
feat(@ngtools/webpack): move @angular/compiler-cli to a peer dependency
Now that the package is no longer installed globally, it can now properly use peer dependencies without issue.
1 parent 1e7feb5 commit 6768466

File tree

5 files changed

+20
-117
lines changed

5 files changed

+20
-117
lines changed

packages/ngtools/webpack/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,13 @@
3131
"webpack-sources": "1.2.0"
3232
},
3333
"peerDependencies": {
34+
"@angular/compiler-cli": ">=5.0.0 <8.0.0 || ^7.0.0-beta.0",
3435
"typescript": ">=2.4.0 < 3.1",
3536
"webpack": "^4.0.0"
3637
},
3738
"devDependencies": {
39+
"@angular/compiler": "^7.0.0-beta.4",
40+
"@angular/compiler-cli": "^7.0.0-beta.4",
3841
"typescript": "~3.0.1",
3942
"webpack": "^4.0.0"
4043
}

packages/ngtools/webpack/src/angular_compiler_plugin.ts

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,7 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88
import { Path, dirname, getSystemPath, normalize, resolve, virtualFs } from '@angular-devkit/core';
9-
import { ChildProcess, ForkOptions, fork } from 'child_process';
10-
import * as fs from 'fs';
11-
import * as path from 'path';
12-
import * as ts from 'typescript';
13-
import { Compiler, compilation } from 'webpack';
14-
import { time, timeEnd } from './benchmark';
15-
import { WebpackCompilerHost, workaroundResolve } from './compiler_host';
16-
import { resolveEntryModuleFromMain } from './entry_resolver';
17-
import { gatherDiagnostics, hasErrors } from './gather_diagnostics';
18-
import { LazyRouteMap, findLazyRoutes } from './lazy_routes';
199
import {
20-
CompilerCliIsSupported,
2110
CompilerHost,
2211
CompilerOptions,
2312
DEFAULT_ERROR_CODE,
@@ -32,7 +21,17 @@ import {
3221
createProgram,
3322
formatDiagnostics,
3423
readConfiguration,
35-
} from './ngtools_api';
24+
} from '@angular/compiler-cli';
25+
import { ChildProcess, ForkOptions, fork } from 'child_process';
26+
import * as fs from 'fs';
27+
import * as path from 'path';
28+
import * as ts from 'typescript';
29+
import { Compiler, compilation } from 'webpack';
30+
import { time, timeEnd } from './benchmark';
31+
import { WebpackCompilerHost, workaroundResolve } from './compiler_host';
32+
import { resolveEntryModuleFromMain } from './entry_resolver';
33+
import { gatherDiagnostics, hasErrors } from './gather_diagnostics';
34+
import { LazyRouteMap, findLazyRoutes } from './lazy_routes';
3635
import { resolveWithPaths } from './paths-plugin';
3736
import { WebpackResourceLoader } from './resource_loader';
3837
import {
@@ -152,7 +151,6 @@ export class AngularCompilerPlugin {
152151
}
153152

154153
constructor(options: AngularCompilerPluginOptions) {
155-
CompilerCliIsSupported();
156154
this._options = Object.assign({}, options);
157155
this._setupOptions(this._options);
158156
}

packages/ngtools/webpack/src/gather_diagnostics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
* Use of this source code is governed by an MIT-style license that can be
66
* found in the LICENSE file at https://angular.io/license
77
*/
8+
import { Diagnostic, Diagnostics, Program } from '@angular/compiler-cli';
89
import * as ts from 'typescript';
910
import { time, timeEnd } from './benchmark';
10-
import { Diagnostic, Diagnostics, Program } from './ngtools_api';
1111

1212

1313
export class CancellationToken implements ts.CancellationToken {

packages/ngtools/webpack/src/ngtools_api.ts

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

packages/ngtools/webpack/src/type_checker.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
*/
88
import { terminal } from '@angular-devkit/core';
99
import { NodeJsSyncHost } from '@angular-devkit/core/node';
10-
import * as ts from 'typescript';
11-
import { time, timeEnd } from './benchmark';
12-
import { WebpackCompilerHost } from './compiler_host';
13-
import { CancellationToken, gatherDiagnostics } from './gather_diagnostics';
1410
import {
1511
CompilerHost,
1612
CompilerOptions,
1713
Program,
1814
createCompilerHost,
1915
createProgram,
2016
formatDiagnostics,
21-
} from './ngtools_api';
17+
} from '@angular/compiler-cli';
18+
import * as ts from 'typescript';
19+
import { time, timeEnd } from './benchmark';
20+
import { WebpackCompilerHost } from './compiler_host';
21+
import { CancellationToken, gatherDiagnostics } from './gather_diagnostics';
2222

2323

2424
// This file should run in a child process with the AUTO_START_ARG argument

0 commit comments

Comments
 (0)