fix(compiler): fix options for compiler

This commit is contained in:
Philipp Kunz 2018-07-25 23:38:30 +02:00
parent bc6039e5ed
commit eeb6d6b963
6 changed files with 38 additions and 23 deletions

View File

@ -1,4 +1,5 @@
declare class test { declare class test2 {
test: string[]; test: string[];
constructor(); constructor();
} }
declare const run: () => Promise<string>;

View File

@ -1,9 +1,20 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
console.log('test'); console.log('test');
console.log('test2'); console.log('test2');
class test { class test2 {
constructor() { constructor() {
this.test = []; this.test = [];
console.log('hi'); console.log('hi');
} }
} }
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9jb21waWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdG9jb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDcEIsT0FBTyxDQUFDLEdBQUcsQ0FBQyxPQUFPLENBQUMsQ0FBQztBQUNyQjtJQUVFO1FBREEsU0FBSSxHQUFhLEVBQUUsQ0FBQztRQUVsQixPQUFPLENBQUMsR0FBRyxDQUFDLElBQUksQ0FBQyxDQUFDO0lBQ3BCLENBQUM7Q0FDRiJ9 const run = () => __awaiter(this, void 0, void 0, function* () {
return 'hi';
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9jb21waWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdG9jb21waWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7O0FBQUEsT0FBTyxDQUFDLEdBQUcsQ0FBQyxNQUFNLENBQUMsQ0FBQztBQUNwQixPQUFPLENBQUMsR0FBRyxDQUFDLE9BQU8sQ0FBQyxDQUFDO0FBQ3JCO0lBRUU7UUFEQSxTQUFJLEdBQWEsRUFBRSxDQUFDO1FBRWxCLE9BQU8sQ0FBQyxHQUFHLENBQUMsSUFBSSxDQUFDLENBQUM7SUFDcEIsQ0FBQztDQUNGO0FBRUQsTUFBTSxHQUFHLEdBQUcsR0FBMEIsRUFBRTtJQUN0QyxPQUFPLElBQUksQ0FBQztBQUNkLENBQUMsQ0FBQSxDQUFDIn0=

View File

@ -1,8 +1,12 @@
console.log('test'); console.log('test');
console.log('test2'); console.log('test2');
class test { class test2 {
test: string[] = []; test: string[] = [];
constructor() { constructor() {
console.log('hi'); console.log('hi');
} }
} }
const run = async (): Promise<string> => {
return 'hi';
};

View File

@ -1,9 +1,9 @@
export * from "./tsbuild.exports"; export * from './tsbuild.exports';
import * as tsbuild from './tsbuild.exports' import * as tsbuild from './tsbuild.exports';
if (process.env.CLI_CALL_TSBUILD === "true") { if (process.env.CLI_CALL_TSBUILD === 'true') {
tsbuild.compileGlobStringObject({ tsbuild.compileGlobStringObject({
"./ts/**/*.ts": "./dist" './ts/**/*.ts': './dist'
}) });
} }

View File

@ -11,13 +11,10 @@ export const compilerOptionsDefault: CompilerOptions = {
emitDecoratorMetadata: true, emitDecoratorMetadata: true,
experimentalDecorators: true, experimentalDecorators: true,
inlineSourceMap: true, inlineSourceMap: true,
noEmitOnError: false, noEmitOnError: true,
outDir: 'dist/', outDir: 'dist/',
module: plugins.typescript.ModuleKind.CommonJS, module: plugins.typescript.ModuleKind.CommonJS,
lib: [ lib: ['lib.es2016.d.ts', 'lib.es2017.d.ts'],
'es2016',
'es2017'
],
noImplicitAny: false, noImplicitAny: false,
target: plugins.typescript.ScriptTarget.ES2015 target: plugins.typescript.ScriptTarget.ES2015
}; };
@ -42,7 +39,7 @@ export const compiler = (
fileNames: string[], fileNames: string[],
options: plugins.typescript.CompilerOptions options: plugins.typescript.CompilerOptions
): Promise<any[]> => { ): Promise<any[]> => {
console.log(options); console.log(`Compiling ${fileNames.length} files...`);
let done = plugins.smartpromise.defer<any[]>(); let done = plugins.smartpromise.defer<any[]>();
let program = plugins.typescript.createProgram(fileNames, options); let program = plugins.typescript.createProgram(fileNames, options);
let emitResult = program.emit(); let emitResult = program.emit();
@ -55,15 +52,17 @@ export const compiler = (
let allDiagnostics = plugins.typescript let allDiagnostics = plugins.typescript
.getPreEmitDiagnostics(program) .getPreEmitDiagnostics(program)
.concat(emitResult.diagnostics); .concat(emitResult.diagnostics);
try { allDiagnostics.forEach(diagnostic => {
allDiagnostics.forEach(diagnostic => { if (diagnostic.file) {
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!);
let message = plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); let message = plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`); console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
}); } else {
} catch (err) { console.log(
// console.log(allDiagnostics) `${plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`
} );
}
});
let exitCode = emitResult.emitSkipped ? 1 : 0; let exitCode = emitResult.emitSkipped ? 1 : 0;
if (exitCode === 0) { if (exitCode === 0) {