Skip to content

Diagnostics warnings #5698

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 3 commits into from
Mar 28, 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
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,9 @@
]
},
"devDependencies": {
"@angular/compiler": "^4.0.0-rc.5",
"@angular/compiler-cli": "^4.0.0-rc.5",
"@angular/core": "^4.0.0-rc.5",
"@angular/compiler": "^4.0.0",
"@angular/compiler-cli": "^4.0.0",
"@angular/core": "^4.0.0",
"@types/chai": "^3.4.32",
"@types/chalk": "^0.4.28",
"@types/common-tags": "^1.2.4",
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 @@ -83,7 +83,7 @@
"webpack": "~2.2.0",
"webpack-dev-server": "~2.3.0",
"webpack-merge": "^2.4.0",
"zone.js": "^0.7.2"
"zone.js": "^0.8.4"
},
"optionalDependencies": {
"node-sass": "^4.3.0"
Expand Down
36 changes: 21 additions & 15 deletions packages/@ngtools/webpack/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ export class AotPlugin implements Tapable {

const original = consumer.originalPositionFor({ line, column: character });
return {
line: original.line,
character: original.column,
line: typeof original.line == 'number' ? original.line : line,
character: typeof original.column == 'number' ? original.column : character,
fileName: original.source || fileName
};
} catch (e) {
Expand Down Expand Up @@ -390,19 +390,25 @@ export class AotPlugin implements Tapable {
);

if (diagnostics.length > 0) {
const message = diagnostics
.map(diagnostic => {
const position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);

const sourceText = diagnostic.file.getFullText();
let {line, character, fileName} = this._translateSourceMap(sourceText,
diagnostic.file.fileName, position);

const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
return `${fileName} (${line + 1},${character + 1}): ${message}`;
})
.join('\n');
this._compilation.errors.push(message);
diagnostics.forEach(diagnostic => {
const position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);

const sourceText = diagnostic.file.getFullText();
let {line, character, fileName} = this._translateSourceMap(sourceText,
diagnostic.file.fileName, position);

const messageText = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
const message = `${fileName} (${line + 1},${character + 1}): ${messageText}`;

switch (diagnostic.category) {
case ts.DiagnosticCategory.Error:
this._compilation.errors.push(message);
break;

default:
this._compilation.warnings.push(message);
}
});
}
}

Expand Down