Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(options: GeneratorOptions, program: ts.Program) {
this.program = program
this.options = options
let sourceFiles = this.program.getSourceFiles()
log.trace({ fileNames: sourceFiles.map(s => s.fileName) }, 'Documentation scope')
sourceFiles.forEach(sourceFile => {
this.addFile(sourceFile)
})
}
undefined,
packageFilePath
)
}
}
if (!config) {
throw new Error('Nothing to compile')
}
if (config.errors.length > 0) {
log.error({ errors: config.errors }, `Cannot build project, tsconfig.json has errors`)
throw new Error(``)
}
log.trace({ fileNames: config.fileNames }, 'Initial project files')
const pkg = Package.fromPath(path.join(target, 'package.js'))
const result = compile(
config.fileNames,
Object.assign({}, config.options, {
target: ts.ScriptTarget.Latest,
allowJs: true,
noEmit: true
})
)
return {
result,
pkg
}
}