Giter VIP home page Giter VIP logo

kotlinx-nodejs's Introduction

kotlinx-nodejs

Kotlin Experimental JetBrains incubator project GitHub license

kotlinx-nodejs provides Kotlin external declarations for using the Node.js API from Kotlin code targeting JavaScript.

We're currently experimental!

Right now the only thing we guarantee is that the provided source set is compiling. There can be, unfortunately, some inconsistent, missing, redundant, or even unusable declarations.

Feel free to submit issues and bug reports as you encounter them. We will do our best to address them as soon as possible.

Keep in mind that these sources are generated with Dukat and are not supposed to be edited manually. Please do not send pull requests to this repository directly. Instead, please file an issue about the improvements you have in mind โ€“ we can then adjust the generator tool accordingly.

Setup

To add kotlinx-nodejs to your project, make sure you have jcenter added to your repositories. You can then add a dependency:

repositories {
    // . . .
    jcenter()
}

dependencies {
    // . . .
    implementation("org.jetbrains.kotlinx:kotlinx-nodejs:0.0.7")
}

kotlinx-nodejs's People

Contributors

bashor avatar etolstoy avatar louiscad avatar schahen avatar sebastianaigner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kotlinx-nodejs's Issues

Functions with default values causes "Overload resolution ambiguity"

A lot of functions have illegal overloads when default value parameter is used. e.g. assert.assert package:

external fun equal(actual: Any, expected: Any, message: String = definedExternally)
external fun equal(actual: Any, expected: Any, message: Error = definedExternally)
<...>

All functions with default values are unusable in this module.

Using any of them causes:

e: <...>: Overload resolution ambiguity: 
public external fun equal(actual: Any, expected: Any, message: Error = ...): Unit defined in assert.assert
public external fun equal(actual: Any, expected: Any, message: String = ...): Unit defined in assert.assert

How can i set OutgoingHttpHeaders

I have a simple node server below which runs successfully.

fun main() {
http.createServer { req, res ->
res.writeHead(200, object : OutgoingHttpHeaders {
val ContentType = "text/plain"
})
res.end("Hello Test")
}.listen(8080)
}

I am not sure of how to set the headers. The code above produces the header as below in the browser and i want to achieve the key header name as Content-Type.

_ContentType: text/plain

http.createServer should accept suspend function

In http.createServer(RequestListener), RequestListener should be a suspend function. In traditional Js, we can set this function to async and call await inside of it, But without RequestListener being suspend we can not call Promise<T>.await()

fs.promises API does not seem to work

See https://nodejs.org/api/fs.html#fs_fs_promises_api

The fs.promises API provides an alternative set of asynchronous file system methods that return Promise objects rather than using callbacks. The API is accessible via require('fs').promises or require('fs/promises')

It looks like fs.promises is not right here:

I'm not sure what declare module "fs/promises" means in TypeScript, however, the following Kotlin declaration works:

@file:JsModule("fs")
@file:JsQualifier("promises")
package ...

import kotlin.js.Promise

external fun unlink(paths: String): Promise<Unit>

JS Object

I just wanted to know what the benefit is to remove/not implement getters and setters for Object, since I leaking here a bit of background.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.