Compare commits
No commits in common. "develop" and "master" have entirely different histories.
|
@ -1,13 +0,0 @@
|
|||
name: Build/Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- develop
|
||||
- develop-*
|
||||
|
||||
jobs:
|
||||
main:
|
||||
uses: lumeweb/github-node-deploy-workflow/.github/workflows/main.yml@master
|
||||
secrets: inherit
|
|
@ -1,17 +0,0 @@
|
|||
{
|
||||
"preset": [
|
||||
"@lumeweb/presetter-kernel-module-preset"
|
||||
],
|
||||
"config": {
|
||||
"vite": {
|
||||
"resolve": {
|
||||
"alias": {
|
||||
"protomux": "@lumeweb/kernel-protomux-client"
|
||||
}
|
||||
},
|
||||
"optimize": {
|
||||
"@achingbrain/nat-port-mapper": "export default {}; export const upnpNat = {};"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
110
CHANGELOG.md
110
CHANGELOG.md
|
@ -1,110 +0,0 @@
|
|||
# [0.1.0-develop.23](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.22...v0.1.0-develop.23) (2023-10-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add hypercoreTransport back ([483ac62](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/483ac62f96d5a968666661468bd108a7ca57a8bb))
|
||||
* need to use dns friendly cids for IPNS ([861a822](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/861a8229d49da93158c2ec1e41747a2d9c14b13f))
|
||||
* remove delegated routing again ([2b3b6dd](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/2b3b6dd0f396875b030a9dd81cad52cac3ac284f))
|
||||
|
||||
# [0.1.0-develop.22](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.21...v0.1.0-develop.22) (2023-10-15)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* networkReady should start as false ([a07dc0d](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/a07dc0d613ee0ba79acf6c01df8eb34c58512939))
|
||||
|
||||
# [0.1.0-develop.21](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.20...v0.1.0-develop.21) (2023-10-13)
|
||||
|
||||
# [0.1.0-develop.20](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.19...v0.1.0-develop.20) (2023-10-12)
|
||||
|
||||
# [0.1.0-develop.19](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.18...v0.1.0-develop.19) (2023-09-09)
|
||||
|
||||
# [0.1.0-develop.18](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.17...v0.1.0-develop.18) (2023-09-09)
|
||||
|
||||
# [0.1.0-develop.17](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.16...v0.1.0-develop.17) (2023-09-03)
|
||||
|
||||
# [0.1.0-develop.16](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.15...v0.1.0-develop.16) (2023-09-02)
|
||||
|
||||
# [0.1.0-develop.15](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.14...v0.1.0-develop.15) (2023-07-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add delegatedContentRouting back for now ([6298d8e](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/6298d8e914eafdc62a23b0bad548902545489c4e))
|
||||
|
||||
# [0.1.0-develop.14](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.13...v0.1.0-develop.14) (2023-07-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* if the network is ready then fetch the peer count ([a27aeb2](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/a27aeb2ec8493b933b3305b2b14e3c960d7c1d0c))
|
||||
|
||||
# [0.1.0-develop.13](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.12...v0.1.0-develop.13) (2023-07-31)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add event listener on libp2p start for redundancy to ensure we max the events to read the peer count ([f1b8a60](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/f1b8a603dfdca93e08692e7ad29fd2466c76d6d0))
|
||||
|
||||
# [0.1.0-develop.12](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.11...v0.1.0-develop.12) (2023-07-30)
|
||||
|
||||
# [0.1.0-develop.11](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.10...v0.1.0-develop.11) (2023-07-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add ipni fallback ([a61b0d4](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/a61b0d4771e885092bb47216f5fd525fa27caf4b))
|
||||
|
||||
# [0.1.0-develop.10](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.9...v0.1.0-develop.10) (2023-07-29)
|
||||
|
||||
# [0.1.0-develop.9](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.8...v0.1.0-develop.9) (2023-07-29)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add name api call ([005a128](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/005a128a2c159ca88199bb85598a24fd0c9b2da6))
|
||||
|
||||
# [0.1.0-develop.8](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.7...v0.1.0-develop.8) (2023-07-24)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* patch noble ed25519 to inject @peculiar/webcrypto ([d739b0a](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/d739b0a28697450e7fe46e96e43edfa5446d8885))
|
||||
|
||||
# [0.1.0-develop.7](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.6...v0.1.0-develop.7) (2023-07-23)
|
||||
|
||||
# [0.1.0-develop.6](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.5...v0.1.0-develop.6) (2023-07-23)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add status api ([16dcaaf](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/16dcaafd781ee3957a489c73b8027b2eabca648f))
|
||||
|
||||
# [0.1.0-develop.5](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.4...v0.1.0-develop.5) (2023-07-23)
|
||||
|
||||
# [0.1.0-develop.4](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.3...v0.1.0-develop.4) (2023-07-23)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* need to override protomux with our kernel-protomux-client ([7c8490c](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/7c8490c6f50d2b91880b1aea20f69ce4492dfb01))
|
||||
|
||||
# [0.1.0-develop.3](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.2...v0.1.0-develop.3) (2023-07-21)
|
||||
|
||||
# [0.1.0-develop.2](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.1.0-develop.1...v0.1.0-develop.2) (2023-07-19)
|
||||
|
||||
# [0.1.0-develop.1](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.0.2-develop.4...v0.1.0-develop.1) (2023-07-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* add register method for network registry ([663a67c](https://git.lumeweb.com/LumeWeb/kernel-ipfs/commit/663a67c7ba9450c6a499f6ce3dcb06d0245476d3))
|
||||
|
||||
## [0.0.2-develop.4](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.0.2-develop.3...v0.0.2-develop.4) (2023-07-12)
|
||||
|
||||
## [0.0.2-develop.3](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.0.2-develop.2...v0.0.2-develop.3) (2023-07-09)
|
||||
|
||||
## [0.0.2-develop.2](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.0.2-develop.1...v0.0.2-develop.2) (2023-07-08)
|
||||
|
||||
## [0.0.2-develop.1](https://git.lumeweb.com/LumeWeb/kernel-ipfs/compare/v0.0.1...v0.0.2-develop.1) (2023-07-06)
|
|
@ -0,0 +1,14 @@
|
|||
import esbuild from "esbuild";
|
||||
|
||||
esbuild.buildSync({
|
||||
entryPoints: ["src/index.ts"],
|
||||
outfile: "dist/index.js",
|
||||
format: "iife",
|
||||
bundle: true,
|
||||
legalComments: "external",
|
||||
// minify: true
|
||||
define: {
|
||||
global: "self",
|
||||
},
|
||||
inject: ["polyfill.js"],
|
||||
});
|
File diff suppressed because it is too large
Load Diff
145
package.json
145
package.json
|
@ -1,59 +1,116 @@
|
|||
{
|
||||
"name": "@lumeweb/kernel-ipfs",
|
||||
"version": "0.1.0-develop.23",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "gitea@git.lumeweb.com:LumeWeb/kernel-ipfs.git"
|
||||
},
|
||||
"scripts": {
|
||||
"prepare": "presetter bootstrap",
|
||||
"build": "run build",
|
||||
"semantic-release": "semantic-release",
|
||||
"postinstall": "patch-package"
|
||||
"test": "jest",
|
||||
"build-script": "tsc --project tsconfig.build.json && mv dist-build/build.js dist-build/build.mjs",
|
||||
"compile": "npm run build-script && node build.js",
|
||||
"build": "npm run compile && node ./dist-build/build.mjs dev"
|
||||
},
|
||||
"dependencies": {
|
||||
"@helia/ipns": "^1.1.3",
|
||||
"@helia/unixfs": "^1.4.0",
|
||||
"@libp2p/delegated-content-routing": "^4.0.6",
|
||||
"@libp2p/delegated-peer-routing": "^4.0.9",
|
||||
"@libp2p/peer-id": "^2.0.4",
|
||||
"@libp2p/reframe-content-routing": "^1.0.1",
|
||||
"@libp2p/tcp": "7.0.3",
|
||||
"@lumeweb/kernel-network-registry-client": "^0.1.0-develop.10",
|
||||
"@lumeweb/kernel-protomux-client": "^0.0.2-develop.22",
|
||||
"@lumeweb/kernel-swarm-client": "0.1.0-develop.12",
|
||||
"@lumeweb/libhyperproxy": "^0.0.2-develop.4",
|
||||
"@lumeweb/libkernel": "0.1.0-develop.66",
|
||||
"@lumeweb/presetter-kernel-module-preset": "^0.1.0-develop.44",
|
||||
"@peculiar/webcrypto": "^1.4.3",
|
||||
"blockstore-idb": "^1.1.1",
|
||||
"datastore-core": "^9.2.0",
|
||||
"datastore-idb": "^2.1.2",
|
||||
"helia": "^2.0.3-43932a5",
|
||||
"ipfs-http-client": "^60.0.1",
|
||||
"ipns": "^7.0.1",
|
||||
"multiformats": "^12.0.1",
|
||||
"@chainsafe/libp2p-gossipsub": "^6.3.0",
|
||||
"@chainsafe/libp2p-noise": "^11.0.4",
|
||||
"@chainsafe/libp2p-yamux": "^3.0.10",
|
||||
"@dao-xyz/libp2p-noise": "^11.1.3",
|
||||
"@helia/ipns": "^1.1.0",
|
||||
"@helia/unixfs": "^1.2.2",
|
||||
"@libp2p/bootstrap": "^6.0.3",
|
||||
"@libp2p/crypto": "^1.0.15",
|
||||
"@libp2p/delegated-content-routing": "^4.0.3",
|
||||
"@libp2p/delegated-peer-routing": "^4.0.5",
|
||||
"@libp2p/interface-metrics": "^4.0.6",
|
||||
"@libp2p/interfaces": "^3.3.1",
|
||||
"@libp2p/logger": "^2.0.7",
|
||||
"@libp2p/mplex": "^7.1.7",
|
||||
"@libp2p/tcp": "^6.2.1",
|
||||
"@libp2p/utils": "^3.0.8",
|
||||
"@lumeweb/kernel-protomux-client": "git+https://git.lumeweb.com/LumeWeb/kernel-protomux-client.git",
|
||||
"@lumeweb/kernel-swarm-client": "git+https://git.lumeweb.com/LumeWeb/kernel-swarm-client.git",
|
||||
"@lumeweb/libkernel-universal": "git+https://git.lumeweb.com/LumeWeb/libkernel-universal.git",
|
||||
"@multiformats/mafmt": "^11.1.2",
|
||||
"@peculiar/webcrypto": "git+https://git.lumeweb.com/LumeWeb/webcrypto.git",
|
||||
"b4a": "^1.6.3",
|
||||
"blockstore-idb": "^1.1.0",
|
||||
"buffer": "^6.0.3",
|
||||
"compact-encoding": "^2.11.0",
|
||||
"datastore-core": "^8.0.4",
|
||||
"datastore-idb": "^2.1.1",
|
||||
"helia": "^0.0.1",
|
||||
"ipfs-http-client": "^60.0.0",
|
||||
"ipfs-in-memory-repo": "^0.1.0",
|
||||
"libkmodule": "^0.2.53",
|
||||
"libp2p": "^0.42.2",
|
||||
"multiformats": "^11.0.2",
|
||||
"p-defer": "^4.0.0",
|
||||
"path-browserify": "^1.0.1",
|
||||
"p-queue": "^7.3.4",
|
||||
"private-ip": "^3.0.0",
|
||||
"rewire": "^6.0.0",
|
||||
"runes2": "^1.1.2",
|
||||
"serialize-error": "^11.0.0",
|
||||
"sodium-universal": "^4.0.0",
|
||||
"streamx": "^2.13.2",
|
||||
"timers-browserify": "^2.0.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rollup/plugin-alias": "^5.0.0",
|
||||
"@helia/interface": "^0.0.0",
|
||||
"@libp2p/interface-connection": "^3.1.1",
|
||||
"@libp2p/interface-peer-info": "^1.0.9",
|
||||
"@libp2p/interface-transport": "^2.1.3",
|
||||
"@libp2p/kad-dht": "^7.0.3",
|
||||
"@libp2p/peer-id": "^2.0.3",
|
||||
"@libp2p/peer-id-factory": "^2.0.3",
|
||||
"@libp2p/websockets": "^5.0.10",
|
||||
"@lumeweb/libhyperproxy": "git+https://git.lumeweb.com/LumeWeb/libhyperproxy.git",
|
||||
"@multiformats/multiaddr": "^11.6.1",
|
||||
"@scure/bip39": "^1.2.0",
|
||||
"@skynetlabs/skynet-nodejs": "^2.9.0",
|
||||
"@types/b4a": "^1.6.0",
|
||||
"@types/events": "^3.0.0",
|
||||
"@types/node": "^18.15.11",
|
||||
"@types/read": "^0.0.29",
|
||||
"@types/rewire": "^2.5.28",
|
||||
"@types/streamx": "^2.9.1",
|
||||
"@types/ws": "^8.5.4",
|
||||
"cli-progress": "^3.12.0",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"esbuild": "^0.14.54",
|
||||
"http-browserify": "^1.7.0",
|
||||
"hyperswarm": "^4.4.0",
|
||||
"interface-store": "^3.0.4",
|
||||
"it-all": "^2.0.1",
|
||||
"it-ws": "^5.0.6",
|
||||
"libskynet": "^0.1.9",
|
||||
"libskynetnode": "^0.1.4",
|
||||
"net-browserify": "^0.2.4",
|
||||
"os-browserify": "^0.3.0",
|
||||
"patch-package": "^7.0.0",
|
||||
"rollup-plugin-ignore-import": "^1.3.2"
|
||||
"p-timeout": "^6.1.1",
|
||||
"path-browserify": "^1.0.1",
|
||||
"prettier": "^2.8.7",
|
||||
"prom-client": "^14.2.0",
|
||||
"read": "^1.0.7",
|
||||
"stream-browserify": "^3.0.0",
|
||||
"tslib": "^2.5.0",
|
||||
"typescript": "^4.9.5",
|
||||
"url-browser": "^0.1.7",
|
||||
"util-browser": "^0.0.2"
|
||||
},
|
||||
"overrides": {
|
||||
"libp2p": "^0.46.6",
|
||||
"@libp2p/kad-dht": "^10.0.2",
|
||||
"@chainsafe/libp2p-noise": "^12.0.0",
|
||||
"@libp2p/mplex": "^9.0.2",
|
||||
"@libp2p/bootstrap": "^9.0.2",
|
||||
"@chainsafe/libp2p-gossipsub": "^10.0.0",
|
||||
"@libp2p/interface-datastore": "^8.0.0",
|
||||
"@libp2p/interface-blockstore": "^5.0.0"
|
||||
"browser": {
|
||||
"libkernel": false,
|
||||
"timers": "timers-browserify",
|
||||
"path": "path-browserify",
|
||||
"os": "os-browserify",
|
||||
"net": "./src/net.ts",
|
||||
"crypto": "crypto-browserify",
|
||||
"stream": "stream-browserify"
|
||||
},
|
||||
"pnpm": {
|
||||
"overrides": {
|
||||
"protomux": "git+https://git.lumeweb.com/LumeWeb/kernel-protomux-client.git"
|
||||
},
|
||||
"patchedDependencies": {
|
||||
"@libp2p/tcp@6.2.1": "patches/@libp2p__tcp@6.2.1.patch",
|
||||
"b4a@1.6.3": "patches/b4a@1.6.3.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
diff --git a/node_modules/@libp2p/tcp/dist/src/index.js b/node_modules/@libp2p/tcp/dist/src/index.js
|
||||
index fe47701..d239a6a 100644
|
||||
--- a/node_modules/@libp2p/tcp/dist/src/index.js
|
||||
+++ b/node_modules/@libp2p/tcp/dist/src/index.js
|
||||
@@ -8,7 +8,7 @@ import { TCPListener } from './listener.js';
|
||||
import { toMultiaddrConnection } from './socket-to-conn.js';
|
||||
import { multiaddrToNetConfig } from './utils.js';
|
||||
const log = logger('libp2p:tcp');
|
||||
-class TCP {
|
||||
+export class TCP {
|
||||
opts;
|
||||
metrics;
|
||||
components;
|
||||
diff --git a/node_modules/@libp2p/tcp/package.json b/node_modules/@libp2p/tcp/package.json
|
||||
index e4524a9..74fa657 100644
|
||||
--- a/node_modules/@libp2p/tcp/package.json
|
||||
+++ b/node_modules/@libp2p/tcp/package.json
|
||||
@@ -32,12 +32,20 @@
|
||||
"!dist/test",
|
||||
"!**/*.tsbuildinfo"
|
||||
],
|
||||
- "exports": {
|
||||
- ".": {
|
||||
- "types": "./dist/src/index.d.ts",
|
||||
- "import": "./dist/src/index.js"
|
||||
- }
|
||||
- },
|
||||
+ "exports": {
|
||||
+ ".": {
|
||||
+ "types": "./dist/src/index.d.ts",
|
||||
+ "import": "./dist/src/index.js"
|
||||
+ },
|
||||
+ "./socket-to-conn": {
|
||||
+ "types": "./dist/src/socket-to-conn.d.ts",
|
||||
+ "import": "./dist/src/socket-to-conn.js"
|
||||
+ },
|
||||
+ "./utils": {
|
||||
+ "types": "./dist/src/utils.d.ts",
|
||||
+ "import": "./dist/src/utils.js"
|
||||
+ }
|
||||
+ },
|
||||
"eslintConfig": {
|
||||
"extends": "ipfs",
|
||||
"parserOptions": {
|
|
@ -0,0 +1,32 @@
|
|||
diff --git a/dist/src/index.js b/dist/src/index.js
|
||||
index dab2ad35e64981f00c59a48ccbcbe407eb7749e6..7179d4ad8137be05e5f080ca67ea433c9dfaeeb0 100644
|
||||
--- a/dist/src/index.js
|
||||
+++ b/dist/src/index.js
|
||||
@@ -8,7 +8,7 @@ import { AbortError, CodeError } from '@libp2p/interfaces/errors';
|
||||
import { CODE_CIRCUIT, CODE_P2P, CODE_UNIX } from './constants.js';
|
||||
import { symbol } from '@libp2p/interface-transport';
|
||||
const log = logger('libp2p:tcp');
|
||||
-class TCP {
|
||||
+export class TCP {
|
||||
constructor(components, options = {}) {
|
||||
this.opts = options;
|
||||
this.components = components;
|
||||
diff --git a/package.json b/package.json
|
||||
index 2e38ab0bdeef25a898770aedd0459e8c0cd79a9b..9ec4c16e10347e5f9717998725387b30d5b59907 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -36,6 +36,14 @@
|
||||
".": {
|
||||
"types": "./dist/src/index.d.ts",
|
||||
"import": "./dist/src/index.js"
|
||||
+ },
|
||||
+ "./socket-to-conn": {
|
||||
+ "types": "./dist/src/socket-to-conn.d.ts",
|
||||
+ "import": "./dist/src/socket-to-conn.js"
|
||||
+ },
|
||||
+ "./utils": {
|
||||
+ "types": "./dist/src/utils.d.ts",
|
||||
+ "import": "./dist/src/utils.js"
|
||||
}
|
||||
},
|
||||
"eslintConfig": {
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,36 @@
|
|||
diff --git a/browser.js b/browser.js
|
||||
index e07f78d17b7b4a2963e4f0062047cc96e6025f9e..a9f266a2644f3f8ebd0f6684b3e11a7519059851 100644
|
||||
--- a/browser.js
|
||||
+++ b/browser.js
|
||||
@@ -3,6 +3,7 @@ const base64 = require('./lib/base64')
|
||||
const hex = require('./lib/hex')
|
||||
const utf8 = require('./lib/utf8')
|
||||
const utf16le = require('./lib/utf16le')
|
||||
+const Buffer = require('buffer').Buffer
|
||||
|
||||
const LE = new Uint8Array(Uint16Array.of(0xff).buffer)[0] === 0xff
|
||||
|
||||
diff --git a/index.js b/index.js
|
||||
index a751d6b4d27c7dd903efbfdc87a98f61044a62b8..8bd32640afdcfbc475168d458c51f8b9162d1656 100644
|
||||
--- a/index.js
|
||||
+++ b/index.js
|
||||
@@ -1,3 +1,5 @@
|
||||
+const Buffer = require('buffer').Buffer
|
||||
+
|
||||
function isBuffer (value) {
|
||||
return Buffer.isBuffer(value) || value instanceof Uint8Array
|
||||
}
|
||||
diff --git a/package.json b/package.json
|
||||
index eb0f792709b27e66f26658054781b4099507b5ed..69c4ff39c48b0bdd5f0bc7ebbade517e7c5d76e4 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -8,9 +8,6 @@
|
||||
"index.js",
|
||||
"lib"
|
||||
],
|
||||
- "browser": {
|
||||
- "./index.js": "./browser.js"
|
||||
- },
|
||||
"scripts": {
|
||||
"test": "standard && brittle test/*.mjs"
|
||||
},
|
|
@ -0,0 +1,13 @@
|
|||
import { Crypto } from "@peculiar/webcrypto";
|
||||
import { Buffer } from "buffer";
|
||||
|
||||
let globalCrypto = self.crypto;
|
||||
if (!globalCrypto.subtle) {
|
||||
let subtleCrypto = new Crypto().subtle;
|
||||
Object.defineProperty(globalCrypto, "subtle", {
|
||||
get() {
|
||||
return subtleCrypto;
|
||||
},
|
||||
});
|
||||
}
|
||||
export { Buffer };
|
|
@ -0,0 +1,218 @@
|
|||
// This is the standard build script for a kernel module.
|
||||
|
||||
import * as fs from "fs";
|
||||
import read from "read";
|
||||
import * as bip39 from "@scure/bip39";
|
||||
import { wordlist } from "@scure/bip39/wordlists/english.js";
|
||||
//@ts-ignore
|
||||
import { SkynetClient } from "@skynetlabs/skynet-nodejs";
|
||||
|
||||
// Helper variables to make it easier to return empty values alongside errors.
|
||||
const nu8 = new Uint8Array(0);
|
||||
const nkp = {
|
||||
publicKey: nu8,
|
||||
secretKey: nu8,
|
||||
};
|
||||
|
||||
// readFile is a wrapper for fs.readFileSync that handles the try-catch for the
|
||||
// caller.
|
||||
function readFile(fileName: string): [string, string | null] {
|
||||
try {
|
||||
let data = fs.readFileSync(fileName, "utf8");
|
||||
return [data, null];
|
||||
} catch (err) {
|
||||
return ["", "unable to read file: " + JSON.stringify(err)];
|
||||
}
|
||||
}
|
||||
|
||||
// readFileBinary is a wrapper for fs.readFileSync that handles the try-catch
|
||||
// for the caller.
|
||||
function readFileBinary(fileName: string): [Uint8Array, string | null] {
|
||||
try {
|
||||
let data = fs.readFileSync(fileName, null);
|
||||
return [data, null];
|
||||
} catch (err) {
|
||||
return [nu8, "unable to read file: " + JSON.stringify(err)];
|
||||
}
|
||||
}
|
||||
|
||||
// writeFile is a wrapper for fs.writeFileSync which handles the try-catch in a
|
||||
// non-exception way.
|
||||
function writeFile(fileName: string, fileData: string): string | null {
|
||||
try {
|
||||
fs.writeFileSync(fileName, fileData);
|
||||
return null;
|
||||
} catch (err) {
|
||||
return "unable to write file: " + JSON.stringify(err);
|
||||
}
|
||||
}
|
||||
|
||||
// handlePass handles all portions of the script that occur after the password
|
||||
// has been requested. If no password needs to be requested, handlePass will be
|
||||
// called with a null input. We need to structure the code this way because the
|
||||
// password reader is async and we can only access the password when using a
|
||||
// callback.
|
||||
function handlePass(password: string) {
|
||||
try {
|
||||
// If we are running prod and the seed file does not exist, we
|
||||
// need to confirm the password and also warn the user to use a
|
||||
// secure password.
|
||||
if (!fs.existsSync(seedFile) && process.argv[2] === "prod") {
|
||||
// The file does not exist, we need to confirm the
|
||||
// password.
|
||||
console.log();
|
||||
console.log(
|
||||
"No production entry found for module. Creating new production module..."
|
||||
);
|
||||
console.log(
|
||||
"If someone can guess the password, they can push arbitrary changes to your module."
|
||||
);
|
||||
console.log("Please use a secure password.");
|
||||
console.log();
|
||||
read(
|
||||
{ prompt: "Confirm Password: ", silent: true },
|
||||
function (err: any, confirmPassword: string) {
|
||||
if (err) {
|
||||
console.error("unable to fetch password:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
if (password !== confirmPassword) {
|
||||
console.error("passwords do not match");
|
||||
process.exit(1);
|
||||
}
|
||||
handlePassConfirm(moduleSalt, password);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// If the seed file does exist, or if we are using dev,
|
||||
// there's no need to confirm the password but we do
|
||||
// need to pass the logic off to the handlePassConfirm
|
||||
// callback.
|
||||
handlePassConfirm(moduleSalt, password);
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Unable to read seedFile:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
// handlePassConfirm handles the full script after the confirmation password
|
||||
// has been provided. If not confirmation password is needed, this function
|
||||
// will be called anyway using the unconfirmed password as input.
|
||||
function handlePassConfirm(seed: string, password: string) {
|
||||
// Create the seedFile if it does not exist. For dev we just save the
|
||||
// seed to disk outright, because this is a dev build and therefore not
|
||||
// security sensitive. Also the dev seed does not get pushed to the
|
||||
// github repo.
|
||||
//
|
||||
// For prod, we use the seed to create a new seed (called the shield)
|
||||
// which allows us to verify that the developer has provided the right
|
||||
// password when deploying the module. The shield does get pushed to
|
||||
// the github repo so that the production module is the same on all
|
||||
// devices.
|
||||
if (!fs.existsSync(seedFile) && process.argv[2] !== "prod") {
|
||||
// Generate the seed phrase and write it to the file.
|
||||
let seedPhrase = bip39.generateMnemonic(wordlist);
|
||||
let errWF = writeFile(seedFile, seedPhrase);
|
||||
if (errWF !== null) {
|
||||
console.error("unable to write file:", errWF);
|
||||
process.exit(1);
|
||||
}
|
||||
} else if (!fs.existsSync(seedFile) && process.argv[2] === "prod") {
|
||||
// Generate the seed phrase.
|
||||
let seedPhrase = bip39.generateMnemonic(wordlist);
|
||||
// Write the registry link to the file.
|
||||
}
|
||||
|
||||
// Load or verify the seed. If this is prod, the password is used to
|
||||
// create and verify the seed. If this is dev, we just load the seed
|
||||
// with no password.
|
||||
let seedPhrase: string;
|
||||
let registryLink: string;
|
||||
if (process.argv[2] === "prod") {
|
||||
// Generate the seed phrase from the password.
|
||||
seedPhrase = bip39.generateMnemonic(wordlist);
|
||||
} else {
|
||||
let [sp, errRF] = readFile(seedFile);
|
||||
if (errRF !== null) {
|
||||
console.error("unable to read seed phrase for dev command from disk");
|
||||
process.exit(1);
|
||||
}
|
||||
seedPhrase = sp;
|
||||
}
|
||||
|
||||
let metadata = {
|
||||
Filename: "index.js",
|
||||
};
|
||||
const client = new SkynetClient("https://web3portal.com");
|
||||
client
|
||||
.uploadFile("dist/index.js")
|
||||
.then((result: any) => {
|
||||
console.log("Immutable Link for module:", result);
|
||||
})
|
||||
.catch((err: any) => {
|
||||
console.error("unable to upload file", err);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
|
||||
// Add a newline for readability.
|
||||
console.log();
|
||||
|
||||
// Check for a 'dev' or 'prod' input to the script.
|
||||
if (process.argv.length !== 3) {
|
||||
console.error("need to provide either 'dev' or 'prod' as an input");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// Create the build folder if it does not exist.
|
||||
if (!fs.existsSync("build")) {
|
||||
fs.mkdirSync("build");
|
||||
}
|
||||
|
||||
// Determine the seed file.
|
||||
let seedFile: string;
|
||||
if (process.argv[2] === "prod") {
|
||||
seedFile = "module-skylink";
|
||||
} else if (process.argv[2] === "dev") {
|
||||
seedFile = "build/dev-seed";
|
||||
} else {
|
||||
console.error("need to provide either 'dev' or 'prod' as an input");
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// If doing a prod deployment, check whether the salt file exists. If it does
|
||||
// not, create it.
|
||||
let moduleSalt: string;
|
||||
if (!fs.existsSync(".module-salt")) {
|
||||
moduleSalt = bip39.generateMnemonic(wordlist);
|
||||
let errWF = writeFile(".module-salt", moduleSalt);
|
||||
if (errWF !== null) {
|
||||
console.error("unable to write module salt file:", errWF);
|
||||
process.exit(1);
|
||||
}
|
||||
} else {
|
||||
let [ms, errRF] = readFile(".module-salt");
|
||||
if (errRF !== null) {
|
||||
console.error("unable to read moduleSalt");
|
||||
process.exit(1);
|
||||
}
|
||||
ms = ms.replace(/\n$/, "");
|
||||
moduleSalt = ms;
|
||||
}
|
||||
|
||||
// Need to get a password if this is a prod build.
|
||||
if (process.argv[2] === "prod") {
|
||||
read(
|
||||
{ prompt: "Password: ", silent: true },
|
||||
function (err: any, password: string) {
|
||||
if (err) {
|
||||
console.error("unable to fetch password:", err);
|
||||
process.exit(1);
|
||||
}
|
||||
handlePass(password);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
handlePass("");
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
import type { BootstrapInit } from "@libp2p/bootstrap";
|
||||
|
||||
export const bootstrapConfig = {
|
||||
list: [
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
|
||||
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
|
||||
// Cloudflare
|
||||
"/dnsaddr/node-1.ingress.cloudflare-ipfs.com/p2p/QmcFf2FH3CEgTNHeMRGhN7HNHU1EXAxoEk6EFuSyXCsvRE",
|
||||
"/dnsaddr/node-2.ingress.cloudflare-ipfs.com/p2p/QmcFmLd5ySfk2WZuJ1mfSWLDjdmHZq7rSAua4GoeSQfs1z",
|
||||
"/dnsaddr/node-3.ingress.cloudflare-ipfs.com/p2p/QmcfFmzSDVbwexQ9Au2pt5YEXHK5xajwgaU6PpkbLWerMa",
|
||||
"/dnsaddr/node-4.ingress.cloudflare-ipfs.com/p2p/QmcfJeB3Js1FG7T8YaZATEiaHqNKVdQfybYYkbT1knUswx",
|
||||
"/dnsaddr/node-5.ingress.cloudflare-ipfs.com/p2p/QmcfVvzK4tMdFmpJjEKDUoqRgP4W9FnmJoziYX5GXJJ8eZ",
|
||||
"/dnsaddr/node-6.ingress.cloudflare-ipfs.com/p2p/QmcfZD3VKrUxyP9BbyUnZDpbqDnT7cQ4WjPP8TRLXaoE7G",
|
||||
"/dnsaddr/node-7.ingress.cloudflare-ipfs.com/p2p/QmcfZP2LuW4jxviTeG8fi28qjnZScACb8PEgHAc17ZEri3",
|
||||
"/dnsaddr/node-8.ingress.cloudflare-ipfs.com/p2p/QmcfgsJsMtx6qJb74akCw1M24X1zFwgGo11h1cuhwQjtJP",
|
||||
"/dnsaddr/node-9.ingress.cloudflare-ipfs.com/p2p/Qmcfr2FC7pFzJbTSDfYaSy1J8Uuy8ccGLeLyqJCKJvTHMi",
|
||||
"/dnsaddr/node-10.ingress.cloudflare-ipfs.com/p2p/QmcfR3V5YAtHBzxVACWCzXTt26SyEkxdwhGJ6875A8BuWx",
|
||||
"/dnsaddr/node-11.ingress.cloudflare-ipfs.com/p2p/Qmcfuo1TM9uUiJp6dTbm915Rf1aTqm3a3dnmCdDQLHgvL5",
|
||||
"/dnsaddr/node-12.ingress.cloudflare-ipfs.com/p2p/QmcfV2sg9zaq7UUHVCGuSvT2M2rnLBAPsiE79vVyK3Cuev",
|
||||
// Estuary
|
||||
"/ip4/139.178.68.217/tcp/6744/p2p/12D3KooWCVXs8P7iq6ao4XhfAmKWrEeuKFWCJgqe9jGDMTqHYBjw",
|
||||
"/ip4/147.75.49.71/tcp/6745/p2p/12D3KooWGBWx9gyUFTVQcKMTenQMSyE2ad9m7c9fpjS4NMjoDien",
|
||||
"/ip4/147.75.86.255/tcp/6745/p2p/12D3KooWFrnuj5o3tx4fGD2ZVJRyDqTdzGnU3XYXmBbWbc8Hs8Nd",
|
||||
"/ip4/3.134.223.177/tcp/6745/p2p/12D3KooWN8vAoGd6eurUSidcpLYguQiGZwt4eVgDvbgaS7kiGTup",
|
||||
"/ip4/35.74.45.12/udp/6746/quic/p2p/12D3KooWLV128pddyvoG6NBvoZw7sSrgpMTPtjnpu3mSmENqhtL7",
|
||||
|
||||
// Pinata
|
||||
"/dnsaddr/fra1-1.hostnodes.pinata.cloud/p2p/QmWaik1eJcGHq1ybTWe7sezRfqKNcDRNkeBaLnGwQJz1Cj",
|
||||
"/dnsaddr/fra1-2.hostnodes.pinata.cloud/p2p/QmNfpLrQQZr5Ns9FAJKpyzgnDL2GgC6xBug1yUZozKFgu4",
|
||||
"/dnsaddr/fra1-3.hostnodes.pinata.cloud/p2p/QmPo1ygpngghu5it8u4Mr3ym6SEU2Wp2wA66Z91Y1S1g29",
|
||||
"/dnsaddr/nyc1-1.hostnodes.pinata.cloud/p2p/QmRjLSisUCHVpFa5ELVvX3qVPfdxajxWJEHs9kN3EcxAW6",
|
||||
"/dnsaddr/nyc1-2.hostnodes.pinata.cloud/p2p/QmPySsdmbczdZYBpbi2oq2WMJ8ErbfxtkG8Mo192UHkfGP",
|
||||
"/dnsaddr/nyc1-3.hostnodes.pinata.cloud/p2p/QmSarArpxemsPESa6FNkmuu9iSE1QWqPX2R3Aw6f5jq4D5",
|
||||
// Eternum
|
||||
"/dns4/door.eternum.io/tcp/4001/ipfs/QmVBxJ5GekATHi89H8jbXjaU6CosCnteomjNR5xar2aH3q",
|
||||
// Textile
|
||||
"/ip4/104.210.43.77/p2p/QmR69wtWUMm1TWnmuD4JqC1TWLZcc8iR2KrTenfZZbiztd",
|
||||
// 8api.sh
|
||||
"/ip4/78.46.108.24/p2p/12D3KooWGASC2jm3pmohEJXUhuStkxDitPgzvs4qMuFPaiD9x1BA",
|
||||
"/ip4/65.109.19.136/p2p/12D3KooWRbWZN3GvLf9CHmozq4vnTzDD4EEoiqtRJxg5FV6Gfjmm",
|
||||
|
||||
// Storj
|
||||
"/ip4/5.161.92.43/tcp/4001/p2p/12D3KooWFFhc8fPYnQXdWBCowxSV21EFYin3rU27p3NVgSMjN41k",
|
||||
"/ip4/5.161.92.43/udp/4001/quic/p2p/12D3KooWFFhc8fPYnQXdWBCowxSV21EFYin3rU27p3NVgSMjN41k",
|
||||
"/ip6/2a01:4ff:f0:3b1e::1/tcp/4001/p2p/12D3KooWFFhc8fPYnQXdWBCowxSV21EFYin3rU27p3NVgSMjN41k",
|
||||
"/ip6/2a01:4ff:f0:3b1e::1/udp/4001/quic/p2p/12D3KooWFFhc8fPYnQXdWBCowxSV21EFYin3rU27p3NVgSMjN41k",
|
||||
"/ip4/5.161.55.227/tcp/4001/p2p/12D3KooWSW4hoHmDXmY5rW7nCi9XmGTy3foFt72u86jNP53LTNBJ",
|
||||
"/ip4/5.161.55.227/udp/4001/quic/p2p/12D3KooWSW4hoHmDXmY5rW7nCi9XmGTy3foFt72u86jNP53LTNBJ",
|
||||
"/ip6/2a01:4ff:f0:1e5a::1/tcp/4001/p2p/12D3KooWSW4hoHmDXmY5rW7nCi9XmGTy3foFt72u86jNP53LTNBJ",
|
||||
"/ip6/2a01:4ff:f0:1e5a::1/udp/4001/quic/p2p/12D3KooWSW4hoHmDXmY5rW7nCi9XmGTy3foFt72u86jNP53LTNBJ",
|
||||
"/ip4/5.161.92.36/tcp/4001/p2p/12D3KooWSDj6JM2JmoHwE9AUUwqAFUEg9ndd3pMA8aF2bkYckZfo",
|
||||
"/ip4/5.161.92.36/udp/4001/quic/p2p/12D3KooWSDj6JM2JmoHwE9AUUwqAFUEg9ndd3pMA8aF2bkYckZfo",
|
||||
"/ip6/2a01:4ff:f0:3764::1/tcp/4001/p2p/12D3KooWSDj6JM2JmoHwE9AUUwqAFUEg9ndd3pMA8aF2bkYckZfo",
|
||||
"/ip6/2a01:4ff:f0:3764::1/udp/4001/quic/p2p/12D3KooWSDj6JM2JmoHwE9AUUwqAFUEg9ndd3pMA8aF2bkYckZfo",
|
||||
],
|
||||
} as BootstrapInit;
|
|
@ -1,84 +0,0 @@
|
|||
import { gossipsub } from "@chainsafe/libp2p-gossipsub";
|
||||
import { noise } from "@chainsafe/libp2p-noise";
|
||||
import { yamux } from "@chainsafe/libp2p-yamux";
|
||||
import { bootstrap } from "@libp2p/bootstrap";
|
||||
import { type DualKadDHT, kadDHT } from "@libp2p/kad-dht";
|
||||
import { mplex } from "@libp2p/mplex";
|
||||
import { ipnsSelector } from "ipns/selector";
|
||||
import { ipnsValidator } from "ipns/validator";
|
||||
import { autoNATService } from "libp2p/autonat";
|
||||
import { identifyService } from "libp2p/identify";
|
||||
import { bootstrapConfig } from "./bootstrap.js";
|
||||
import type { PubSub } from "@libp2p/interface-pubsub";
|
||||
import type { Libp2pOptions } from "libp2p";
|
||||
import { hypercoreTransport } from "./libp2p/transport.js";
|
||||
import { MultiSocketProxy } from "@lumeweb/libhyperproxy";
|
||||
import { ipniContentRouting } from "@libp2p/ipni-content-routing";
|
||||
import { reframeContentRouting } from "@libp2p/reframe-content-routing";
|
||||
import { multiaddr } from "@multiformats/multiaddr";
|
||||
import { create as createIpfsHttpClient } from "ipfs-http-client";
|
||||
import { delegatedContentRouting } from "@libp2p/delegated-content-routing";
|
||||
import { delegatedPeerRouting } from "@libp2p/delegated-peer-routing";
|
||||
import { circuitRelayTransport } from "libp2p/circuit-relay";
|
||||
import { DELEGATE_LIST } from "./constants.js";
|
||||
import { webSockets } from "@libp2p/websockets";
|
||||
import { webTransport } from "@libp2p/webtransport";
|
||||
import { dcutrService } from "libp2p/dcutr";
|
||||
// @ts-ignore
|
||||
import type { DefaultLibp2pServices } from "helia/dist/src/utils/libp2p-defaults.browser.js";
|
||||
|
||||
function getDelegateConfig(): any {
|
||||
const delegateString =
|
||||
DELEGATE_LIST[Math.floor(Math.random() * DELEGATE_LIST.length)];
|
||||
const delegateAddr = multiaddr(delegateString).toOptions();
|
||||
|
||||
return {
|
||||
// @ts-ignore
|
||||
host: delegateAddr.host,
|
||||
// @ts-ignore
|
||||
protocol: parseInt(delegateAddr.port) === 443 ? "https" : "http",
|
||||
port: delegateAddr.port,
|
||||
};
|
||||
}
|
||||
|
||||
export function libp2pConfig(
|
||||
proxy: MultiSocketProxy,
|
||||
): Libp2pOptions<DefaultLibp2pServices> {
|
||||
const client = createIpfsHttpClient(getDelegateConfig());
|
||||
|
||||
return {
|
||||
addresses: {
|
||||
listen: [],
|
||||
},
|
||||
transports: [
|
||||
hypercoreTransport({ proxy }),
|
||||
circuitRelayTransport({
|
||||
discoverRelays: 1,
|
||||
}),
|
||||
webTransport(),
|
||||
webSockets(),
|
||||
],
|
||||
connectionEncryption: [noise()],
|
||||
streamMuxers: [yamux(), mplex()],
|
||||
peerDiscovery: [bootstrap(bootstrapConfig)],
|
||||
contentRouters: [
|
||||
ipniContentRouting("https://cid.contact"),
|
||||
reframeContentRouting("https://cid.contact/reframe"),
|
||||
],
|
||||
services: {
|
||||
identify: identifyService(),
|
||||
autoNAT: autoNATService(),
|
||||
pubsub: gossipsub(),
|
||||
dcutr: dcutrService(),
|
||||
dht: kadDHT({
|
||||
clientMode: true,
|
||||
validators: {
|
||||
ipns: ipnsValidator,
|
||||
},
|
||||
selectors: {
|
||||
ipns: ipnsSelector,
|
||||
},
|
||||
}),
|
||||
},
|
||||
};
|
||||
}
|
282
src/index.ts
282
src/index.ts
|
@ -1,64 +1,71 @@
|
|||
import { createLibp2p } from "libp2p";
|
||||
import { createHelia } from "helia";
|
||||
import { MultiSocketProxy } from "@lumeweb/libhyperproxy";
|
||||
import { UnixFS, unixfs } from "@helia/unixfs";
|
||||
import { PROTOCOL } from "./constants.js";
|
||||
import {
|
||||
ActiveQuery,
|
||||
addHandler,
|
||||
handleMessage,
|
||||
} from "@lumeweb/libkernel/module";
|
||||
import { createClient } from "@lumeweb/kernel-swarm-client";
|
||||
import { ipns, IPNS } from "@helia/ipns";
|
||||
import { dht } from "@helia/ipns/routing";
|
||||
import { yamux } from "@chainsafe/libp2p-yamux";
|
||||
// @ts-ignore
|
||||
import Hyperswarm from "hyperswarm";
|
||||
import { Peer, MultiSocketProxy } from "@lumeweb/libhyperproxy";
|
||||
// @ts-ignore
|
||||
import sodium from "sodium-universal";
|
||||
// @ts-ignore
|
||||
import { CustomEvent } from "@libp2p/interfaces/events";
|
||||
// @ts-ignore
|
||||
import { fixed32, raw } from "compact-encoding";
|
||||
import { mplex } from "@libp2p/mplex";
|
||||
import { hypercoreTransport } from "./libp2p/transport.js";
|
||||
import { UnixFS, unixfs } from "@helia/unixfs";
|
||||
// @ts-ignore
|
||||
import { delegatedPeerRouting } from "@libp2p/delegated-peer-routing";
|
||||
import { noise } from "@chainsafe/libp2p-noise";
|
||||
import { create as createIpfsHttpClient } from "ipfs-http-client";
|
||||
import { delegatedContentRouting } from "@libp2p/delegated-content-routing";
|
||||
// @ts-ignore
|
||||
import type { Options } from "ipfs-core";
|
||||
import { multiaddr } from "@multiformats/multiaddr";
|
||||
import { DELEGATE_LIST, PROTOCOL } from "./constants.js";
|
||||
import { ActiveQuery, addHandler, handleMessage } from "libkmodule";
|
||||
import { createClient } from "@lumeweb/kernel-swarm-client";
|
||||
import { ipns, ipnsValidator, ipnsSelector, IPNS } from "@helia/ipns";
|
||||
import { dht, pubsub } from "@helia/ipns/routing";
|
||||
import { kadDHT } from "@libp2p/kad-dht";
|
||||
// @ts-ignore
|
||||
import { gossipsub } from "@chainsafe/libp2p-gossipsub";
|
||||
import { CID } from "multiformats/cid";
|
||||
import { bases } from "multiformats/basics";
|
||||
import { substr } from "runes2";
|
||||
import { MultibaseDecoder } from "multiformats";
|
||||
import { peerIdFromCID } from "@libp2p/peer-id";
|
||||
import { bootstrap } from "@libp2p/bootstrap";
|
||||
import { IDBBlockstore } from "blockstore-idb";
|
||||
import { IDBDatastore } from "datastore-idb";
|
||||
import defer from "p-defer";
|
||||
import { Helia } from "@helia/interface";
|
||||
import { libp2pConfig } from "./config.js";
|
||||
import { createClient as createNetworkRegistryClient } from "@lumeweb/kernel-network-registry-client";
|
||||
import { Libp2p } from "@libp2p/interface";
|
||||
import { unmarshal as ipnsUnmarshal } from "ipns";
|
||||
|
||||
const IPFS_GATEWAY = "https://ipfs.lumeweb.com";
|
||||
|
||||
const basesByPrefix: { [prefix: string]: MultibaseDecoder<any> } = Object.keys(
|
||||
bases,
|
||||
bases
|
||||
).reduce((acc, curr) => {
|
||||
// @ts-ignore
|
||||
acc[bases[curr].prefix] = bases[curr];
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
const TYPES = ["content"];
|
||||
|
||||
onmessage = handleMessage;
|
||||
|
||||
const moduleDefer = defer();
|
||||
let activeIpfsPeersDefer = defer();
|
||||
let networkPeersAvailable = defer();
|
||||
let networkReady = false;
|
||||
const networkRegistry = createNetworkRegistryClient();
|
||||
|
||||
let swarm;
|
||||
let proxy: MultiSocketProxy;
|
||||
let fs: UnixFS;
|
||||
let IPNS: IPNS;
|
||||
let ipfs: Helia<Libp2p<any>>;
|
||||
let ipfs: Helia;
|
||||
|
||||
// @ts-ignore
|
||||
BigInt.prototype.toJSON = function () {
|
||||
return this.toString();
|
||||
};
|
||||
|
||||
addHandler("presentKey", handlePresentKey);
|
||||
addHandler("register", handleRegister);
|
||||
addHandler("status", handleStatus, { receiveUpdates: true });
|
||||
addHandler("name", handleName);
|
||||
addHandler("presentSeed", handlePresentSeed);
|
||||
addHandler("ready", handleReady);
|
||||
addHandler("stat", handleStat);
|
||||
addHandler("ls", handleLs, { receiveUpdates: true });
|
||||
|
@ -66,9 +73,11 @@ addHandler("cat", handleCat, { receiveUpdates: true });
|
|||
addHandler("ipnsResolve", handleIpnsResolve);
|
||||
addHandler("getActivePeers", handleGetActivePeers);
|
||||
|
||||
async function handlePresentKey() {
|
||||
async function handlePresentSeed() {
|
||||
swarm = createClient();
|
||||
|
||||
const client = createIpfsHttpClient(getDelegateConfig());
|
||||
|
||||
proxy = new MultiSocketProxy({
|
||||
swarm,
|
||||
listen: true,
|
||||
|
@ -78,25 +87,113 @@ async function handlePresentKey() {
|
|||
server: false,
|
||||
});
|
||||
|
||||
const libp2p = await createLibp2p({
|
||||
peerDiscovery: [
|
||||
bootstrap({
|
||||
list: [
|
||||
// Default Bootstrap
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN",
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa",
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmbLHAnMoJPWSCR5Zhtx6BHJX9KiKNN6tpvbUcqanj75Nb",
|
||||
"/dnsaddr/bootstrap.libp2p.io/p2p/QmcZf59bWwK5XFi76CZX8cbJ4BhTzzA3gU1ZjYZcYW3dwt",
|
||||
"/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ",
|
||||
// Cloudflare
|
||||
"/dnsaddr/node-1.ingress.cloudflare-ipfs.com/p2p/QmcFf2FH3CEgTNHeMRGhN7HNHU1EXAxoEk6EFuSyXCsvRE",
|
||||
"/dnsaddr/node-2.ingress.cloudflare-ipfs.com/p2p/QmcFmLd5ySfk2WZuJ1mfSWLDjdmHZq7rSAua4GoeSQfs1z",
|
||||
"/dnsaddr/node-3.ingress.cloudflare-ipfs.com/p2p/QmcfFmzSDVbwexQ9Au2pt5YEXHK5xajwgaU6PpkbLWerMa",
|
||||
"/dnsaddr/node-4.ingress.cloudflare-ipfs.com/p2p/QmcfJeB3Js1FG7T8YaZATEiaHqNKVdQfybYYkbT1knUswx",
|
||||
"/dnsaddr/node-5.ingress.cloudflare-ipfs.com/p2p/QmcfVvzK4tMdFmpJjEKDUoqRgP4W9FnmJoziYX5GXJJ8eZ",
|
||||
"/dnsaddr/node-6.ingress.cloudflare-ipfs.com/p2p/QmcfZD3VKrUxyP9BbyUnZDpbqDnT7cQ4WjPP8TRLXaoE7G",
|
||||
"/dnsaddr/node-7.ingress.cloudflare-ipfs.com/p2p/QmcfZP2LuW4jxviTeG8fi28qjnZScACb8PEgHAc17ZEri3",
|
||||
"/dnsaddr/node-8.ingress.cloudflare-ipfs.com/p2p/QmcfgsJsMtx6qJb74akCw1M24X1zFwgGo11h1cuhwQjtJP",
|
||||
"/dnsaddr/node-9.ingress.cloudflare-ipfs.com/p2p/Qmcfr2FC7pFzJbTSDfYaSy1J8Uuy8ccGLeLyqJCKJvTHMi",
|
||||
"/dnsaddr/node-10.ingress.cloudflare-ipfs.com/p2p/QmcfR3V5YAtHBzxVACWCzXTt26SyEkxdwhGJ6875A8BuWx",
|
||||
"/dnsaddr/node-11.ingress.cloudflare-ipfs.com/p2p/Qmcfuo1TM9uUiJp6dTbm915Rf1aTqm3a3dnmCdDQLHgvL5",
|
||||
"/dnsaddr/node-12.ingress.cloudflare-ipfs.com/p2p/QmcfV2sg9zaq7UUHVCGuSvT2M2rnLBAPsiE79vVyK3Cuev",
|
||||
// Estuary
|
||||
"/ip4/139.178.68.217/tcp/6744/p2p/12D3KooWCVXs8P7iq6ao4XhfAmKWrEeuKFWCJgqe9jGDMTqHYBjw",
|
||||
"/ip4/147.75.49.71/tcp/6745/p2p/12D3KooWGBWx9gyUFTVQcKMTenQMSyE2ad9m7c9fpjS4NMjoDien",
|
||||
"/ip4/147.75.86.255/tcp/6745/p2p/12D3KooWFrnuj5o3tx4fGD2ZVJRyDqTdzGnU3XYXmBbWbc8Hs8Nd",
|
||||
"/ip4/3.134.223.177/tcp/6745/p2p/12D3KooWN8vAoGd6eurUSidcpLYguQiGZwt4eVgDvbgaS7kiGTup",
|
||||
"/ip4/35.74.45.12/udp/6746/quic/p2p/12D3KooWLV128pddyvoG6NBvoZw7sSrgpMTPtjnpu3mSmENqhtL7",
|
||||
|
||||
// Pinata
|
||||
"/dnsaddr/fra1-1.hostnodes.pinata.cloud/p2p/QmWaik1eJcGHq1ybTWe7sezRfqKNcDRNkeBaLnGwQJz1Cj",
|
||||
"/dnsaddr/fra1-2.hostnodes.pinata.cloud/p2p/QmNfpLrQQZr5Ns9FAJKpyzgnDL2GgC6xBug1yUZozKFgu4",
|
||||
"/dnsaddr/fra1-3.hostnodes.pinata.cloud/p2p/QmPo1ygpngghu5it8u4Mr3ym6SEU2Wp2wA66Z91Y1S1g29",
|
||||
"/dnsaddr/nyc1-1.hostnodes.pinata.cloud/p2p/QmRjLSisUCHVpFa5ELVvX3qVPfdxajxWJEHs9kN3EcxAW6",
|
||||
"/dnsaddr/nyc1-2.hostnodes.pinata.cloud/p2p/QmPySsdmbczdZYBpbi2oq2WMJ8ErbfxtkG8Mo192UHkfGP",
|
||||
"/dnsaddr/nyc1-3.hostnodes.pinata.cloud/p2p/QmSarArpxemsPESa6FNkmuu9iSE1QWqPX2R3Aw6f5jq4D5",
|
||||
// Eternum
|
||||
"/dns4/door.eternum.io/tcp/4001/ipfs/QmVBxJ5GekATHi89H8jbXjaU6CosCnteomjNR5xar2aH3q",
|
||||
// Textile
|
||||
"/ip4/104.210.43.77/p2p/QmR69wtWUMm1TWnmuD4JqC1TWLZcc8iR2KrTenfZZbiztd",
|
||||
// 8api.sh
|
||||
"/ip4/78.46.108.24/p2p/12D3KooWGASC2jm3pmohEJXUhuStkxDitPgzvs4qMuFPaiD9x1BA",
|
||||
"/ip4/65.109.19.136/p2p/12D3KooWRbWZN3GvLf9CHmozq4vnTzDD4EEoiqtRJxg5FV6Gfjmm",
|
||||
|
||||
// Storj
|
||||
"/ip4/5.161.92.43/tcp/4001/p2p/12D3KooWFFhc8fPYnQXdWBCowxSV21EFYin3rU27p3NVgSMjN41k",
|
||||
"/ip4/5.161.92.43/udp/4001/quic/p2p/12D3KooWFFhc8fPYnQXdWBCowxSV21EFYin3rU27p3NVgSMjN41k",
|
||||
"/ip6/2a01:4ff:f0:3b1e::1/tcp/4001/p2p/12D3KooWFFhc8fPYnQXdWBCowxSV21EFYin3rU27p3NVgSMjN41k",
|
||||
"/ip6/2a01:4ff:f0:3b1e::1/udp/4001/quic/p2p/12D3KooWFFhc8fPYnQXdWBCowxSV21EFYin3rU27p3NVgSMjN41k",
|
||||
"/ip4/5.161.55.227/tcp/4001/p2p/12D3KooWSW4hoHmDXmY5rW7nCi9XmGTy3foFt72u86jNP53LTNBJ",
|
||||
"/ip4/5.161.55.227/udp/4001/quic/p2p/12D3KooWSW4hoHmDXmY5rW7nCi9XmGTy3foFt72u86jNP53LTNBJ",
|
||||
"/ip6/2a01:4ff:f0:1e5a::1/tcp/4001/p2p/12D3KooWSW4hoHmDXmY5rW7nCi9XmGTy3foFt72u86jNP53LTNBJ",
|
||||
"/ip6/2a01:4ff:f0:1e5a::1/udp/4001/quic/p2p/12D3KooWSW4hoHmDXmY5rW7nCi9XmGTy3foFt72u86jNP53LTNBJ",
|
||||
"/ip4/5.161.92.36/tcp/4001/p2p/12D3KooWSDj6JM2JmoHwE9AUUwqAFUEg9ndd3pMA8aF2bkYckZfo",
|
||||
"/ip4/5.161.92.36/udp/4001/quic/p2p/12D3KooWSDj6JM2JmoHwE9AUUwqAFUEg9ndd3pMA8aF2bkYckZfo",
|
||||
"/ip6/2a01:4ff:f0:3764::1/tcp/4001/p2p/12D3KooWSDj6JM2JmoHwE9AUUwqAFUEg9ndd3pMA8aF2bkYckZfo",
|
||||
"/ip6/2a01:4ff:f0:3764::1/udp/4001/quic/p2p/12D3KooWSDj6JM2JmoHwE9AUUwqAFUEg9ndd3pMA8aF2bkYckZfo",
|
||||
],
|
||||
}),
|
||||
],
|
||||
transports: [hypercoreTransport({ proxy })],
|
||||
connectionEncryption: [noise()],
|
||||
connectionManager: {
|
||||
autoDial: true,
|
||||
minConnections: 5,
|
||||
maxConnections: 20,
|
||||
},
|
||||
streamMuxers: [yamux(), mplex()],
|
||||
start: false,
|
||||
contentRouters: [delegatedContentRouting(client)],
|
||||
peerRouters: [delegatedPeerRouting(client)],
|
||||
relay: {
|
||||
enabled: true,
|
||||
advertise: {
|
||||
enabled: false,
|
||||
},
|
||||
},
|
||||
dht: kadDHT({
|
||||
validators: {
|
||||
ipns: ipnsValidator,
|
||||
},
|
||||
selectors: {
|
||||
ipns: ipnsSelector,
|
||||
},
|
||||
}),
|
||||
pubsub: gossipsub(),
|
||||
});
|
||||
|
||||
const blockstore = new IDBBlockstore("ipfs_blocks");
|
||||
const datastore = new IDBDatastore("ipfs_data");
|
||||
|
||||
await blockstore.open();
|
||||
await datastore.open();
|
||||
// @ts-ignore
|
||||
|
||||
ipfs = await createHelia({
|
||||
// @ts-ignore
|
||||
blockstore,
|
||||
// @ts-ignore
|
||||
datastore,
|
||||
libp2p: libp2pConfig(proxy),
|
||||
start: false,
|
||||
libp2p,
|
||||
});
|
||||
|
||||
proxy.on("peerChannelOpen", async () => {
|
||||
if (!ipfs.libp2p.isStarted()) {
|
||||
await ipfs.start();
|
||||
await ipfs.libp2p.start();
|
||||
networkPeersAvailable.resolve();
|
||||
networkReady = true;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -105,7 +202,7 @@ async function handlePresentKey() {
|
|||
await swarm.ready();
|
||||
// @ts-ignore
|
||||
fs = unixfs(ipfs);
|
||||
IPNS = ipns(ipfs as any, [dht(ipfs)]);
|
||||
IPNS = ipns(ipfs as any, [dht(ipfs), pubsub(ipfs as any)]);
|
||||
|
||||
ipfs.libp2p.addEventListener("peer:connect", () => {
|
||||
if (ipfs.libp2p.getPeers().length > 0) {
|
||||
|
@ -148,10 +245,10 @@ async function handleStat(aq: ActiveQuery) {
|
|||
JSON.stringify(
|
||||
await fs.stat(
|
||||
getCID(aq.callerInput.cid),
|
||||
aq.callerInput.options ?? {},
|
||||
),
|
||||
),
|
||||
),
|
||||
aq.callerInput.options ?? {}
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
} catch (e) {
|
||||
aq.reject((e as Error).message);
|
||||
|
@ -181,7 +278,7 @@ async function handleLs(aq: ActiveQuery) {
|
|||
});
|
||||
const iterable = fs.ls(
|
||||
getCID(aq.callerInput.cid),
|
||||
aq.callerInput.options ?? {},
|
||||
aq.callerInput.options ?? {}
|
||||
);
|
||||
|
||||
for await (const item of iterable) {
|
||||
|
@ -221,7 +318,7 @@ async function handleCat(aq: ActiveQuery) {
|
|||
|
||||
const iterable = fs.cat(
|
||||
getCID(aq.callerInput.cid),
|
||||
aq.callerInput.options ?? {},
|
||||
aq.callerInput.options ?? {}
|
||||
);
|
||||
|
||||
for await (const chunk of iterable) {
|
||||
|
@ -237,22 +334,9 @@ async function handleCat(aq: ActiveQuery) {
|
|||
aq.respond();
|
||||
}
|
||||
|
||||
function toDNSPrefix(cid: CID) {
|
||||
const cidb32 = cid.toV1().toString(bases.base32);
|
||||
if (cidb32.length <= 63) {
|
||||
return cidb32;
|
||||
}
|
||||
const cidb36 = cid.toV1().toString(bases.base36);
|
||||
if (cidb36.length <= 63) {
|
||||
return cidb36;
|
||||
}
|
||||
throw new Error("CID incompatible with DNS label length limit of 63");
|
||||
}
|
||||
|
||||
async function handleIpnsResolve(aq: ActiveQuery) {
|
||||
await ready();
|
||||
|
||||
/*
|
||||
await activeIpfsPeersDefer.promise;
|
||||
|
||||
if (ipfs.libp2p.getPeers().length === 0) {
|
||||
|
@ -260,7 +344,6 @@ async function handleIpnsResolve(aq: ActiveQuery) {
|
|||
}
|
||||
|
||||
await activeIpfsPeersDefer.promise;
|
||||
*/
|
||||
|
||||
if (!aq.callerInput || !("cid" in aq.callerInput)) {
|
||||
aq.reject("cid required");
|
||||
|
@ -268,17 +351,14 @@ async function handleIpnsResolve(aq: ActiveQuery) {
|
|||
}
|
||||
|
||||
try {
|
||||
const cid = getCID(aq.callerInput.cid);
|
||||
|
||||
const ret = await fetch(
|
||||
`${IPFS_GATEWAY}/ipns/${toDNSPrefix(cid)}?format=ipns-record`,
|
||||
return aq.respond(
|
||||
(
|
||||
await IPNS.resolve(
|
||||
peerIdFromCID(getCID(aq.callerInput.cid)),
|
||||
aq.callerInput?.options
|
||||
)
|
||||
).asCID.toString()
|
||||
);
|
||||
|
||||
const buf = await ret.arrayBuffer();
|
||||
|
||||
const record = ipnsUnmarshal(new Uint8Array(buf));
|
||||
|
||||
return aq.respond(record.value);
|
||||
} catch (e: any) {
|
||||
aq.reject((e as Error).message);
|
||||
}
|
||||
|
@ -310,70 +390,16 @@ async function ready() {
|
|||
await networkPeersAvailable.promise;
|
||||
}
|
||||
|
||||
async function handleRegister(aq: ActiveQuery) {
|
||||
await networkRegistry.registerNetwork(TYPES);
|
||||
function getDelegateConfig(): Options {
|
||||
const delegateString =
|
||||
DELEGATE_LIST[Math.floor(Math.random() * DELEGATE_LIST.length)];
|
||||
const delegateAddr = multiaddr(delegateString).toOptions();
|
||||
|
||||
aq.respond();
|
||||
}
|
||||
|
||||
async function handleStatus(aq: ActiveQuery) {
|
||||
function sendUpdate() {
|
||||
aq.sendUpdate({
|
||||
peers: netPeers,
|
||||
ready: netPeers > 0,
|
||||
});
|
||||
}
|
||||
|
||||
let netPeers = 0;
|
||||
if (!networkReady) {
|
||||
sendUpdate();
|
||||
await ready();
|
||||
getPeers();
|
||||
} else {
|
||||
getPeers();
|
||||
}
|
||||
|
||||
function getPeers() {
|
||||
netPeers = ipfs.libp2p.getPeers().length;
|
||||
}
|
||||
|
||||
function peersListener() {
|
||||
getPeers();
|
||||
sendUpdate();
|
||||
}
|
||||
|
||||
const peerEvents = ["connection:prune", "peer:connect", "peer:disconnect"];
|
||||
peerEvents.forEach((ev) => {
|
||||
return {
|
||||
// @ts-ignore
|
||||
ipfs.libp2p.components.connectionManager.events.addEventListener(
|
||||
ev,
|
||||
peersListener,
|
||||
);
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
ipfs.libp2p.components.connectionManager.events.addEventListener(
|
||||
"peer:disconnect",
|
||||
peersListener,
|
||||
);
|
||||
|
||||
ipfs.libp2p.addEventListener("start", peersListener);
|
||||
|
||||
aq.setReceiveUpdate?.(() => {
|
||||
peerEvents.forEach((ev) => {
|
||||
// @ts-ignore
|
||||
ipfs.libp2p.components.connectionManager.events.removeEventListener(
|
||||
ev,
|
||||
peersListener,
|
||||
);
|
||||
});
|
||||
ipfs.libp2p.removeEventListener("start", peersListener);
|
||||
aq.respond();
|
||||
});
|
||||
|
||||
sendUpdate();
|
||||
}
|
||||
|
||||
function handleName(aq: ActiveQuery) {
|
||||
aq.respond("IPFS");
|
||||
host: delegateAddr.host,
|
||||
// @ts-ignore
|
||||
protocol: parseInt(delegateAddr.port) === 443 ? "https" : "http",
|
||||
port: delegateAddr.port,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -50,7 +50,6 @@ class HypercoreTransport extends TCP {
|
|||
const socket = await this._connect(ma, options);
|
||||
|
||||
// Avoid uncaught errors caused by unstable connections
|
||||
// @ts-ignore
|
||||
socket.on("error", (err: any) => {
|
||||
log("socket error", err);
|
||||
});
|
||||
|
@ -83,7 +82,6 @@ class HypercoreTransport extends TCP {
|
|||
throw new AbortError();
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
return conn;
|
||||
}
|
||||
|
||||
|
@ -115,10 +113,9 @@ class HypercoreTransport extends TCP {
|
|||
|
||||
const err = new CodeError(
|
||||
`connection timeout after ${Date.now() - start}ms`,
|
||||
"ERR_CONNECT_TIMEOUT",
|
||||
"ERR_CONNECT_TIMEOUT"
|
||||
);
|
||||
// Note: this will result in onError() being called
|
||||
// @ts-ignore
|
||||
rawSocket?.emit("error", err);
|
||||
};
|
||||
|
||||
|
@ -131,13 +128,11 @@ class HypercoreTransport extends TCP {
|
|||
const onAbort = (): void => {
|
||||
log("connection aborted %j", cOpts);
|
||||
this.metrics?.dialerEvents.increment({ abort: true });
|
||||
// @ts-ignore
|
||||
rawSocket?.destroy();
|
||||
done(new AbortError());
|
||||
};
|
||||
|
||||
const done = (err?: any): void => {
|
||||
// @ts-ignore
|
||||
rawSocket?.removeListener("error", onError);
|
||||
// @ts-ignore
|
||||
rawSocket?.removeListener("timeout", onTimeout);
|
||||
|
@ -204,7 +199,7 @@ class HypercoreTransport extends TCP {
|
|||
}
|
||||
|
||||
export function hypercoreTransport(
|
||||
init: HypercoreOptions = {},
|
||||
init: HypercoreOptions = {}
|
||||
): (components?: TCPComponents) => HypercoreTransport {
|
||||
return (components: TCPComponents = {}) => {
|
||||
return new HypercoreTransport(components, init);
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"moduleResolution": "node",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"declaration": true,
|
||||
"outDir": "./dist-build",
|
||||
"strict": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["src-build"],
|
||||
"exclude": ["node_modules", "**/__tests__/*"]
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"declaration": true,
|
||||
"moduleResolution": "node",
|
||||
"outDir": "./build",
|
||||
"strict": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["src"],
|
||||
"exclude": ["node_modules", "**/__tests__/*"]
|
||||
}
|
Loading…
Reference in New Issue