Skip to content

chore: flatten interface dirs #2947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/interface-internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@
"@libp2p/interface": "^2.4.1",
"@libp2p/peer-collections": "^6.0.16",
"@multiformats/multiaddr": "^12.3.3",
"progress-events": "^1.0.1",
"uint8arraylist": "^2.4.8"
"progress-events": "^1.0.1"
},
"devDependencies": {
"aegir": "^45.0.5"
Expand Down
11 changes: 5 additions & 6 deletions packages/interface-internal/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export * from './address-manager/index.js'
export * from './connection-manager/index.js'
export * from './random-walk/index.js'
export * from './record/index.js'
export * from './registrar/index.js'
export * from './transport-manager/index.js'
export * from './address-manager.js'
export * from './connection-manager.js'
export * from './random-walk.js'
export * from './registrar.js'
export * from './transport-manager.js'
35 changes: 0 additions & 35 deletions packages/interface-internal/src/record/index.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/interface/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"aegir": "^45.0.5"
},
"browser": {
"events": "./dist/src/events.browser.js"
"./dist/src/events.js": "./dist/src/events.browser.js"
},
"react-native": {
"./dist/src/events.js": "./dist/src/events.browser.js"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { MultiaddrConnection } from '../connection/index.js'
import type { AbortOptions } from '../index.js'
import type { PeerId } from '../peer-id/index.js'
import type { MultiaddrConnection } from './connection.js'
import type { AbortOptions } from './index.js'
import type { PeerId } from './peer-id.js'
import type { Duplex } from 'it-stream-types'
import type { Uint8ArrayList } from 'uint8arraylist'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MultiaddrConnection } from '../connection/index.js'
import type { PeerId } from '../peer-id/index.js'
import type { MultiaddrConnection } from './connection.js'
import type { PeerId } from './peer-id.js'
import type { Multiaddr } from '@multiformats/multiaddr'

