[ 
https://issues.apache.org/jira/browse/THRIFT-2995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14322135#comment-14322135
 ] 

Randy Abernethy commented on THRIFT-2995:
-----------------------------------------

Hello Igor,

Your point about q and the types.js is on point. The q lib is part of the 
Apache Thrift nodejs "client" RPC interface. Servers and those simply 
interested in object serialization should not need to require it. 

Node-int64 is part of the protocol interface (all Apache Thrift protocols must 
use it). However, some might want to use only the Apache Thrift transport layer 
or perhaps construct their own protocol, not needing node-int64.

Modularity is everything in large systems and we should be pushing in this 
direction. Thanks for all of the insights Igor!

-Randy

-Randy

> nodejs: index.js requires too much
> ----------------------------------
>
>                 Key: THRIFT-2995
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2995
>             Project: Thrift
>          Issue Type: Bug
>          Components: Node.js - Library
>    Affects Versions: 0.9.2
>         Environment: webpack
>            Reporter: Igor Tkach
>
> THRIFT-2387 requested centralizing external exports in index.js. Required 
> modules that are now in  index.js create unnecessary and problematic 
> dependencies  which make it impossible to use thrift module in browser via 
> tools like webpack. Client code may avoid using {{require('thrift')}} import 
> like so:
> {code:javascript}
> var options = {
>     transport: require('thrift/transport').TBufferedTransport,
>     protocol: require('thrift/protocol').TBinaryProtocol,
>     path: "/",
>     headers: {"Connection": "close"},
>     https: false,
>     responseType: 'arraybuffer'
>   };
>   var httpConnection = require('thrift/http_connection');
>   var con = httpConnection.createHttpConnection("localhost", 8888, options);
>   var client = httpConnection.createHttpClient(MyService, con);
> {code}   
> but unfortunately generated {{MyService}} nodejs module contains  
> {{require('thrift')}} which tries to bring in connection, ws_connection, 
> server and web_server all of which of course are unwanted in the browser and 
> depend on node modules that can't work in the browser.
>   



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to