|
|
@ -3,14 +3,14 @@ import { canUseWorker, urlFromVersion } from './compiler-utils' |
|
|
|
import { CompilerAbstract } from './compiler-abstract' |
|
|
|
import { CompilerAbstract } from './compiler-abstract' |
|
|
|
import { Compiler } from './compiler' |
|
|
|
import { Compiler } from './compiler' |
|
|
|
|
|
|
|
|
|
|
|
export const compile = (compilationTargets, settings, contentResolverCallback, worker?: any): Promise<CompilerAbstract> => { |
|
|
|
export const compile = (compilationTargets, settings, contentResolverCallback): Promise<CompilerAbstract> => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
return new Promise((resolve, reject) => { |
|
|
|
const compiler = new Compiler(contentResolverCallback) |
|
|
|
const compiler = new Compiler(contentResolverCallback) |
|
|
|
compiler.set('evmVersion', settings.evmVersion) |
|
|
|
compiler.set('evmVersion', settings.evmVersion) |
|
|
|
compiler.set('optimize', settings.optimize) |
|
|
|
compiler.set('optimize', settings.optimize) |
|
|
|
compiler.set('language', settings.language) |
|
|
|
compiler.set('language', settings.language) |
|
|
|
compiler.set('runs', settings.runs) |
|
|
|
compiler.set('runs', settings.runs) |
|
|
|
compiler.loadVersion(canUseWorker(settings.version), urlFromVersion(settings.version), worker) |
|
|
|
compiler.loadVersion(canUseWorker(settings.version), urlFromVersion(settings.version)) |
|
|
|
compiler.event.register('compilationFinished', (success, compilationData, source, input, version) => { |
|
|
|
compiler.event.register('compilationFinished', (success, compilationData, source, input, version) => { |
|
|
|
resolve(new CompilerAbstract(settings.version, compilationData, source, input)) |
|
|
|
resolve(new CompilerAbstract(settings.version, compilationData, source, input)) |
|
|
|
}) |
|
|
|
}) |
|
|
|