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