Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@ngtools/webpack): update supported compiler-cli supported version #14504

Merged
merged 2 commits into from
May 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 8 additions & 19 deletions packages/ngtools/webpack/src/angular_compiler_plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export class AngularCompilerPlugin {
}

static isSupported() {
return VERSION && parseInt(VERSION.major) >= 5;
return VERSION && parseInt(VERSION.major) >= 8;
}

private _setupOptions(options: AngularCompilerPluginOptions) {
Expand Down Expand Up @@ -659,24 +659,13 @@ export class AngularCompilerPlugin {

let ngccProcessor: NgccProcessor | undefined;
if (this._compilerOptions.enableIvy) {
let ngcc: typeof import('@angular/compiler-cli/ngcc') | undefined;
try {
// this is done for the sole reason that @ngtools/webpack
// support versions of Angular that don't have NGCC API
ngcc = require('@angular/compiler-cli/ngcc');
} catch {
}

if (ngcc) {
ngccProcessor = new NgccProcessor(
ngcc,
this._mainFields,
compilerWithFileSystems.inputFileSystem,
this._warnings,
this._errors,
this._basePath,
);
}
ngccProcessor = new NgccProcessor(
this._mainFields,
compilerWithFileSystems.inputFileSystem,
this._warnings,
this._errors,
this._basePath,
);
}

// Create the webpack compiler host.
Expand Down
5 changes: 2 additions & 3 deletions packages/ngtools/webpack/src/ngcc_processor.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 { Logger } from '@angular/compiler-cli/ngcc';
import { Logger, process as mainNgcc } from '@angular/compiler-cli/ngcc';
import { existsSync } from 'fs';
import * as path from 'path';
import * as ts from 'typescript';
Expand All @@ -29,7 +29,6 @@ export class NgccProcessor {
private _nodeModulesDirectory: string;

constructor(
private readonly ngcc: typeof import('@angular/compiler-cli/ngcc'),
private readonly propertiesToConsider: string[],
private readonly inputFileSystem: InputFileSystem,
private readonly compilationWarnings: (Error | string)[],
Expand Down Expand Up @@ -63,7 +62,7 @@ export class NgccProcessor {

const timeLabel = `NgccProcessor.processModule.ngcc.process+${moduleName}`;
time(timeLabel);
this.ngcc.process({
mainNgcc({
basePath: this._nodeModulesDirectory,
targetEntryPointPath: path.dirname(packageJsonPath),
propertiesToConsider: this.propertiesToConsider,
Expand Down
28 changes: 0 additions & 28 deletions tests/legacy-cli/e2e/assets/webpack/test-app-ng5/package.json

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {NgModule, Component} from '@angular/core';
import {RouterModule} from '@angular/router';
import {HttpModule, Http} from '@angular/http';

@Component({
selector: 'lazy-feature-comp',
Expand All @@ -13,11 +12,8 @@ export class LazyFeatureComponent {}
RouterModule.forChild([
{path: '', component: LazyFeatureComponent, pathMatch: 'full'},
{path: 'feature', loadChildren: './feature.module#FeatureModule'}
]),
HttpModule
])
],
declarations: [LazyFeatureComponent]
})
export class LazyFeatureModule {
constructor(http: Http) {}
}
export class LazyFeatureModule {}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {NgModule, Component} from '@angular/core';
import {RouterModule} from '@angular/router';
import {HttpModule, Http} from '@angular/http';

@Component({
selector: 'lazy-comp',
Expand All @@ -15,12 +14,9 @@ export class LazyComponent {}
{path: 'feature', loadChildren: './feature/feature.module#FeatureModule'},
{path: 'lazy-feature', loadChildren: './feature/lazy-feature.module#LazyFeatureModule'}
]),
HttpModule
],
declarations: [LazyComponent]
})
export class LazyModule {
constructor(http: Http) {}
}
export class LazyModule {}

export class SecondModule {}
28 changes: 28 additions & 0 deletions tests/legacy-cli/e2e/assets/webpack/test-app-weird/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "test",
"license": "MIT",
"dependencies": {
"@angular/common": "^8.0.0-rc.0",
"@angular/compiler": "^8.0.0-rc.0",
"@angular/compiler-cli": "^8.0.0-rc.0",
"@angular/core": "^8.0.0-rc.0",
"@angular/platform-browser": "^8.0.0-rc.0",
"@angular/platform-browser-dynamic": "^8.0.0-rc.0",
"@angular/platform-server": "^8.0.0-rc.0",
"@angular/router": "^8.0.0-rc.0",
"@ngtools/webpack": "0.0.0",
"core-js": "^3.0.0",
"rxjs": "^6.4.2",
"zone.js": "^0.9.1"
},
"devDependencies": {
"node-sass": "^4.7.0",
"performance-now": "^0.2.0",
"preprocess-loader": "^0.2.2",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.0",
"typescript": "~3.4.5",
"webpack": "~4.0.1",
"webpack-cli": "~2.0.9"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {NgModule, Component} from '@angular/core';
import {RouterModule} from '@angular/router';
import {HttpModule, Http} from '@angular/http';

@Component({
selector: 'lazy-feature-comp',
Expand All @@ -13,11 +12,8 @@ export class LazyFeatureComponent {}
RouterModule.forChild([
{path: '', component: LazyFeatureComponent, pathMatch: 'full'},
{path: 'feature', loadChildren: './feature.module#FeatureModule'}
]),
HttpModule
])
],
declarations: [LazyFeatureComponent]
})
export class LazyFeatureModule {
constructor(http: Http) {}
}
export class LazyFeatureModule {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Injectable, Inject, ViewContainerRef} from '@angular/core';
import {DOCUMENT} from '@angular/platform-browser';
import {DOCUMENT} from '@angular/common';


@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {NgModule, Component} from '@angular/core';
import {RouterModule} from '@angular/router';
import {HttpModule, Http} from '@angular/http';

@Component({
selector: 'lazy-comp',
Expand All @@ -15,12 +14,9 @@ export class LazyComponent {}
{path: 'feature', loadChildren: './feature/feature.module#FeatureModule'},
{path: 'lazy-feature', loadChildren: './feature/lazy-feature.module#LazyFeatureModule'}
]),
HttpModule
],
declarations: [LazyComponent]
})
export class LazyModule {
constructor(http: Http) {}
}
export class LazyModule {}

