feat(compiler-cli): add a `debug` option to control the output

fixes #9208
This commit is contained in:
Victor Berchet 2016-06-15 14:56:56 -07:00
parent b620f4f456
commit 1eaa193c51
6 changed files with 18 additions and 5 deletions

View File

@ -41,9 +41,13 @@ coreBootstrap(MyComponentNgFactory, appInjector);
The `tsconfig.json` file may contain an additional configuration block: The `tsconfig.json` file may contain an additional configuration block:
``` ```
"angularCompilerOptions": { "angularCompilerOptions": {
"genDir": "." "genDir": ".",
"debug": true
} }
``` ```
### `genDir`
the `genDir` option controls the path (relative to `tsconfig.json`) where the generated file tree the `genDir` option controls the path (relative to `tsconfig.json`) where the generated file tree
will be written. If `genDir` is not set, then the code will be generated in the source tree, next will be written. If `genDir` is not set, then the code will be generated in the source tree, next
to your original sources. More options may be added as we implement more features. 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
This makes the configuration of your runtime module loader more complex, so we don't recommend This makes the configuration of your runtime module loader more complex, so we don't recommend
this option yet. this option yet.
### `debug`
Set the `debug` option to true to generate debug information in the generate files.
Default to `false`.
See the example in the `test/` directory for a working example. See the example in the `test/` directory for a working example.
## Compiler CLI ## Compiler CLI

View File

@ -2,7 +2,8 @@
"angularCompilerOptions": { "angularCompilerOptions": {
// For TypeScript 1.8, we have to lay out generated files // For TypeScript 1.8, we have to lay out generated files
// in the same source directory with your code. // in the same source directory with your code.
"genDir": "." "genDir": ".",
"debug": true
}, },
"compilerOptions": { "compilerOptions": {

View File

@ -152,7 +152,7 @@ export class CodeGenerator {
StaticAndDynamicReflectionCapabilities.install(staticReflector); StaticAndDynamicReflectionCapabilities.install(staticReflector);
const htmlParser = new HtmlParser(); const htmlParser = new HtmlParser();
const config = new compiler.CompilerConfig({ const config = new compiler.CompilerConfig({
genDebugInfo: true, genDebugInfo: options.debug === true,
defaultEncapsulation: ViewEncapsulation.Emulated, defaultEncapsulation: ViewEncapsulation.Emulated,
logBindingUpdate: false, logBindingUpdate: false,
useJit: false, useJit: false,

View File

@ -1,7 +1,7 @@
import {ViewEncapsulation} from '@angular/core'; import {ViewEncapsulation} from '@angular/core';
import {unimplemented} from '../src/facade/exceptions'; import {unimplemented} from '../src/facade/exceptions';
import {Type, assertionsEnabled, isBlank} from '../src/facade/lang'; import {assertionsEnabled} from '../src/facade/lang';
import {CompileIdentifierMetadata} from './compile_metadata'; import {CompileIdentifierMetadata} from './compile_metadata';
import {Identifiers} from './identifiers'; import {Identifiers} from './identifiers';

View File

@ -1,6 +1,6 @@
import * as ts from 'typescript'; import * as ts from 'typescript';
import {Evaluator, ImportMetadata, ImportSpecifierMetadata, errorSymbol, isPrimitive} from './evaluator'; import {Evaluator, errorSymbol, isPrimitive} from './evaluator';
import {ClassMetadata, ConstructorMetadata, MemberMetadata, MetadataError, MetadataMap, MetadataSymbolicExpression, MetadataSymbolicReferenceExpression, MetadataValue, MethodMetadata, ModuleMetadata, VERSION, isMetadataError, isMetadataSymbolicReferenceExpression} from './schema'; import {ClassMetadata, ConstructorMetadata, MemberMetadata, MetadataError, MetadataMap, MetadataSymbolicExpression, MetadataSymbolicReferenceExpression, MetadataValue, MethodMetadata, ModuleMetadata, VERSION, isMetadataError, isMetadataSymbolicReferenceExpression} from './schema';
import {Symbols} from './symbols'; import {Symbols} from './symbols';

View File

@ -15,6 +15,9 @@ interface Options extends ts.CompilerOptions {
// Print extra information while running the compiler // Print extra information while running the compiler
trace: boolean; trace: boolean;
// Whether to embed debug information in the compiled templates
debug?: boolean;
} }
export default Options; export default Options;