Giter Site home page Giter Site logo

haxe-js-kit's People

Contributors

0b1kn00b avatar andyli avatar as3boyan avatar async-cl avatar ccapndave avatar ciscoheat avatar clemos avatar cloudshift avatar dfadev avatar dionjwa avatar fantoine avatar francescoagati avatar gama11 avatar jasononeil avatar jbips avatar kevinresol avatar labe-me avatar laurence-myers avatar matthijskamstra avatar mockey avatar nesbox avatar peekmo avatar postite avatar rb1147x avatar sledorze avatar tavrox avatar theosabattie avatar theremix avatar tiagolr avatar zabojad 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

haxe-js-kit's Issues

Branding/Marketing website

I think this is one of the best libraries out there for web and general js development with Haxe, because let's be honest, UFront is a niche framework currently and is not really under active development.

I suggest we brand this over and create a slick marketing site. The name could changed maybe, but I think haxe-js-kit is fine.

Food for though! What do you guys think?

Mongoose Scheme: use underlying concrete type of abstracts

Currently Mixed is used in the mongoose schema when the type is abstract. Is it possible to drill down to the concrete type of an abstract when creating the schema?

e.g. A field of type abstract MyAb(String) will become a String instead of Mixed in the schema

Merge/test strategy for the packages?

Hi, soon I'll have a large bunch of packages ready to be merged from https://github.com/ciscoheat/meadowlark/tree/master/js-kit/js, how would you like them to be reviewed and pull-requested? Not all have a complete API but they are all working fine.

I'm using an abstract class here for settings, would you like me to use an inline static string in the class instead? https://github.com/ciscoheat/meadowlark/blob/master/js-kit/js/npm/express/Morgan.hx

I haven't made packages for all subclasses, for example here with CsurfOptions. Is that ok still? https://github.com/ciscoheat/meadowlark/blob/master/js-kit/js/npm/express/Csurf.hx

js.npm.express, connect or neither? Sometimes I'm struggling where to put the class. Any guidelines?

js.node.stream.Readable and Writable should be interfaces

Hi

I am just starting with node js and wanted to use this library with haxe: https://github.com/niegowski/node-pngjs

The PNG class both implement Readable and Writable stream.

Unfortunately the extern used in haxe-js-kit for Readable and Writable are classes and I thus need to use "extends" for my extern but this block me for using both Readable and Writable.

Is there any workarround ?
Is this an issue of js-kit or extern not allowing interfaces?

Thanks for your lib by the way, that is quite useful

Constraint check failure

haxe -lib js-kit -js mongoose.js -main test.MongooseTest tells me:
C:\Program Files (x86)\HaxeFoundation\haxe\lib/js-kit/git/js/npm/mongoose/Mongoose.hx:17: characters 8-134 : Constraint check failure for js.npm.mongoose.TModels.M
C:\Program Files (x86)\HaxeFoundation\haxe\lib/js-kit/git/js/npm/mongoose/Mongoose.hx:17: characters 8-134 : model.M should be js.npm.mongoose.TModel<model.T>
C:\Program Files (x86)\HaxeFoundation\haxe\lib/js-kit/git/js/npm/mongoose/Model.hx:20: characters 8-60 : Constraint check failure for js.npm.mongoose.TModels.M
C:\Program Files (x86)\HaxeFoundation\haxe\lib/js-kit/git/js/npm/mongoose/Model.hx:20: characters 8-60 : model.M should be js.npm.mongoose.TModel<model.T>

After changing the code as suggested it works well :)

Arguments and variables of type Void are not allowed

This code:

Fs.writeFile( filePath, someHtml, function(err,val) {});

Gives me the error:

Arguments and variables of type Void are not allowed

These are used almost everywhere, so I'm not sure if I'm doing something wrong - does this work for other people? I'm using the latest Haxe from git.

For me the solution is to replace all the Callback<Void> types in the externs with Callback<Class<Void>>. Juraj explained the meaning of this type in this post: https://groups.google.com/d/msg/haxelang/8erB4mxm0n4/hzhFoykK8x8J

Let me know if I'm the only one having problems :)

