kotlinc

Kotlin JavaScript Compiler


Keywords
compiler, kotlin
License
MIT
Install
npm install kotlinc@0.1.5

Documentation

kotlinc

Kotlin JavaScript Compiler

Temporarily only supports compiling a single file, the next version increases the compile folder option.

install

npm i kotlinc

const kotlinc = require('kotlinc')

example

const kotlinc = require('../index')

kotlinc({
    src: __dirname + '/app.kt',
    output: __dirname + '/app.js',
    moduleKind: 'umd',
    sourceMap: true,
    metaInfo: true
}, function (code, stdout, stderr) {
    console.log('Exit code:', code)
    console.log('Program output:', stdout)
    console.log('Program stderr:', stderr)
})

options

  • src Input file path
  • output Output file path
  • no-stdlib Don't use bundled Kotlin stdlib
  • libraries Paths to Kotlin libraries with .meta.js and .kjsm files, separated by system file separator
  • source-map Generate source map
  • meta-info Generate .meta.js and .kjsm files with metadata. Use to create a library
  • target { v5 } Generate JS files for specific ECMA version
  • module-kind { plain, amd, commonjs, umd } Kind of a module generated by compiler
  • main {call,noCall} Whether a main function should be called
  • output-prefix Path to file which will be added to the beginning of output file
  • output-postfix Path to file which will be added to the end of output file
  • language-version Provide source compatibility with specified language version
  • api-version Allow to use declarations only from the specified version of bundled libraries
  • nowarn Generate no warnings
  • verbose Enable verbose logging output
  • verbose Display compiler version
  • help Print a synopsis of standard options
  • X Print a synopsis of advanced options
  • P plugin::= Pass an option to a plugin

compiler

JetBrains/kotlin

license

MIT