chore(tsc-wrapped): update to newest tsickle
This commit is contained in:
parent
3aca5ff9e2
commit
bbed364e7b
|
@ -21,11 +21,6 @@ tmp
|
|||
*.js.deps
|
||||
*.js.map
|
||||
|
||||
# Files created by the template compiler
|
||||
**/*.ngfactory.ts
|
||||
**/*.css.ts
|
||||
**/*.css.shim.ts
|
||||
|
||||
# Include when developing application packages.
|
||||
pubspec.lock
|
||||
.c9
|
||||
|
|
|
@ -5203,7 +5203,7 @@
|
|||
}
|
||||
},
|
||||
"tsickle": {
|
||||
"version": "0.1.2",
|
||||
"version": "0.1.4",
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.4.4"
|
||||
|
|
|
@ -8293,9 +8293,8 @@
|
|||
}
|
||||
},
|
||||
"tsickle": {
|
||||
"version": "0.1.2",
|
||||
"from": "tsickle@0.1.2",
|
||||
"resolved": "https://registry.npmjs.org/tsickle/-/tsickle-0.1.2.tgz",
|
||||
"version": "0.1.4",
|
||||
"from": "tsickle@0.1.4",
|
||||
"dependencies": {
|
||||
"source-map": {
|
||||
"version": "0.4.4",
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
"through2": "^0.6.5",
|
||||
"ts-api-guardian": "0.0.3",
|
||||
"ts2dart": "^0.9.10",
|
||||
"tsickle": "0.1.2",
|
||||
"tsickle": "^0.1.4",
|
||||
"tslint": "^3.10.0-dev.2",
|
||||
"typescript": "^1.9.0-dev.20160409",
|
||||
"universal-analytics": "^0.3.9",
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
"license": "MIT",
|
||||
"repository": {"type":"git","url":"https://github.com/angular/angular.git"},
|
||||
"dependencies": {
|
||||
"tsickle": "0.1.2"
|
||||
"tsickle": "0.1.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"typescript": "^1.9.0-dev"
|
||||
|
|
|
@ -39,18 +39,24 @@ interface DecoratorInvocation {
|
|||
args?: any[];
|
||||
}
|
||||
`;
|
||||
constructor(delegate: ts.CompilerHost) { super(delegate); }
|
||||
constructor(delegate: ts.CompilerHost, private program: ts.Program) { super(delegate); }
|
||||
|
||||
getSourceFile =
|
||||
(fileName: string, languageVersion: ts.ScriptTarget, onError?: (message: string) => void) => {
|
||||
const originalContent = this.delegate.readFile(fileName);
|
||||
let newContent = originalContent;
|
||||
if (!/\.d\.ts$/.test(fileName)) {
|
||||
const converted = convertDecorators(fileName, originalContent);
|
||||
try {
|
||||
const converted = convertDecorators(
|
||||
this.program.getTypeChecker(), this.program.getSourceFile(fileName));
|
||||
if (converted.diagnostics) {
|
||||
this.diagnostics.push(...converted.diagnostics);
|
||||
}
|
||||
newContent = converted.output + this.TSICKLE_SUPPORT;
|
||||
} catch (e) {
|
||||
console.error('Cannot convertDecorators on file', fileName);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
return ts.createSourceFile(fileName, newContent, languageVersion, true);
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@ import NgOptions from './options';
|
|||
import {MetadataWriterHost, TsickleHost} from './compiler_host';
|
||||
|
||||
export type CodegenExtension = (ngOptions: NgOptions, program: ts.Program, host: ts.CompilerHost) =>
|
||||
Promise<any>;
|
||||
Promise<void>;
|
||||
|
||||
export function main(project: string, basePath?: string, codegen?: CodegenExtension): Promise<any> {
|
||||
try {
|
||||
|
@ -32,11 +32,13 @@ export function main(project: string, basePath?: string, codegen?: CodegenExtens
|
|||
codegen = () => Promise.resolve(null);
|
||||
}
|
||||
return codegen(ngOptions, program, host).then(() => {
|
||||
tsc.typeCheck(host, program);
|
||||
// Create a new program since codegen files were created after making the old program
|
||||
const newProgram = ts.createProgram(parsed.fileNames, parsed.options, host, program);
|
||||
tsc.typeCheck(host, newProgram);
|
||||
|
||||
// Emit *.js with Decorators lowered to Annotations, and also *.js.map
|
||||
const tsicklePreProcessor = new TsickleHost(host);
|
||||
tsc.emit(tsicklePreProcessor, program);
|
||||
const tsicklePreProcessor = new TsickleHost(host, newProgram);
|
||||
tsc.emit(tsicklePreProcessor, newProgram);
|
||||
|
||||
if (!ngOptions.skipMetadataEmit) {
|
||||
// Emit *.metadata.json and *.d.ts
|
||||
|
@ -44,8 +46,8 @@ export function main(project: string, basePath?: string, codegen?: CodegenExtens
|
|||
// decorators which we want to read or document.
|
||||
// Do this emit second since TypeScript will create missing directories for us
|
||||
// in the standard emit.
|
||||
const metadataWriter = new MetadataWriterHost(host, program);
|
||||
tsc.emit(metadataWriter, program);
|
||||
const metadataWriter = new MetadataWriterHost(host, newProgram);
|
||||
tsc.emit(metadataWriter, newProgram);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
|
|
|
@ -79,10 +79,7 @@ export class Tsc implements CompilerInterface {
|
|||
return {parsed: this.parsed, ngOptions: this.ngOptions};
|
||||
}
|
||||
|
||||
typeCheck(compilerHost: ts.CompilerHost, oldProgram: ts.Program): void {
|
||||
// Create a new program since codegen files were created after making the old program
|
||||
const program =
|
||||
ts.createProgram(this.parsed.fileNames, this.parsed.options, compilerHost, oldProgram);
|
||||
typeCheck(compilerHost: ts.CompilerHost, program: ts.Program): void {
|
||||
debug('Checking global diagnostics...');
|
||||
check(program.getGlobalDiagnostics());
|
||||
|
||||
|
|
Loading…
Reference in New Issue