Skip to content

Commit 1eaa193

Browse files
committed
feat(compiler-cli): add a debug option to control the output
fixes #9208
1 parent b620f4f commit 1eaa193

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

modules/@angular/compiler-cli/README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,13 @@ coreBootstrap(MyComponentNgFactory, appInjector);
4141
The `tsconfig.json` file may contain an additional configuration block:
4242
```
4343
"angularCompilerOptions": {
44-
"genDir": "."
44+
"genDir": ".",
45+
"debug": true
4546
}
4647
```
48+
49+
### `genDir`
50+
4751
the `genDir` option controls the path (relative to `tsconfig.json`) where the generated file tree
4852
will be written. If `genDir` is not set, then the code will be generated in the source tree, next
4953
to your original sources. More options may be added as we implement more features.
@@ -67,6 +71,11 @@ as well. This is by design, see https://github.com/Microsoft/TypeScript/issues/8
6771
This makes the configuration of your runtime module loader more complex, so we don't recommend
6872
this option yet.
6973

74+
### `debug`
75+
76+
Set the `debug` option to true to generate debug information in the generate files.
77+
Default to `false`.
78+
7079
See the example in the `test/` directory for a working example.
7180

7281
## Compiler CLI

modules/@angular/compiler-cli/integrationtest/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
"angularCompilerOptions": {
33
// For TypeScript 1.8, we have to lay out generated files
44
// in the same source directory with your code.
5-
"genDir": "."
5+
"genDir": ".",
6+
"debug": true
67
},
78

89
"compilerOptions": {

modules/@angular/compiler-cli/src/codegen.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export class CodeGenerator {
152152
StaticAndDynamicReflectionCapabilities.install(staticReflector);
153153
const htmlParser = new HtmlParser();
154154
const config = new compiler.CompilerConfig({
155-
genDebugInfo: true,
155+
genDebugInfo: options.debug === true,
156156
defaultEncapsulation: ViewEncapsulation.Emulated,
157157
logBindingUpdate: false,
158158
useJit: false,

modules/@angular/compiler/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {ViewEncapsulation} from '@angular/core';
22

33
import {unimplemented} from '../src/facade/exceptions';
4-
import {Type, assertionsEnabled, isBlank} from '../src/facade/lang';
4+
import {assertionsEnabled} from '../src/facade/lang';
55

66
import {CompileIdentifierMetadata} from './compile_metadata';
77
import {Identifiers} from './identifiers';

tools/@angular/tsc-wrapped/src/collector.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as ts from 'typescript';
22

3-
import {Evaluator, ImportMetadata, ImportSpecifierMetadata, errorSymbol, isPrimitive} from './evaluator';
3+
import {Evaluator, errorSymbol, isPrimitive} from './evaluator';
44
import {ClassMetadata, ConstructorMetadata, MemberMetadata, MetadataError, MetadataMap, MetadataSymbolicExpression, MetadataSymbolicReferenceExpression, MetadataValue, MethodMetadata, ModuleMetadata, VERSION, isMetadataError, isMetadataSymbolicReferenceExpression} from './schema';
55
import {Symbols} from './symbols';
66

tools/@angular/tsc-wrapped/src/options.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ interface Options extends ts.CompilerOptions {
1515

1616
// Print extra information while running the compiler
1717
trace: boolean;
18+
19+
// Whether to embed debug information in the compiled templates
20+
debug?: boolean;
1821
}
1922

2023
export default Options;

0 commit comments

Comments
 (0)