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

Commit 385614e

Browse files
authored
chore: break modules apart (#232)
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
1 parent 3ed62f4 commit 385614e

File tree

385 files changed

+6331
-15033
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

385 files changed

+6331
-15033
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# @libp2p/interface-address-manager <!-- omit in toc -->
2+
3+
[![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)
4+
5+
> Address Manager interface for libp2p
6+
7+
## Table of contents <!-- omit in toc -->
8+
9+
- [Install](#install)
10+
- [Usage](#usage)
11+
- [License](#license)
12+
- [Contribution](#contribution)
13+
14+
## Install
15+
16+
```console
17+
$ npm i @libp2p/interface-address-manager
18+
```
19+
20+
## Usage
21+
22+
```js
23+
import type { AddressManager } from '@libp2p/interfaces-address-manager'
24+
```
25+
26+
## License
27+
28+
Licensed under either of
29+
30+
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
31+
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
32+
33+
### Contribution
34+
35+
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.

packages/libp2p-peer-collections/package.json renamed to packages/interface-address-manager/package.json

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"name": "@libp2p/peer-collections",
3-
"version": "1.0.3",
4-
"description": "Stores values against a peer id",
2+
"name": "@libp2p/interface-address-manager",
3+
"version": "0.0.1",
4+
"description": "Address Manager interface for libp2p",
55
"license": "Apache-2.0 OR MIT",
6-
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/libp2p-peer-collections#readme",
6+
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-address-manager#readme",
77
"repository": {
88
"type": "git",
99
"url": "git+https://github.com/libp2p/js-libp2p-interfaces.git"
@@ -12,7 +12,8 @@
1212
"url": "https://github.com/libp2p/js-libp2p-interfaces/issues"
1313
},
1414
"keywords": [
15-
"IPFS"
15+
"interface",
16+
"libp2p"
1617
],
1718
"engines": {
1819
"node": ">=16.0.0",
@@ -28,6 +29,7 @@
2829
],
2930
"exports": {
3031
".": {
32+
"types": "./dist/src/index.d.ts",
3133
"import": "./dist/src/index.js"
3234
}
3335
},
@@ -123,21 +125,13 @@
123125
"lint": "aegir lint",
124126
"dep-check": "aegir dep-check",
125127
"build": "aegir build",
126-
"test": "aegir test",
127-
"test:chrome": "aegir test -t browser --cov",
128-
"test:chrome-webworker": "aegir test -t webworker",
129-
"test:firefox": "aegir test -t browser -- --browser firefox",
130-
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
131-
"test:node": "aegir test -t node --cov",
132-
"test:electron-main": "aegir test -t electron-main",
133128
"release": "aegir release"
134129
},
135130
"dependencies": {
136131
"@libp2p/interfaces": "^2.0.0",
137-
"@libp2p/peer-id": "^1.1.0"
132+
"@multiformats/multiaddr": "^10.2.0"
138133
},
139134
"devDependencies": {
140-
"@libp2p/peer-id-factory": "^1.0.0",
141-
"aegir": "^37.0.7"
135+
"aegir": "^37.0.17"
142136
}
143137
}

packages/libp2p-interfaces/src/address-manager/index.ts renamed to packages/interface-address-manager/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { Multiaddr } from '@multiformats/multiaddr'
2-
import type { EventEmitter } from '../events.js'
2+
import type { EventEmitter } from '@libp2p/interfaces/events'
33

44
export interface AddressManagerEvents {
55
/**

packages/libp2p-logger/tsconfig.json renamed to packages/interface-address-manager/tsconfig.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@
44
"outDir": "dist"
55
},
66
"include": [
7-
"src",
8-
"test"
7+
"src"
98
],
109
"references": [
1110
{
12-
"path": "../libp2p-interfaces"
11+
"path": "../interfaces"
1312
}
1413
]
1514
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# @libp2p/interface-compliance-tests <!-- omit in toc -->
2+
3+
[![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)
4+
5+
> Compliance tests for JS libp2p interfaces
6+
7+
## Table of contents <!-- omit in toc -->
8+
9+
- [Install](#install)
10+
- [Usage](#usage)
11+
- [License](#license)
12+
- [Contribution](#contribution)
13+
14+
## Install
15+
16+
```console
17+
$ npm i @libp2p/interface-compliance-tests
18+
```
19+
20+
## Usage
21+
22+
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.
23+
24+
## License
25+
26+
Licensed under either of
27+
28+
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
29+
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
30+
31+
### Contribution
32+
33+
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.
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
{
2+
"name": "@libp2p/interface-compliance-tests",
3+
"version": "2.0.3",
4+
"description": "Compliance tests for JS libp2p interfaces",
5+
"license": "Apache-2.0 OR MIT",
6+
"homepage": "https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-compliance-tests#readme",
7+
"repository": {
8+
"type": "git",
9+
"url": "git+https://github.com/libp2p/js-libp2p-interfaces.git"
10+
},
11+
"bugs": {
12+
"url": "https://github.com/libp2p/js-libp2p-interfaces/issues"
13+
},
14+
"keywords": [
15+
"interface",
16+
"libp2p"
17+
],
18+
"engines": {
19+
"node": ">=16.0.0",
20+
"npm": ">=7.0.0"
21+
},
22+
"type": "module",
23+
"types": "./dist/src/index.d.ts",
24+
"typesVersions": {
25+
"*": {
26+
"*": [
27+
"*",
28+
"dist/*",
29+
"dist/src/*",
30+
"dist/src/*/index"
31+
],
32+
"src/*": [
33+
"*",
34+
"dist/*",
35+
"dist/src/*",
36+
"dist/src/*/index"
37+
]
38+
}
39+
},
40+
"files": [
41+
"src",
42+
"dist/src",
43+
"!dist/test",
44+
"!**/*.tsbuildinfo"
45+
],
46+
"exports": {
47+
".": {
48+
"types": "./dist/src/index.d.ts",
49+
"import": "./dist/src/index.js"
50+
},
51+
"./is-valid-tick": {
52+
"types": "./dist/src/is-valid-tick.d.ts",
53+
"import": "./dist/src/is-valid-tick.js"
54+
},
55+
"./peers": {
56+
"types": "./dist/src/peers.d.ts",
57+
"import": "./dist/src/peers.js"
58+
}
59+
},
60+
"eslintConfig": {
61+
"extends": "ipfs",
62+
"parserOptions": {
63+
"sourceType": "module"
64+
}
65+
},
66+
"release": {
67+
"branches": [
68+
"master"
69+
],
70+
"plugins": [
71+
[
72+
"@semantic-release/commit-analyzer",
73+
{
74+
"preset": "conventionalcommits",
75+
"releaseRules": [
76+
{
77+
"breaking": true,
78+
"release": "major"
79+
},
80+
{
81+
"revert": true,
82+
"release": "patch"
83+
},
84+
{
85+
"type": "feat",
86+
"release": "minor"
87+
},
88+
{
89+
"type": "fix",
90+
"release": "patch"
91+
},
92+
{
93+
"type": "chore",
94+
"release": "patch"
95+
},
96+
{
97+
"type": "docs",
98+
"release": "patch"
99+
},
100+
{
101+
"type": "test",
102+
"release": "patch"
103+
},
104+
{
105+
"scope": "no-release",
106+
"release": false
107+
}
108+
]
109+
}
110+
],
111+
[
112+
"@semantic-release/release-notes-generator",
113+
{
114+
"preset": "conventionalcommits",
115+
"presetConfig": {
116+
"types": [
117+
{
118+
"type": "feat",
119+
"section": "Features"
120+
},
121+
{
122+
"type": "fix",
123+
"section": "Bug Fixes"
124+
},
125+
{
126+
"type": "chore",
127+
"section": "Trivial Changes"
128+
},
129+
{
130+
"type": "docs",
131+
"section": "Trivial Changes"
132+
},
133+
{
134+
"type": "test",
135+
"section": "Tests"
136+
}
137+
]
138+
}
139+
}
140+
],
141+
"@semantic-release/changelog",
142+
"@semantic-release/npm",
143+
"@semantic-release/github",
144+
"@semantic-release/git"
145+
]
146+
},
147+
"scripts": {
148+
"clean": "aegir clean",
149+
"lint": "aegir lint",
150+
"dep-check": "aegir dep-check",
151+
"build": "aegir build",
152+
"release": "aegir release"
153+
},
154+
"dependencies": {
155+
"aegir": "^37.0.17"
156+
}
157+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# @libp2p/interface-connection-compliance-tests <!-- omit in toc -->
2+
3+
[![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)
4+
5+
> Compliance tests for implementations of the libp2p Connection interface
6+
7+
## Table of contents <!-- omit in toc -->
8+
9+
- [Install](#install)
10+
- [Usage](#usage)
11+
- [License](#license)
12+
- [Contribution](#contribution)
13+
14+
## Install
15+
16+
```console
17+
$ npm i @libp2p/interface-connection-compliance-tests
18+
```
19+
20+
## Usage
21+
22+
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.
23+
24+
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.
25+
26+
Publishing a test suite as a module lets multiple modules ensure compatibility since they use the same test suite.
27+
28+
```js
29+
import tests from '@libp2p/interface-connection-compliance-tests'
30+
31+
describe('your connection', () => {
32+
tests({
33+
// Options should be passed to your connection
34+
async setup (options) {
35+
return YourConnection
36+
},
37+
async teardown () {
38+
// cleanup resources created by setup()
39+
}
40+
})
41+
})
42+
```
43+
44+
## License
45+
46+
Licensed under either of
47+
48+
- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)
49+
- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)
50+
51+
### Contribution
52+
53+
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.

0 commit comments

Comments
 (0)