Unexpected .

Getting this error with a test script:

dvbxczf50g_vciuplblzruwa2djhpjya7_grhn_v7tw

Tried debugging Middleware.hx but couldn't find anything apparently wrong... any ideas? Using the develop branch.

I can compile the project but I can't get autocompletion.

Thanks!

Electron shell examples?

Wondering if the electron (atom-shell) externs are up to date? Any example of how to use it with Haxe?

Thanks!

Application.use signature

First I's like to know if it makes any sense to have
@:overload( function ( mount : String , middleware : Middleware<Request,Response> ) : Connect {} )
two times in the Application class.

then I wanted to use methods of the servers classes from the routes following the advices on http://stackoverflow.com/questions/15039045/access-app-js-variables-in-routes-but-without-global-express I tried both approaches - the first one didn't work and I would like to know why the following code inside the user.js route file
var user = require("../nodeOne");
console.log(user);

just prints an empty object: {} (nodeOne.js is my haxe output server)

so I used the second approach which seems to work:

var createUser:Request->Response->User = User.create;
app.use(function(req,res,next){
req.createUser = createUser;
next();
});

to get this compiled I had to add to the Application.use signatures:

@:overload( function ( fn:Request->Response->(Void->Void)->Void) : Connect {} )

and make the js.npm.express.Request class implement Dynamic

would you suggest any better way to achieve this?

Express Bug

If you initialize Express it tries to use some of Connects functions rather than it's node_module version.
Could be sharing of scope, or the use of new in the generated code, I just replaced mine with @:natve to get round it for the time being.

Also, Express is the global object, and an ExpressServer built with a function() which I don't see anywhere.

(It might be an issue between express/connect: not sure)
cheers

Error handling suggestion for @async

I love the @async feature, but I'm tired of the error testing and callback passing. What do you think about adding error handling in the metadata? Something like:

public function start(cb : Error -> Void) {
    var err, client = @async(err => cb) Soap.createClient('https://some/service.asmx?wsdl');
    // ...
}

With this (err => cb) construct, it will generate this code:

Soap.createClient('https://some/service.asmx?wsdl', function(err, client) {
    if(err != null) return cb(err);
    // ...
});

I'm not sure how to handle callback signatures with different number of parameters though. What do you think about this idea?

Haxelib installation

Please provide haxelib.json file for use with haxelib git command, so people can install this lib directly from command-line.

Trouble compiling

Hello,

I have tried to use your library, for this i have in my hxml file the path of a clone of your code.
and i use a simplified version of your express example ( just static entry)
But i have the following errors messages:

/home/systrans/haxemk/haxe-js-kit/npm/Package.hx:249: characters 7-40 : Duplicate type parameter name: Const
/home/systrans/haxemk/haxe-js-kit/npm/Package.hx:252: characters 7-49 : Duplicate type parameter name: Const

When i look at line 249 :
extern interface Require<Const,Const> {}

And when i look at line 252
extern interface RequireNamespace<Const,Const> {}

I have the same errors when i do:
haxe test.hxml
in the haxe-js-kit directory

Using @async with Mongoose .find()

how do you use @async to get all documents with mongoose?

this in the normal callback way that works

post.find().exec(function( err:String, docs:Array<Post> ){
  res.render('index', { posts : docs });
});


if i do this, i get a compile time error
using Haxe version 3.1.3 [stable]

var query = post.find();
var err,docs = @async query.exec();
if(err != null) trace(err);
res.render('index', { posts : docs });

// error
Local variable err used without being initialized

this compiles, yet does not give me an array of documents like i expected

var err,docs = @async query.exec();
res.render('index', { posts : docs });

tracing docs shows this

{
    domain : null, 
    _events : {

    }, 
    _maxListeners : 10, 
    emitted : {

    }, 
    ended : false
}

i think i'm using the model find and query exec incorrectly, can you show me an example please?

haxe-js-kit and hxelectron and hxnodejs

I am trying to combine a couple things in Electron.

Doesn't work...
electron externs from js-kit are ... still called Atom

So I moved to hxelectron from Franco Ponticelli
and he uses -lib hxnodejs

