Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

Commit

Permalink
chore: break modules apart (#228)
Browse files Browse the repository at this point in the history
Splits each interface area into it's own module so we can release breaking
changes to (for example) the pubsub interface without also having to
upgrade single transport module to the new `@libp2p/interfaces` major.

Fixes: #226

BREAKING CHANGE: most modules have been split out of the `@libp2p/interfaces` and `@libp2p/interface-compliance-tests` packages
  • Loading branch information
achingbrain authored Jun 13, 2022
1 parent 24bcae0 commit 7e9caeb
Show file tree
Hide file tree
Showing 383 changed files with 5,982 additions and 14,668 deletions.
35 changes: 35 additions & 0 deletions packages/interface-address-manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# @libp2p/interface-address-manager <!-- omit in toc -->

[![test & maybe release](https://github.com/libp2p/js-libp2p-interfaces/actions/workflows/js-test-and-release.yml/badge.svg)](https://github.com/libp2p/js-libp2p-interfaces/actions/workflows/js-test-and-release.yml)

> Address Manager interface for libp2p
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Usage](#usage)
- [License](#license)
- [Contribution](#contribution)

## Install

```console
$ npm i @libp2p/interface-address-manager
```

## Usage

```js
import type { AddressManager } from '@libp2p/interfaces-address-manager'
```

## License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@libp2p/peer-collections",
"version": "1.0.3",
"description": "Stores values against a peer id",
"name": "@libp2p/interface-address-manager",
"version": "0.0.1",
"description": "Address Manager interface for libp2p",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-peer-collections#readme",
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-address-manager#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/libp2p/js-libp2p-interfaces.git"
Expand All @@ -12,7 +12,8 @@
"url": "https://github.com/libp2p/js-libp2p-interfaces/issues"
},
"keywords": [
"IPFS"
"interface",
"libp2p"
],
"engines": {
"node": ">=16.0.0",
Expand All @@ -28,7 +29,8 @@
],
"exports": {
".": {
"import": "./dist/src/index.js"
"import": "./dist/src/index.js",
"types": "./dist/src/index.d.ts"
}
},
"eslintConfig": {
Expand Down Expand Up @@ -123,21 +125,13 @@
"lint": "aegir lint",
"dep-check": "aegir dep-check",
"build": "aegir build",
"test": "aegir test",
"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker",
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:node": "aegir test -t node --cov",
"test:electron-main": "aegir test -t electron-main",
"release": "aegir release"
},
"dependencies": {
"@libp2p/interfaces": "^2.0.0",
"@libp2p/peer-id": "^1.1.0"
"multiformats": "^9.6.3"
},
"devDependencies": {
"@libp2p/peer-id-factory": "^1.0.0",
"aegir": "^37.0.7"
"aegir": "^37.0.17"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Multiaddr } from '@multiformats/multiaddr'
import type { EventEmitter } from '../events.js'
import type { EventEmitter } from '@libp2p/interfaces/events'

export interface AddressManagerEvents {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"outDir": "dist"
},
"include": [
"src",
"test"
"src"
],
"references": [
{
"path": "../libp2p-interfaces"
"path": "../interfaces"
}
]
}
33 changes: 33 additions & 0 deletions packages/interface-compliance-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# @libp2p/interface-compliance-tests <!-- omit in toc -->

[![test & maybe release](https://github.com/libp2p/js-libp2p-interfaces/actions/workflows/js-test-and-release.yml/badge.svg)](https://github.com/libp2p/js-libp2p-interfaces/actions/workflows/js-test-and-release.yml)

> Compliance tests for JS libp2p interfaces
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Usage](#usage)
- [License](#license)
- [Contribution](#contribution)

## Install

```console
$ npm i @libp2p/interface-compliance-tests
```

## Usage

Each [interface](https://npmjs.org/packages/@libp2p/interfaces) has its documentation on how to use the compliance tests and should be used as the source of truth.

## License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@libp2p/pubsub",
"version": "1.3.0",
"description": "libp2p pubsub base class",
"name": "@libp2p/interface-compliance-tests",
"version": "2.0.3",
"description": "Compliance tests for JS libp2p interfaces",
"license": "Apache-2.0 OR MIT",
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-pubsub#readme",
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-compliance-tests#readme",
"repository": {
"type": "git",
"url": "git+https://github.com/libp2p/js-libp2p-interfaces.git"
Expand Down Expand Up @@ -48,32 +48,20 @@
"import": "./dist/src/index.js",
"types": "./dist/src/index.d.ts"
},
"./errors": {
"import": "./dist/src/errors.js",
"types": "./dist/src/errors.d.ts"
"./is-valid-tick": {
"import": "./dist/src/is-valid-tick.js",
"types": "./dist/src/is-valid-tick.d.ts"
},
"./peer-streams": {
"import": "./dist/src/peer-streams.js",
"types": "./dist/src/peer-streams.d.ts"
},
"./signature-policy": {
"import": "./dist/src/signature-policy.js",
"types": "./dist/src/signature-policy.d.ts"
},
"./utils": {
"import": "./dist/src/utils.js",
"types": "./dist/src/utils.d.ts"
"./peers": {
"import": "./dist/src/peers.js",
"types": "./dist/src/peers.d.ts"
}
},
"eslintConfig": {
"extends": "ipfs",
"parserOptions": {
"sourceType": "module"
},
"ignorePatterns": [
"test/message/*.d.ts",
"test/message/*.js"
]
}
},
"release": {
"branches": [
Expand Down Expand Up @@ -161,44 +149,39 @@
"lint": "aegir lint",
"dep-check": "aegir dep-check",
"build": "aegir build",
"generate": "protons test/message/rpc.proto",
"test": "aegir test",
"test:chrome": "aegir test -t browser --cov",
"test:chrome-webworker": "aegir test -t webworker",
"test:firefox": "aegir test -t browser -- --browser firefox",
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
"test:node": "aegir test -t node --cov",
"test:electron-main": "aegir test -t electron-main",
"release": "aegir release"
},
"dependencies": {
"@libp2p/crypto": "^0.22.8",
"@libp2p/interfaces": "^2.0.0",
"@libp2p/logger": "^1.1.0",
"@libp2p/peer-collections": "^1.0.0",
"@libp2p/peer-id": "^1.1.0",
"@libp2p/topology": "^1.1.0",
"@multiformats/multiaddr": "^10.1.5",
"@libp2p/logger": "^1.1.6",
"@libp2p/multistream-select": "^1.0.6",
"@libp2p/peer-id": "^1.1.12",
"@libp2p/peer-id-factory": "^1.0.12",
"@libp2p/pubsub": "^1.2.0",
"@multiformats/multiaddr": "^10.2.0",
"abortable-iterator": "^4.0.2",
"aegir": "^37.0.17",
"any-signal": "^3.0.1",
"delay": "^5.0.0",
"err-code": "^3.0.1",
"iso-random-stream": "^2.0.0",
"it-length-prefixed": "^7.0.1",
"it-all": "^1.0.6",
"it-drain": "^1.0.5",
"it-goodbye": "^4.0.1",
"it-handshake": "^3.0.1",
"it-map": "^1.0.6",
"it-ndjson": "^0.1.1",
"it-pair": "^2.0.2",
"it-pipe": "^2.0.3",
"it-pushable": "^2.0.1",
"it-pushable": "^2.0.2",
"it-stream-types": "^1.0.4",
"multiformats": "^9.6.3",
"p-queue": "^7.2.0",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
"@libp2p/peer-id-factory": "^1.0.0",
"aegir": "^37.0.7",
"delay": "^5.0.0",
"it-pair": "^2.0.2",
"p-defer": "^4.0.0",
"p-event": "^5.0.1",
"p-limit": "^4.0.0",
"p-wait-for": "^4.1.0",
"protons": "^3.0.4",
"protons-runtime": "^1.0.4",
"sinon": "^14.0.0",
"uint8arraylist": "^1.5.1",
"uint8arrays": "^3.0.0",
"util": "^0.12.4"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
"outDir": "dist"
},
"include": [
"src",
"test"
"src"
],
"references": [
{
"path": "../libp2p-interfaces"
"path": "../interfaces"
}
]
}
53 changes: 53 additions & 0 deletions packages/interface-connection-compliance-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# @libp2p/interface-connection-compliance-tests <!-- omit in toc -->

[![test & maybe release](https://github.com/libp2p/js-libp2p-interfaces/actions/workflows/js-test-and-release.yml/badge.svg)](https://github.com/libp2p/js-libp2p-interfaces/actions/workflows/js-test-and-release.yml)

> Compliance tests for implementations of the libp2p Connection interface
## Table of contents <!-- omit in toc -->

- [Install](#install)
- [Usage](#usage)
- [License](#license)
- [Contribution](#contribution)

## Install

```console
$ npm i @libp2p/interface-connection-compliance-tests
```

## Usage

This is a test suite and interface you can use to implement a connection. The connection interface contains all the metadata associated with it, as well as an array of the streams opened through this connection. In the same way as the connection, a stream contains properties with its metadata, plus an iterable duplex object that offers a mechanism for writing and reading data, with back pressure. This module and test suite were heavily inspired by abstract-blob-store and interface-stream-muxer.

The primary goal of this module is to enable developers to pick, swap or upgrade their connection without losing the same API expectations and mechanisms such as back pressure and the ability to half close a connection.

Publishing a test suite as a module lets multiple modules ensure compatibility since they use the same test suite.

```js
import tests from '@libp2p/interface-connection-compliance-tests'

describe('your connection', () => {
tests({
// Options should be passed to your connection
async setup (options) {
return YourConnection
},
async teardown () {
// cleanup resources created by setup()
}
})
})
```

## License

Licensed under either of

- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)

### Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Loading

0 comments on commit 7e9caeb

Please sign in to comment.