export class SecondModule {}
27 changes: 27 additions & 0 deletions tests/legacy-cli/e2e/assets/webpack/test-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "test",
"license": "MIT",
"dependencies": {
"@angular/common": "^8.0.0-rc.0",
"@angular/compiler": "^8.0.0-rc.0",
"@angular/compiler-cli": "^8.0.0-rc.0",
"@angular/core": "^8.0.0-rc.0",
"@angular/platform-browser": "^8.0.0-rc.0",
"@angular/platform-browser-dynamic": "^8.0.0-rc.0",
"@angular/platform-server": "^8.0.0-rc.0",
"@angular/router": "^8.0.0-rc.0",
"@ngtools/webpack": "0.0.0",
"core-js": "^3.0.0",
"rxjs": "^6.4.0",
"zone.js": "^0.9.1"
},
"devDependencies": {
"node-sass": "^4.7.0",
"performance-now": "^0.2.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.0",
"typescript": "~3.4.5",
"webpack": "~4.0.1",
"webpack-cli": "~2.0.9"
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {NgModule, Component} from '@angular/core';
import {RouterModule} from '@angular/router';
import {HttpModule, Http} from '@angular/http';

@Component({
selector: 'lazy-feature-comp',
Expand All @@ -13,11 +12,8 @@ export class LazyFeatureComponent {}
RouterModule.forChild([
{path: '', component: LazyFeatureComponent, pathMatch: 'full'},
{path: 'feature', loadChildren: './feature.module#FeatureModule'}
]),
HttpModule
])
],
declarations: [LazyFeatureComponent]
})
export class LazyFeatureModule {
constructor(http: Http) {}
}
export class LazyFeatureModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {Injectable, Inject} from '@angular/core';
import {DOCUMENT} from '@angular/common';


@Injectable()
export class MyInjectable {
constructor(@Inject(DOCUMENT) public doc) {}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {NgModule, Component} from '@angular/core';
import {RouterModule} from '@angular/router';
import {HttpModule, Http} from '@angular/http';

@Component({
selector: 'lazy-comp',
Expand All @@ -14,13 +13,10 @@ export class LazyComponent {}
{path: '', component: LazyComponent, pathMatch: 'full'},
{path: 'feature', loadChildren: './feature/feature.module#FeatureModule'},
{path: 'lazy-feature', loadChildren: './feature/lazy-feature.module#LazyFeatureModule'}
]),
HttpModule
])
],
declarations: [LazyComponent]
})
export class LazyModule {
constructor(http: Http) {}
}
export class LazyModule {}

export class SecondModule {}
28 changes: 28 additions & 0 deletions tests/legacy-cli/e2e/assets/webpack/test-server-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "test",
"license": "MIT",
"dependencies": {
"@angular/animations": "^8.0.0-rc.0",
"@angular/common": "^8.0.0-rc.0",
"@angular/compiler": "^8.0.0-rc.0",
"@angular/compiler-cli": "^8.0.0-rc.0",
"@angular/core": "^8.0.0-rc.0",
"@angular/platform-browser": "^8.0.0-rc.0",
"@angular/platform-browser-dynamic": "^8.0.0-rc.0",
"@angular/platform-server": "^8.0.0-rc.0",
"@angular/router": "^8.0.0-rc.0",
"@ngtools/webpack": "0.0.0",
"core-js": "^3.0.0",
"rxjs": "^6.4.2",
"zone.js": "^0.9.1"
},
"devDependencies": {
"node-sass": "^4.5.0",
"performance-now": "^0.2.0",
"raw-loader": "^0.5.1",
"sass-loader": "^6.0.3",
"typescript": "~3.4.5",
"webpack": "~4.0.1",
"webpack-cli": "~2.0.9"
}
}