But also want to use express (from js-kit)
you see where I am going...

it doesn't work.

if I copy js.npm files to a folder without the js.node
I get:

lib/js/npm/express/Application.hx:3: characters 7-26 : Type not found : js.support.Callback

copied js.support folder

lib/js/npm/express/Middleware.hx:21: characters 2-7 : Type not found : util.CopyMethods

(magical stuff happening there)

and I remove -lib hxnodejs
and add -lib js-kit

lib/electron/main/BrowserWindow.hx:7: lines 7-26 : Type not found : Event

Using Map<String,Int> with Mongoose

Hello there!

I'm doing a Youtube Scraper and need to search through tags.
I tried to do use this typedef for a mongoose stored data

"
typedef ChannelStatsData =
{
linkedChannelID:String,
tags:Map<String, Int>,
averageByVideo :
{
likes:Float,
dislikes:Float,
comments:Float,
views:Float
},
best:
{
like:Float,
dislike:Float,
comments:Float,
views:Float
}
}
"

But it seems that Mongoose doesn't like the tags:Map<String,Int>, part.
Is it a problem of the lib or I should do a workaround? thx!

Build Mongoose Schema with options

It would be nice if the Manager could take SchemaOptions so even when the schema is auto-generated by the macro, it takes those options.

Maybe by giving it to the build()method?

Passport and express

Hi !

I'm trying to attach a passport strategy to express routes.

In js, it would look like this:

File auth.js:

var passport = require('passport');
var BasicStrategy = require('passport-http').BasicStrategy;
var User = require('../models/user');

passport.use(new BasicStrategy(
  function(username, password, callback) {
    User.findOne({ username: username }, function (err, user) {
      if (err) { return callback(err); }

      // No user found with that username
      if (!user) { return callback(null, false); }

      // Make sure the password is correct
      user.verifyPassword(password, function(err, isMatch) {
        if (err) { return callback(err); }

        // Password did not match
        if (!isMatch) { return callback(null, false); }

        // Success
        return callback(null, user);
      });
    });
  }
));

exports.isAuthenticated = passport.authenticate('basic', { session : false });

Main.js:

var passport = require('passport');
var authController = require('./controllers/auth');

mongoose.connect('mongodb://localhost:27017/beerlocker');

var app = express();

app.use(bodyParser.urlencoded({
  extended: true
}));

app.use(passport.initialize());

var router = express.Router();

router.route('/beers')
  .post(authController.isAuthenticated, beerController.postBeers)
  .get(authController.isAuthenticated, beerController.getBeers);

Here is my try to do something similar with haxe:

    expressSrv = new js.npm.Express();

    function isAuthenticated(req : Request, res : Response) : Void {
trace('isAuthenticated triggered');
        js.npm.Passport.authenticate('basic', { session : false });
    }

    function initExpressRoutes() : Void {

        var r = new Router();

        r.route('/beers')

            .post(isAuthenticated, postBeerAction)

            .get(isAuthenticated, getBeersAction);

        js.npm.Passport.use(new js.npm.passport.BasicStrategy(

            function(email, password, cb) {

                    trace('basic strategy triggered!');

                    app.userDao.md.findOne({ email: email }, 

                        function (err, user) {

                                if (err != null) {

                                    cb(err);
                                    return;
                                }

                                if (user == null) {

                                    cb(null, false);
                                    return;
                                }

                                user.verifyPassword(password, 

                                    function(err, isMatch) {

                                            if (err != null) {

                                                cb(err);
                                                return;
                                            }

                                            if (!isMatch) {

                                                cb(null, false);
                                                return;
                                            }

                                            cb(null, user);
                                        });
                            });
                }
            ));

        r.use(js.npm.Passport.initialize());
        r.use(BodyParser.json());

        expressSrv.use(r);
    }

And it might not be the right way to do it as calls hangs on the isAuthenticated method...

What am I doing wrong ?

extern for fs.readFile()

Hey guys,

I need to read some files from the filesystem from my Haxe nodejs app, but I just found out that externs for the fs module are not complete. There's only a FSWatcher.hx and a Stats.hx there.

