Skip to content

Update upstream #57

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

Merged
merged 5 commits into from
Jul 15, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5,885 changes: 5,885 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"typescript": "~2.3.1",
"url-loader": "^0.5.7",
"walk-sync": "^0.3.1",
"webpack": "~3.1.0",
"webpack": "~3.2.0",
"webpack-dev-middleware": "^1.11.0",
"webpack-dev-server": "~2.5.1",
"webpack-merge": "^2.4.0",
Expand Down
9 changes: 6 additions & 3 deletions packages/@angular/cli/blueprints/ng/files/angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,16 @@
},
"lint": [
{
"project": "<%= sourceDir %>/tsconfig.app.json"
"project": "<%= sourceDir %>/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "<%= sourceDir %>/tsconfig.spec.json"
"project": "<%= sourceDir %>/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json"
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@angular/cli/models/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class CliConfig extends CliConfigBase<ConfigInterface> {
const projectConfig = CliConfig.fromProject();
if (projectConfig) {
value = projectConfig.get(jsonPath);
} else {
} else if (CliConfig.globalConfigFilePath() !== CliConfig.configFilePath()) {
const globalConfig = CliConfig.fromGlobal();
if (globalConfig) {
value = globalConfig.get(jsonPath);
Expand Down
2 changes: 1 addition & 1 deletion packages/@angular/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"typescript": ">=2.0.0 <2.4.0",
"url-loader": "^0.5.7",
"walk-sync": "^0.3.1",
"webpack": "~3.1.0",
"webpack": "~3.2.0",
"webpack-dev-middleware": "^1.11.0",
"webpack-dev-server": "~2.4.5",
"webpack-merge": "^2.4.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/@ngtools/webpack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ let version;
try {
version = require('@angular/compiler-cli').VERSION;
} catch (e) {
throw new Error('The "@angular/compiler-cli" package was not properly installed.');
throw new Error('The "@angular/compiler-cli" package was not properly installed. Error: ' + e);
}

// Check that Angular is also not part of this module's node_modules (it should be the project's).
Expand Down
28 changes: 21 additions & 7 deletions packages/@ngtools/webpack/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,25 @@ export class AotPlugin implements Tapable {
return result;
}

private _getLazyRoutesFromNgtools() {
try {
return __NGTOOLS_PRIVATE_API_2.listLazyRoutes({
program: this._program,
host: this._compilerHost,
angularCompilerOptions: this._angularCompilerOptions,
entryModule: this._entryModule
});
} catch (err) {
// We silence the error that the @angular/router could not be found. In that case, there is
// basically no route supported by the app itself.
if (err.message.startsWith('Could not resolve module @angular/router')) {
return {};
} else {
throw err;
}
}
}

// registration hook for webpack plugin
apply(compiler: any) {
this._compiler = compiler;
Expand Down Expand Up @@ -491,13 +510,8 @@ export class AotPlugin implements Tapable {
.then(() => {
// We need to run the `listLazyRoutes` the first time because it also navigates libraries
// and other things that we might miss using the findLazyRoutesInAst.
let discoveredLazyRoutes: LazyRouteMap = this.firstRun ?
__NGTOOLS_PRIVATE_API_2.listLazyRoutes({
program: this._program,
host: this._compilerHost,
angularCompilerOptions: this._angularCompilerOptions,
entryModule: this._entryModule
})
let discoveredLazyRoutes: LazyRouteMap = this.firstRun
? this._getLazyRoutesFromNgtools()
: this._findLazyRoutesInAst();

// Process the lazy routes discovered.
Expand Down
21 changes: 21 additions & 0 deletions tests/e2e/tests/build/no-angular-router.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import {ng} from '../../utils/process';
import {expectFileToExist, moveFile} from '../../utils/fs';
import {updateJsonFile} from '../../utils/project';
import {getGlobalVariable} from '../../utils/env';
import * as path from 'path';


export default function() {
// Skip this in Appveyor tests.
if (getGlobalVariable('argv').appveyor) {
return Promise.resolve();
}

const tmp = getGlobalVariable('tmp-root');

return Promise.resolve()
.then(() => moveFile('node_modules/@angular/router', path.join(tmp, '@angular-router.backup')))
.then(() => ng('build'))
.then(() => expectFileToExist('./dist/index.html'))
.then(() => moveFile(path.join(tmp, '@angular-router.backup'), 'node_modules/@angular/router'));
}
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5480,9 +5480,9 @@ webpack-sources@^1.0.1:
source-list-map "^2.0.0"
source-map "~0.5.3"

webpack@~3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.1.0.tgz#ac0675e500db835f9ab2369d29ba096f51ad0731"
webpack@~3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.2.0.tgz#8b0cae0e1a9fd76bfbf0eab61a8c2ada848c312f"
dependencies:
acorn "^5.0.0"
acorn-dynamic-import "^2.0.0"
Expand Down