export interface ConnectionGater {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { AbortOptions, Logger } from '../index.js'
import type { PeerId } from '../peer-id/index.js'
import type { AbortOptions, Logger } from './index.js'
import type { PeerId } from './peer-id.js'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { Duplex, Source } from 'it-stream-types'
import type { Uint8ArrayList } from 'uint8arraylist'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { RoutingOptions } from '../index.js'
import type { PeerInfo } from '../peer-info/index.js'
import type { RoutingOptions } from './index.js'
import type { PeerInfo } from './peer-info.js'
import type { CID } from 'multiformats/cid'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/interface/src/events.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { setMaxListeners as nodeSetMaxListeners } from 'events'
import { setMaxListeners as nodeSetMaxListeners } from 'node:events'

/**
* Create a setMaxListeners that doesn't break browser usage
Expand Down
57 changes: 28 additions & 29 deletions packages/interface/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
* ```
*/

import type { Connection, NewStreamOptions, Stream } from './connection/index.js'
import type { ContentRouting } from './content-routing/index.js'
import type { Connection, NewStreamOptions, Stream } from './connection.js'
import type { ContentRouting } from './content-routing.js'
import type { TypedEventTarget } from './event-target.js'
import type { Ed25519PublicKey, PublicKey, RSAPublicKey, Secp256k1PublicKey } from './keys/index.js'
import type { Metrics } from './metrics/index.js'
import type { Ed25519PeerId, PeerId, RSAPeerId, Secp256k1PeerId, URLPeerId } from './peer-id/index.js'
import type { PeerInfo } from './peer-info/index.js'
import type { PeerRouting } from './peer-routing/index.js'
import type { Address, Peer, PeerStore } from './peer-store/index.js'
import type { Ed25519PublicKey, PublicKey, RSAPublicKey, Secp256k1PublicKey } from './keys.js'
import type { Metrics } from './metrics.js'
import type { Ed25519PeerId, PeerId, RSAPeerId, Secp256k1PeerId, URLPeerId } from './peer-id.js'
import type { PeerInfo } from './peer-info.js'
import type { PeerRouting } from './peer-routing.js'
import type { Address, Peer, PeerStore } from './peer-store.js'
import type { Startable } from './startable.js'
import type { StreamHandler, StreamHandlerOptions } from './stream-handler/index.js'
import type { Topology } from './topology/index.js'
import type { Listener, OutboundConnectionUpgradeEvents } from './transport/index.js'
import type { StreamHandler, StreamHandlerOptions } from './stream-handler.js'
import type { Topology } from './topology.js'
import type { Listener, OutboundConnectionUpgradeEvents } from './transport.js'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { ProgressOptions, ProgressEvent } from 'progress-events'

Expand Down Expand Up @@ -808,24 +808,23 @@ export const serviceCapabilities = Symbol.for('@libp2p/service-capabilities')
*/
export const serviceDependencies = Symbol.for('@libp2p/service-dependencies')

export * from './connection/index.js'
export * from './connection-encrypter/index.js'
export * from './connection-gater/index.js'
export * from './content-routing/index.js'
export * from './keys/index.js'
export * from './metrics/index.js'
export * from './peer-discovery/index.js'
export * from './peer-id/index.js'
export * from './peer-info/index.js'
export * from './peer-routing/index.js'
export * from './peer-store/index.js'
export * from './peer-store/tags.js'
export * from './pubsub/index.js'
export * from './record/index.js'
export * from './stream-handler/index.js'
export * from './stream-muxer/index.js'
export * from './topology/index.js'
export * from './transport/index.js'
export * from './connection.js'
export * from './connection-encrypter.js'
export * from './connection-gater.js'
export * from './content-routing.js'
export * from './keys.js'
export * from './metrics.js'
export * from './peer-discovery.js'
export * from './peer-id.js'
export * from './peer-info.js'
export * from './peer-routing.js'
export * from './peer-store.js'
export * from './pubsub.js'
export * from './record.js'
export * from './stream-handler.js'
export * from './stream-muxer.js'
export * from './topology.js'
export * from './transport.js'
export * from './errors.js'
export * from './event-target.js'
export * from './events.js'
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { MultiaddrConnection, Stream, Connection } from '../connection/index.js'
import type { MultiaddrConnection, Stream, Connection } from './connection.js'

/**
* Create tracked metrics with these options. Loosely based on the
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { TypedEventTarget } from '../event-target.js'
import type { PeerInfo } from '../peer-info/index.js'
import type { TypedEventTarget } from './event-target.js'
import type { PeerInfo } from './peer-info.js'

/**
* Any object that implements this Symbol as a property should return a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Ed25519PublicKey, KeyType, RSAPublicKey, Secp256k1PublicKey } from '../keys/index.js'
import type { Ed25519PublicKey, KeyType, RSAPublicKey, Secp256k1PublicKey } from './keys.js'
import type { CID } from 'multiformats/cid'
import type { MultihashDigest } from 'multiformats/hashes/interface'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PeerId } from '../peer-id/index.js'
import type { PeerId } from './peer-id.js'
import type { Multiaddr } from '@multiformats/multiaddr'

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { RoutingOptions } from '../index.js'
import type { PeerId } from '../peer-id/index.js'
import type { PeerInfo } from '../peer-info/index.js'
import type { RoutingOptions } from './index.js'
import type { PeerId } from './peer-id.js'
import type { PeerInfo } from './peer-info.js'

/**
* Any object that implements this Symbol as a property should return a
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
import type { PublicKey } from '../keys/index.js'
import type { PeerId } from '../peer-id/index.js'
import type { PublicKey } from './keys.js'
import type { PeerId } from './peer-id.js'
import type { Multiaddr } from '@multiformats/multiaddr'

/**
* When a peer that is tagged with this prefix disconnects, we will attempt to
* redial it, up to a limit.
*
* To allow multiple components to add/remove their own keep-alive tags without
* accidentally overwriting those of other components, attach a unique suffix to
* the tag, e.g. `keep-alive-circuit-relay` or `keep-alive-kad-dht`, etc.
*/
export const KEEP_ALIVE = 'keep-alive'

/**
* A multiaddr with an optional flag that indicates if its trustworthy
*/
Expand Down
9 changes: 0 additions & 9 deletions packages/interface/src/peer-store/tags.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Stream } from '../connection/index.js'
import type { TypedEventTarget } from '../event-target.js'
import type { PublicKey } from '../keys/index.js'
import type { PeerId } from '../peer-id/index.js'
import type { Stream } from './connection.js'
import type { TypedEventTarget } from './event-target.js'
import type { PublicKey } from './keys.js'
import type { PeerId } from './peer-id.js'
import type { Pushable } from 'it-pushable'
import type { Uint8ArrayList } from 'uint8arraylist'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { PublicKey } from '../keys/index.js'
import type { PublicKey } from './keys.js'
import type { Uint8ArrayList } from 'uint8arraylist'

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Connection, Stream } from '../connection/index.js'
import type { Connection, Stream } from './connection.js'

export interface IncomingStreamData {
/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Direction, Stream } from '../connection/index.js'
import type { AbortOptions } from '../index.js'
import type { Direction, Stream } from './connection.js'
import type { AbortOptions } from './index.js'
import type { Duplex } from 'it-stream-types'
import type { Uint8ArrayList } from 'uint8arraylist'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Connection } from '../connection/index.js'
import type { PeerId } from '../peer-id/index.js'
import type { Connection } from './connection.js'
import type { PeerId } from './peer-id.js'

/**
* A topology filter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Connection, ConnectionLimits, MultiaddrConnection } from '../connection/index.js'
import type { TypedEventTarget } from '../event-target.js'
import type { AbortOptions } from '../index.js'
import type { StreamMuxerFactory } from '../stream-muxer/index.js'
import type { Connection, ConnectionLimits, MultiaddrConnection } from './connection.js'
import type { TypedEventTarget } from './event-target.js'
import type { AbortOptions } from './index.js'
import type { StreamMuxerFactory } from './stream-muxer.js'
import type { Multiaddr } from '@multiformats/multiaddr'
import type { ProgressOptions, ProgressEvent } from 'progress-events'

Expand Down
Loading