fix(compiler): fix options for compiler
This commit is contained in:
parent
bc6039e5ed
commit
eeb6d6b963
3
test/assets/output/tocompile.d.ts
vendored
3
test/assets/output/tocompile.d.ts
vendored
@ -1,4 +1,5 @@
|
||||
declare class test {
|
||||
declare class test2 {
|
||||
test: string[];
|
||||
constructor();
|
||||
}
|
||||
declare const run: () => Promise<string>;
|
||||
|
@ -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('test2');
|
||||
class test {
|
||||
class test2 {
|
||||
constructor() {
|
||||
this.test = [];
|
||||
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=
|
@ -1,8 +1,12 @@
|
||||
console.log('test');
|
||||
console.log('test2');
|
||||
class test {
|
||||
class test2 {
|
||||
test: string[] = [];
|
||||
constructor() {
|
||||
console.log('hi');
|
||||
}
|
||||
}
|
||||
|
||||
const run = async (): Promise<string> => {
|
||||
return 'hi';
|
||||
};
|
||||
|
10
ts/index.ts
10
ts/index.ts
@ -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({
|
||||
"./ts/**/*.ts": "./dist"
|
||||
})
|
||||
'./ts/**/*.ts': './dist'
|
||||
});
|
||||
}
|
||||
|
@ -11,13 +11,10 @@ export const compilerOptionsDefault: CompilerOptions = {
|
||||
emitDecoratorMetadata: true,
|
||||
experimentalDecorators: true,
|
||||
inlineSourceMap: true,
|
||||
noEmitOnError: false,
|
||||
noEmitOnError: true,
|
||||
outDir: 'dist/',
|
||||
module: plugins.typescript.ModuleKind.CommonJS,
|
||||
lib: [
|
||||
'es2016',
|
||||
'es2017'
|
||||
],
|
||||
lib: ['lib.es2016.d.ts', 'lib.es2017.d.ts'],
|
||||
noImplicitAny: false,
|
||||
target: plugins.typescript.ScriptTarget.ES2015
|
||||
};
|
||||
@ -42,7 +39,7 @@ export const compiler = (
|
||||
fileNames: string[],
|
||||
options: plugins.typescript.CompilerOptions
|
||||
): Promise<any[]> => {
|
||||
console.log(options);
|
||||
console.log(`Compiling ${fileNames.length} files...`);
|
||||
let done = plugins.smartpromise.defer<any[]>();
|
||||
let program = plugins.typescript.createProgram(fileNames, options);
|
||||
let emitResult = program.emit();
|
||||
@ -55,15 +52,17 @@ export const compiler = (
|
||||
let allDiagnostics = plugins.typescript
|
||||
.getPreEmitDiagnostics(program)
|
||||
.concat(emitResult.diagnostics);
|
||||
try {
|
||||
allDiagnostics.forEach(diagnostic => {
|
||||
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
|
||||
if (diagnostic.file) {
|
||||
let { line, character } = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!);
|
||||
let message = plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
|
||||
console.log(`${diagnostic.file.fileName} (${line + 1},${character + 1}): ${message}`);
|
||||
});
|
||||
} catch (err) {
|
||||
// console.log(allDiagnostics)
|
||||
} else {
|
||||
console.log(
|
||||
`${plugins.typescript.flattenDiagnosticMessageText(diagnostic.messageText, '\n')}`
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
let exitCode = emitResult.emitSkipped ? 1 : 0;
|
||||
if (exitCode === 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user