I'd like to add the extern for fs.readFile(), and also learn the pattern for adding others - I'm not sure how I should name the class, and also what is needed, since I see some macro magic is being used there (in the implements call). Could someone point me in the right direction - an example would be great!

Thanks in advance!

Compile-time check of models ignored?

Consider a model defined as follow:

typedef StuffData = {
    test : String,
    foo : Int,
    ?bar : {
        hello : String,
        world : Array<Dynamic>
    }
}

// declare the model
// the typedef fields will be "copied" to Stuff instance
@:schemaOptions({
    autoIndex: true
})
class Stuff extends Model<StuffData>{}
class StuffManager extends js.npm.mongoose.macro.Manager<StuffData,Stuff>{}

The following code will compile (but it should not):

function test(stuff:Stuff) stuff.nonExistentField;

Any idea?

and $type(stuff.nonExistentField) gives me Dynamic

Sample apps

Just found this repo, and as someone currently using Haxe for js work, this is will certainly be useful. Do you have any samples apps available, i.e for expressjs? It'd be great to see how the same app would look written in Haxe vs vanilla Javascript, to compare the cost/benefits of using either languages.

Keep up the great work!

publish to haxelib

Thanks for the great work!

Any plan to publish to haxelib in the near future or should I turn to using the git repo if I need a new feature? (namely node's https support).

Thanks

SocketIO clientside error "Uncaught ReferenceError: process is not defined"

I am currently working on making a socketio example.
I use https://github.com/clemos/haxe-js-kit/blob/develop/test/SocketIoTest.hx as a reverence

And I ran into a bug on the client:

client.js:2 Uncaught ReferenceError: process is not defined

Played around with it and I can stop that error when I remove js-kit

-lib js-kit

Source will be generated

// Generated by Haxe 3.3.0
(function () { "use strict";
...

instead off

// Generated by Haxe 3.3.0
if (process.version < "v4.0.0") console.warn("Module " + (typeof(module) == "undefined" ? "" : module.filename) + " requires node.js version 4.0.0 or higher");
(function () { "use strict";
...

So I guess you do some macro magic (yes I still call it magic) and checks for Node/Node-version, which is not necessary on the client.
So perhaps first a check for process

if (typeof process !== 'undefined' ) if (process.version < "v4.0.0") console.warn("Module " + (typeof(module) == "undefined" ? "" : module.filename) + " requires node.js version 4.0.0 or higher");

Using with angular.haxe

Hey guys,

I'm trying to use haxe-js-kit with @frabbit's angular.haxe (https://github.com/frabbit/angular.haxe), but if I add both as -lib to the build.hxml, I get the following errors:

/usr/lib/haxe/std/js/html/MediaElement.hx:79: characters 1-64 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeys.hx:34: characters 1-122 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:34: characters 1-42 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:36: characters 1-131 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:37: characters 1-53 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:38: characters 1-99 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:39: characters 1-34 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:40: characters 1-35 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:41: characters 1-58 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFaceSet.hx:33: characters 1-41 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFaceSet.hx:45: characters 1-81 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFace.hx:38: characters 1-46 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFace.hx:43: characters 1-37 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/Navigator.hx:60: characters 1-149 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaElement.hx:79: characters 1-64 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeys.hx:34: characters 1-122 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:34: characters 1-42 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:36: characters 1-131 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:37: characters 1-53 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:38: characters 1-99 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:39: characters 1-34 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:40: characters 1-35 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/MediaKeySession.hx:41: characters 1-58 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFaceSet.hx:33: characters 1-41 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFaceSet.hx:45: characters 1-81 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFace.hx:38: characters 1-46 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/FontFace.hx:43: characters 1-37 : Type name js.Promise is redefined from module js.JQuery
/usr/lib/haxe/std/js/html/Navigator.hx:60: characters 1-149 : Type name js.Promise is redefined from module js.JQuery

I have no idea what might be causing this. Any hints?

Thanks!

Express router has no method get

Hi, only now i noticed there exists a dev branch and i switched to it to avoid rewriting new additions like Morgan like i did a couple of days ago.

I found i cannot use Router.get() while i can use Router.all() and Router.post()

I was using the following code to place routes on different folders.

class App {
    static function main() {
        var port = 8000;
        var app = new Express();

       app.use('/', new Index().router);
       app.use('/users', new Users().router);
    }
}

class Index {
    public var router:Router;
    public function new() {
        router = new Router();
        router.all('/', function(req:Request, res:Response) {
            res.end("Index");
        }); 
    }
}

class Users { .... } 

Now i have to replace Router.get() with Router.all().

PS - If you know a better way to place routes on different folders let me know, i found this hacky way so far.

Breaks Sublime Haxe Plugin auto completion

I wanted to use this Lib for Express. As soon as I use it though Sublime auto completion does not work anymore:

package;
class ServerMain {
    public static function main() {
        trace('hello world');
        // here auto completion still works.
        var app = new js.npm.Express();
        // from here on auto completion is broken
    }   
}

I tried all 3 branches ("master", "develop", "haxelib").. I installed via haxelib and via git. No luck. I am on OS X with Haxe 3.2.1

It still compiles ok though. Also there is no error message in Sublime whatsoever. So I am not sure if it is a js-kit issue or a Sublime Plugin issue. Never had that kind of trouble with Sublime before though.

Mongoose document save() has no argument

Hi,

I'm trying to save a mongoose document with its save method. I saw in js.npm.mongoose.Model.hx:


@:native("Model")
extern class TModel<T>
extends Document<T>
implements npm.Package.RequireNamespace<"mongoose","*"> 
{
...
    public function save( fn : Callback<TModel<T>> ) : Void;
...
}

So I tried:

class MyModel extends Model<MyModelData>{}
class MyModelDOA{
     public function clone(mod: MyModel, callback: Callback<MyModel>):Void
    {
        mod.save(callback);
    }
}

But I get Function 'save' requires no arguments. The weird thing is that I can use any function on the model and it didn't trigger any compilation errors (I tried mod.hjdzjhuhef() and it compiled), like it's a Dynamic.
Is there an interference with another save function ?

Dependency on `hxnodejs` is causing issues with socket.io in browser

This is a follow up on #141, however the problems we encounter are more far-reaching.

Among other things hxnodejs:

I'm not sure how to deal with this. As far as socket IO is concerned, I wonder though if the nodejs dependency is all that useful. From the looks of it, it really just uses EventEmitter.

Maybe this would work:

package js.npm.socketio;

#if nodejs
typedef EventEmitter<T> = js.node.events.EventEmitter;
#else
extern class EventEmitter<T> {
  // ...
}
#end

I guess down the line the real question is though whether haxe-js-kit is really intended for pure browser development (i.e. not electron or some other environment that has access to the nodejs APIs).

Call Schema pre() method

Hi !

I'm quite lost with the Mongoose externs...

Here is a javascript version of what I would like to do:

var mongoose = require('mongoose');

// Define our user schema
var UserSchema = new mongoose.Schema({
  username: String,
  password: String
});

// Execute before each user.save() call
UserSchema.pre('save', function(callback) {
  var user = this;

  // Break out if the password hasn't changed
  if (!user.isModified('password')) return callback();

  console.log("password has changed: "+user.password);
});

// Export the Mongoose model
module.exports = mongoose.model('User', UserSchema);

Now, here is what I have in my haxe project:

typedef UserData = {
    username : String,
    password : String
}

@:schemaOptions({
    versionKey: false
})
class User extends Model<UserData> { }
class UserManager extends Manager<UserData, User> { }

class UserDao {

    public function new(db : Mongoose) {

        md = UserManager.build(db, "User");
    }

    public var md : TModels<UserData, User>;
}

I see in the Mongoose externs that the pre method is defined. But how can I call it ? And in its callback, how will I be able to access the user instance it concerns ("this" in the raw javascript version)?

Thanks in advance !

Mongoose new Model()

I am aware new Mongoose externs are still hot :), but maybe this is a simple fix. I am not able to create a Document out of a model with just calling the constructor. (not using create)

var stuff = new Stuff(); //non persisted doc

Thanks for your work!

[RFC] Automatically generate a wrapper for any given CommonJS module

There are a lot of NodeJS modules out there now. It would be impossible for a small group of people to generate wrappers for all of them.

But I was wondering how far we could get with a tool to generate module wrappers automatically.

For example the tool could:

  • Fire up a JS envirnoment/interpreter
  • require() the given module
  • Inspect the module that is returned

A wrapper could then be generated that very simply exposes all the top-level properties we found in the returned module (functions, Strings, numbers or plain objects).

Of course when a function is encountered, we won't know the types of its arguments or return object, so we would have to write Dynamic.

But at least we could get the names of the top-level functions exposed by the library, and make these available to Haxe. This could catch very basic typos at compile time. :)

And it would offer a basic template for anyone wanting to tighten up the interface to the reflect the real types. (Then we just need a package manager so that people can upload their wrappers!)

(Looking further in the future, I think people might want to start consuming all these NodeJS modules in more type-safe languages. I can imagine one day performing static analysis on JS code to work out, where possible, what types are being passed around.)

2D array in mongoose schema

Currently mongoose (4.2.2) does not support multi-dimensional array in schema. So in the model schema macro we should convert them to Mixed (or [Mixed]?).

ChildProcess Class not found : IWritable

I am also getting this issue:
externs/haxe-js-kit/js/node/ChildProcess.hx:27: characters 1-21 : Class not found : IWritable
When I import ChildProcess
Which is weird

Bluebird.hx type error chaining * -> Void functions with .then()

I'm having trouble chaining functions/promises using the Bluebird extern. I believe Haxe's type inference engine is failing to deduce the return type of a fulfilledHandler that comes after a fulfilledHandler with a return type of Void.

Here's a small test case that exhibits the problem:

import buddy.BuddySuite;
import js.npm.Bluebird;
using buddy.Should;

class TestBluebird extends BuddySuite {
    public function new() {

        describe("Testing Bluebird", function () {
            it("Allows chaining after a '* -> Void' function", function (done) {
                var p = new Bluebird(function (resolve, reject) {
                    resolve("first value");
                }).then(function (firstValue) {
                    firstValue.should.be("first value");
                }).then(function () {
                    done();
                });
            });
        });
    }
}

I think I can work around the issue by returning "null" in one function and accepting a dummy arg in the next, but this is awkward for chaining existing functions together, and problematic for making use of externs or libs.

Mongoose Schema fields options

Hi !

Is this kind of Schema declarations supported ?

var mongoose = require('mongoose');

var UserSchema = new mongoose.Schema({
  username: {
    type: String,
    unique: true,
    required: true
  },
  password: {
    type: String,
    required: true
  }
});

// Export the Mongoose model
module.exports = mongoose.model('User', UserSchema);

If yes, how can we do this ?

If not how could we add this ? :)

Thanks !

does not compile with haxe v3.2.1

the compiler fails with this error

js-kit/npm/Package.hx:250: characters 25-26 : Unexpected @

line 250

extern interface Require<@:const P,@:const V> {}

context, in npm/Package.hx

@:autoBuild(npm.Include.build())
#if (haxe_ver > 3.2)
extern interface Require<@:const P,@:const V> {}
#else
extern interface Require<Const,Const> {}
#end

@:autoBuild(npm.Include.build())
#if (haxe_ver > 3.2)
extern interface RequireNamespace<@:const P,@:const V> {}
#else
extern interface RequireNamespace<Const,Const> {}
#end

Any dev -> master -> haxelib roadmap?

As the readme prominently displays: Warning : This is a work in progress and is definitely not stable nor complete !

I kind of disagree. :) I've been using the dev branch for a long time, it's simple and useful, and if I find any problems I submit a PR and it gets accepted quickly.

My plan is to use haxe-js-kit in a large project soon, so I'm curious if there will be a dev -> master merge soon, to stabilize the project? What are the dev/master differences right now, and why?

I was also thinking about a haxelib release, but maybe that depends on the official haxe/node externs?

As I said in #54 I'm happy to set up a Travis environment with the tests, so if that can help I'll start working on that.

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.