Add pull-{pushable,streams}, cleanup commonjs exports

This commit is contained in:
Jaco Greeff 2018-06-21 15:49:53 +02:00
parent c96c7b7003
commit d0869fbebc
26 changed files with 107 additions and 41 deletions

View File

@ -27,3 +27,5 @@ This following libraries are currently included. Where possible add the relevant
- [peer-book](https://github.com/libp2p/js-peer-book) - [peer-book](https://github.com/libp2p/js-peer-book)
- [peer-id](https://github.com/libp2p/js-peer-id) - [peer-id](https://github.com/libp2p/js-peer-id)
- [peer-info](https://github.com/libp2p/js-peer-info) - [peer-info](https://github.com/libp2p/js-peer-info)
- [pull-pushable](https://github.com/pull-stream/pull-pushable)
- [pull-stream](https://github.com/pull-stream/pull-stream)

View File

@ -3,10 +3,10 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import PeerInfo from 'peer-info'; import PeerInfo = require('peer-info');
declare interface Connection { declare interface Connection {
getPeerInfo (cb: (error: Error | null, peerInfo?: PeerInfo) => any): void; getPeerInfo (cb: (error: Error | null, peerInfo?: PeerInfo) => any): void;
} }
export default Connection; export = Connection;

View File

@ -6,4 +6,4 @@
declare interface Transport { declare interface Transport {
} }
export default Transport; export = Transport;

View File

@ -6,4 +6,4 @@
declare class LibP2pKadDht { declare class LibP2pKadDht {
} }
export default LibP2pKadDht; export = LibP2pKadDht;

View File

@ -3,7 +3,7 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import PeerInfo from 'peer-info'; import PeerInfo = require('peer-info');
type Options = { type Options = {
broadcast?: boolean, broadcast?: boolean,
@ -21,4 +21,4 @@ declare class LibP2pMdns {
on (event: Events, cb: (peerInfo: PeerInfo) => any): void; on (event: Events, cb: (peerInfo: PeerInfo) => any): void;
} }
export default LibP2pMdns; export = LibP2pMdns;

View File

@ -14,4 +14,4 @@ declare type LibP2pMplex = {
muticodec: string; muticodec: string;
} }
export default LibP2pMplex; export = LibP2pMplex;

View File

@ -3,8 +3,8 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import MultiAddr from 'multiaddr'; import MultiAddr = require('multiaddr');
import PeerInfo from 'peer-info'; import PeerInfo = require('peer-info');
type Options = { type Options = {
list: Array<string | MultiAddr>, list: Array<string | MultiAddr>,
@ -19,4 +19,4 @@ declare class LibP2pRailing {
on (event: Events, cb: (peerInfo: PeerInfo) => any): void; on (event: Events, cb: (peerInfo: PeerInfo) => any): void;
} }
export default LibP2pRailing; export = LibP2pRailing;

View File

@ -3,7 +3,7 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import PeerId from 'peer-id'; import PeerId = require('peer-id');
declare type LibP2pSecio = { declare type LibP2pSecio = {
tag: '/secio/1.0.0', tag: '/secio/1.0.0',
@ -11,4 +11,4 @@ declare type LibP2pSecio = {
encrypt (localId: PeerId, conn: any, remoteId: PeerId, callback: () => any): void encrypt (localId: PeerId, conn: any, remoteId: PeerId, callback: () => any): void
} }
export default LibP2pSecio; export = LibP2pSecio;

View File

@ -14,4 +14,4 @@ declare type LibP2pSpdy = {
muticodec: string; muticodec: string;
} }
export default LibP2pSpdy; export = LibP2pSpdy;

View File

@ -3,9 +3,9 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import Transport from 'interface-transport'; import Transport = require('interface-transport');
declare class LibP2pTcp implements Transport { declare class LibP2pTcp implements Transport {
} }
export default LibP2pTcp; export = LibP2pTcp;

View File

@ -3,9 +3,9 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import Transport from 'interface-transport'; import Transport = require('interface-transport');
declare class LibP2pWebRtcDirect implements Transport { declare class LibP2pWebRtcDirect implements Transport {
} }
export default LibP2pWebRtcDirect; export = LibP2pWebRtcDirect;

View File

@ -3,9 +3,9 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import Transport from 'interface-transport'; import Transport = require('interface-transport');
declare class LibP2pWebRtcStar implements Transport { declare class LibP2pWebRtcStar implements Transport {
} }
export default LibP2pWebRtcStar; export = LibP2pWebRtcStar;

View File

@ -3,9 +3,9 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import Transport from 'interface-transport'; import Transport = require('interface-transport');
declare class LibP2pWebsockets implements Transport { declare class LibP2pWebsockets implements Transport {
} }
export default LibP2pWebsockets; export = LibP2pWebsockets;

22
libp2p/index.d.ts vendored
View File

@ -3,16 +3,16 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import Connection from 'interface-connection'; import Connection = require('interface-connection');
import Transport from 'interface-transport'; import Transport = require('interface-transport');
import Libp2pKadDHT from 'libp2p-kad-dht'; import Libp2pKadDHT = require('libp2p-kad-dht');
import LibP2pMdns from 'libp2p-mdns'; import LibP2pMdns = require('libp2p-mdns');
import LibP2pMplex from 'libp2p-mplex'; import LibP2pMplex = require('libp2p-mplex');
import LibP2pRailing from 'libp2p-railing'; import LibP2pRailing = require('libp2p-railing');
import LibP2pSecio from 'libp2p-secio'; import LibP2pSecio = require('libp2p-secio');
import LibP2pSpdy from 'libp2p-spdy'; import LibP2pSpdy = require('libp2p-spdy');
import PeerBook from 'peer-book'; import PeerBook = require('peer-book');
import PeerInfo from 'peer-info'; import PeerInfo = require('peer-info');
type CreateOptions = { type CreateOptions = {
DHT: typeof Libp2pKadDHT, DHT: typeof Libp2pKadDHT,
@ -38,4 +38,4 @@ declare class LibP2p {
stop (cb: (error: Error | null) => any): void; stop (cb: (error: Error | null) => any): void;
} }
export default LibP2p; export = LibP2p;

View File

@ -5,7 +5,7 @@
/// <reference types="node"/> /// <reference types="node"/>
import PeerId from 'peer-id'; import PeerId = require('peer-id');
type Address = { type Address = {
family: string, family: string,
@ -50,4 +50,4 @@ declare class MultiAddr {
toString (): string; toString (): string;
} }
export default MultiAddr; export = MultiAddr;

View File

@ -3,8 +3,8 @@
// Definitions by: Jaco Greeff <https://github.com/jacogr> // Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import PeerId from 'peer-id'; import PeerId = require('peer-id');
import PeerInfo from 'peer-info'; import PeerInfo = require('peer-info');
declare class PeerBook { declare class PeerBook {
constructor (); constructor ();
@ -18,4 +18,4 @@ declare class PeerBook {
remove (peerInfo: PeerInfo, replace?: boolean): void; remove (peerInfo: PeerInfo, replace?: boolean): void;
} }
export default PeerBook; export = PeerBook;

2
peer-id/index.d.ts vendored
View File

@ -35,4 +35,4 @@ declare class PeerId {
toJSON (): JSON; toJSON (): JSON;
} }
export default PeerId; export = PeerId;

View File

@ -5,8 +5,8 @@
/// <reference types="node"/> /// <reference types="node"/>
import MultiAddr from 'multiaddr'; import MultiAddr = require('multiaddr');
import PeerId from 'peer-id'; import PeerId = require('peer-id');
type CreateCb = (error: Error | null, peerId?: PeerId) => any; type CreateCb = (error: Error | null, peerId?: PeerId) => any;
@ -45,4 +45,4 @@ declare class PeerInfo {
isConnected (): boolean; isConnected (): boolean;
} }
export default PeerInfo; export = PeerInfo;

14
pull-pushable/index.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
// Type definitions for pull-pushable 2.0.0
// Project: https://github.com/pull-stream/pull-pushable
// Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
type Pushable = {
push: (buffer: Buffer) => void
};
declare type PullPushable = () => Pushable;
export = PullPushable;

View File

View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "bn.js-tests.ts"]
}

View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

16
pull-stream/index.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
// Type definitions for pull-stream 3.6.8
// Project: https://github.com/pull-stream/pull-stream
// Definitions by: Jaco Greeff <https://github.com/jacogr>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
type Pull = {
(source: any, sink: any): void;
collect: (cb: (error: Error | null, values: Array<Buffer>) => any) => void,
drain: (handler: (message: Buffer) => void, errorHandler?: () => boolean) => void;
values: (values: Array<string | Buffer>) => void;
};
export = Pull;

View File

16
pull-stream/tsconfig.json Normal file
View File

@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "bn.js-tests.ts"]
}

1
pull-stream/tslint.json Normal file
View File

@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }