chore: update typescript (#1528)

* update typescript, define in root package.json

* update typedoc and fix typedoc comments

* update dev version of tsconfig

* set module and resolution for tsconfig dev

* bump ts plugins

* set order of typedoc generation

* turn off warnings as errors setting
This commit is contained in:
Sasha 2023-09-21 10:57:37 +02:00 committed by GitHub
parent c8def0c577
commit 020463c358
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 13456 additions and 10287 deletions

23531
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,8 @@
}, },
"devDependencies": { "devDependencies": {
"@size-limit/preset-big-lib": "^8.2.4", "@size-limit/preset-big-lib": "^8.2.4",
"@typescript-eslint/eslint-plugin": "^6.2.1", "@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.0.0", "@typescript-eslint/parser": "^6.6.0",
"eslint": "^8.47.0", "eslint": "^8.47.0",
"eslint-config-prettier": "^9.0.0", "eslint-config-prettier": "^9.0.0",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
@ -51,8 +51,10 @@
"husky": "^8.0.3", "husky": "^8.0.3",
"lint-staged": "^13.2.2", "lint-staged": "^13.2.2",
"size-limit": "^8.1.2", "size-limit": "^8.1.2",
"typedoc": "^0.23.26", "ts-loader": "^9.4.2",
"typedoc-plugin-resolve-crossmodule-references": "^0.3.3" "ts-node": "^10.9.1",
"typedoc": "^0.25.1",
"typescript": "^5.2.2"
}, },
"lint-staged": { "lint-staged": {
"*.{ts,js}": [ "*.{ts,js}": [

View File

@ -107,10 +107,7 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"process": "^0.11.10", "process": "^0.11.10",
"puppeteer": "^21.1.1", "puppeteer": "^21.1.1",
"rollup": "^3.29.2", "rollup": "^3.29.2"
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
}, },
"peerDependencies": { "peerDependencies": {
"@multiformats/multiaddr": "^12.0.0", "@multiformats/multiaddr": "^12.0.0",
@ -121,9 +118,6 @@
"optional": true "optional": true
} }
}, },
"typedoc": {
"entryPoint": "./src/index.ts"
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -109,10 +109,9 @@ export class Encoder implements IEncoder {
/** /**
* Creates an encoder that encode messages without Waku level encryption or signature. * Creates an encoder that encode messages without Waku level encryption or signature.
* *
* An encoder is used to encode messages in the [`14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/) * An encoder is used to encode messages in the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
* format to be sent over the Waku network. The resulting encoder can then be * format to be sent over the Waku network. The resulting encoder can then be
* pass to { @link @waku/interfaces.LightPush.push } or * pass to { @link @waku/interfaces!ISender.send } to automatically encode outgoing
* { @link @waku/interfaces.Relay.send } to automatically encode outgoing
* messages. * messages.
*/ */
export function createEncoder({ export function createEncoder({
@ -169,8 +168,7 @@ export class Decoder implements IDecoder<DecodedMessage> {
* *
* A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/) * A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
* format when received from the Waku network. The resulting decoder can then be * format when received from the Waku network. The resulting decoder can then be
* pass to { @link @waku/interfaces.Filter.subscribe } or * pass to { @link @waku/interfaces!IReceiver.subscribe } to automatically decode incoming
* { @link @waku/interfaces.Relay.subscribe } to automatically decode incoming
* messages. * messages.
* *
* @param contentTopic The resulting decoder will only decode messages with this content topic. * @param contentTopic The resulting decoder will only decode messages with this content topic.

View File

@ -9,8 +9,8 @@ const log = debug("waku:wait-for-remote-peer");
/** /**
* Wait for a remote peer to be ready given the passed protocols. * Wait for a remote peer to be ready given the passed protocols.
* Must be used after attempting to connect to nodes, using * Must be used after attempting to connect to nodes, using
* {@link @waku/core.WakuNode.dial} or a bootstrap method with * {@link @waku/core!WakuNode.dial} or a bootstrap method with
* {@link @waku/sdk.createLightNode}. * {@link @waku/sdk!createLightNode}.
* *
* If the passed protocols is a GossipSub protocol, then it resolves only once * If the passed protocols is a GossipSub protocol, then it resolves only once
* a peer is in a mesh, to help ensure that other peers will send and receive * a peer is in a mesh, to help ensure that other peers will send and receive

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -76,12 +76,7 @@
"karma-webpack": "^5.0.0", "karma-webpack": "^5.0.0",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^3.29.2", "rollup": "^3.29.2"
"ts-loader": "^9.4.2",
"typescript": "^5.0.4"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -80,13 +80,8 @@
"process": "^0.11.10", "process": "^0.11.10",
"puppeteer": "^21.1.1", "puppeteer": "^21.1.1",
"rollup": "^3.29.2", "rollup": "^3.29.2",
"ts-loader": "^9.4.2",
"typescript": "^5.0.4",
"uint8arrays": "^4.0.4" "uint8arrays": "^4.0.4"
}, },
"typedoc": {
"entryPoint": "./src/index.ts"
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -51,12 +51,8 @@
"@multiformats/multiaddr": "^12.0.0", "@multiformats/multiaddr": "^12.0.0",
"cspell": "^7.3.2", "cspell": "^7.3.2",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"typescript": "^5.0.4",
"libp2p": "^0.46.9" "libp2p": "^0.46.9"
}, },
"typedoc": {
"entryPoint": "./src/index.ts"
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -22,7 +22,7 @@ export interface IBaseProtocol {
export type ProtocolCreateOptions = { export type ProtocolCreateOptions = {
/** /**
* The PubSub Topic to use. Defaults to {@link @waku/core.DefaultPubSubTopic }. * The PubSub Topic to use. Defaults to {@link @waku/core!DefaultPubSubTopic }.
* *
* One and only one pubsub topic is used by Waku. This is used by: * One and only one pubsub topic is used by Waku. This is used by:
* - WakuRelay to receive, route and send messages, * - WakuRelay to receive, route and send messages,
@ -35,11 +35,11 @@ export type ProtocolCreateOptions = {
*/ */
pubSubTopic?: string; pubSubTopic?: string;
/** /**
* You can pass options to the `Libp2p` instance used by {@link @waku/core.WakuNode} using the `libp2p` property. * You can pass options to the `Libp2p` instance used by {@link @waku/core!WakuNode} using the `libp2p` property.
* This property is the same type as the one passed to [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create) * This property is the same type as the one passed to [`Libp2p.create`](https://github.com/libp2p/js-libp2p/blob/master/doc/API.md#create)
* apart that we made the `modules` property optional and partial, * apart that we made the `modules` property optional and partial,
* allowing its omission and letting Waku set good defaults. * allowing its omission and letting Waku set good defaults.
* Notes that some values are overridden by {@link @waku/core.WakuNode} to ensure it implements the Waku protocol. * Notes that some values are overridden by {@link @waku/core!WakuNode} to ensure it implements the Waku protocol.
*/ */
libp2p?: Partial<Libp2pOptions>; libp2p?: Partial<Libp2pOptions>;
/** /**

View File

@ -1,9 +1,12 @@
import type { IDecodedMessage, IDecoder } from "./message.js"; import type { IDecodedMessage, IDecoder } from "./message.js";
import type { IAsyncIterator, PubSubTopic, Unsubscribe } from "./misc.js"; import type {
ContentTopic,
IAsyncIterator,
PubSubTopic,
Unsubscribe
} from "./misc.js";
import type { Callback } from "./protocols.js"; import type { Callback } from "./protocols.js";
type ContentTopic = string;
export type ActiveSubscriptions = Map<PubSubTopic, ContentTopic[]>; export type ActiveSubscriptions = Map<PubSubTopic, ContentTopic[]>;
export interface IReceiver { export interface IReceiver {

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -97,12 +97,7 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"process": "^0.11.10", "process": "^0.11.10",
"puppeteer": "^21.1.1", "puppeteer": "^21.1.1",
"rollup": "^3.29.2", "rollup": "^3.29.2"
"ts-loader": "^9.4.2",
"typescript": "^5.0.4"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -88,8 +88,8 @@ export interface EncoderOptions extends BaseEncoderOptions {
* *
* An encoder is used to encode messages in the [`14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/) * An encoder is used to encode messages in the [`14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
* format to be sent over the Waku network. The resulting encoder can then be * format to be sent over the Waku network. The resulting encoder can then be
* pass to { @link @waku/interfaces.LightPush.push } or * pass to { @link @waku/interfaces!ISender.send } or
* { @link @waku/interfaces.Relay.send } to automatically encrypt * { @link @waku/interfaces!ISender.send } to automatically encrypt
* and encode outgoing messages. * and encode outgoing messages.
* The payload can optionally be signed with the given private key as defined * The payload can optionally be signed with the given private key as defined
* in [26/WAKU2-PAYLOAD](https://rfc.vac.dev/spec/26/). * in [26/WAKU2-PAYLOAD](https://rfc.vac.dev/spec/26/).
@ -175,8 +175,7 @@ class Decoder extends DecoderV0 implements IDecoder<DecodedMessage> {
* *
* A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/) * A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
* format when received from the Waku network. The resulting decoder can then be * format when received from the Waku network. The resulting decoder can then be
* pass to { @link @waku/interfaces.Filter.subscribe } or * pass to { @link @waku/interfaces!IReceiver.subscribe } to automatically decrypt and
* { @link @waku/interfaces.Relay.subscribe } to automatically decrypt and
* decode incoming messages. * decode incoming messages.
* *
* @param contentTopic The resulting decoder will only decode messages with this content topic. * @param contentTopic The resulting decoder will only decode messages with this content topic.

View File

@ -83,8 +83,7 @@ export interface EncoderOptions extends BaseEncoderOptions {
* *
* An encoder is used to encode messages in the [`14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/) * An encoder is used to encode messages in the [`14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
* format to be sent over the Waku network. The resulting encoder can then be * format to be sent over the Waku network. The resulting encoder can then be
* pass to { @link @waku/interfaces.LightPush.push } or * pass to { @link @waku/interfaces!ISender.send } to automatically encrypt
* { @link @waku/interfaces.Relay.send } to automatically encrypt
* and encode outgoing messages. * and encode outgoing messages.
* *
* The payload can optionally be signed with the given private key as defined * The payload can optionally be signed with the given private key as defined
@ -165,8 +164,7 @@ class Decoder extends DecoderV0 implements IDecoder<DecodedMessage> {
* *
* A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/) * A decoder is used to decode messages from the [14/WAKU2-MESSAGE](https://rfc.vac.dev/spec/14/)
* format when received from the Waku network. The resulting decoder can then be * format when received from the Waku network. The resulting decoder can then be
* pass to { @link @waku/interfaces.Filter.subscribe } or * pass to { @link @waku/interfaces!IReceiver.subscribe } to automatically decrypt and
* { @link @waku/interfaces.Relay.subscribe } to automatically decrypt and
* decode incoming messages. * decode incoming messages.
* *
* @param contentTopic The resulting decoder will only decode messages with this content topic. * @param contentTopic The resulting decoder will only decode messages with this content topic.

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -75,13 +75,7 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"process": "^0.11.10", "process": "^0.11.10",
"puppeteer": "^21.1.1", "puppeteer": "^21.1.1",
"rollup": "^3.29.2", "rollup": "^3.29.2"
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -68,13 +68,8 @@
"cspell": "^7.3.2", "cspell": "^7.3.2",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^3.29.2", "rollup": "^3.29.2",
"ts-loader": "^9.4.2",
"typescript": "^5.0.4",
"uint8arraylist": "^2.4.3" "uint8arraylist": "^2.4.3"
}, },
"typedoc": {
"entryPoint": "./src/index.ts"
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -55,12 +55,8 @@
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"protons": "^7.0.2", "protons": "^7.0.2",
"rollup": "^3.29.2", "rollup": "^3.29.2",
"typescript": "^5.0.4",
"uint8arraylist": "^2.4.3" "uint8arraylist": "^2.4.3"
}, },
"typedoc": {
"entryPoint": "./src/index.ts"
},
"files": [ "files": [
"dist", "dist",
"bundle", "bundle",

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -64,13 +64,7 @@
"@waku/build-utils": "*", "@waku/build-utils": "*",
"@rollup/plugin-json": "^6.0.0", "@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.1.0", "@rollup/plugin-node-resolve": "^15.1.0",
"rollup": "^3.29.2", "rollup": "^3.29.2"
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.4"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -68,11 +68,7 @@
"cspell": "^7.3.2", "cspell": "^7.3.2",
"interface-datastore": "^8.2.5", "interface-datastore": "^8.2.5",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^3.29.2", "rollup": "^3.29.2"
"typescript": "^5.0.4"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -73,8 +73,6 @@
"@types/mocha": "^10.0.1", "@types/mocha": "^10.0.1",
"@types/sinon": "^10.0.16", "@types/sinon": "^10.0.16",
"@types/tail": "^2.2.1", "@types/tail": "^2.2.1",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.62.0",
"@waku/dns-discovery": "*", "@waku/dns-discovery": "*",
"@waku/message-encryption": "*", "@waku/message-encryption": "*",
"@waku/peer-exchange": "*", "@waku/peer-exchange": "*",
@ -86,7 +84,6 @@
"interface-datastore": "^8.2.5", "interface-datastore": "^8.2.5",
"libp2p": "^0.46.9", "libp2p": "^0.46.9",
"mocha": "^10.2.0", "mocha": "^10.2.0",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5"
"typescript": "^5.0.4"
} }
} }

View File

@ -77,11 +77,7 @@
"@waku/interfaces": "0.0.17", "@waku/interfaces": "0.0.17",
"cspell": "^7.3.2", "cspell": "^7.3.2",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^3.29.2", "rollup": "^3.29.2"
"typescript": "^5.0.4"
},
"typedoc": {
"entryPoint": "./src/index.ts"
}, },
"files": [ "files": [
"dist", "dist",

View File

@ -0,0 +1,4 @@
{
"extends": ["../../typedoc.base.json"],
"entryPoints": ["src/index.ts"]
}

View File

@ -1,8 +1,8 @@
{ {
"extends": "./tsconfig", "extends": "./tsconfig",
"compilerOptions": { "compilerOptions": {
"module": "nodenext", "module": "ESNext",
"moduleResolution": "Bundler",
"noEmit": true "noEmit": true
}, }
"exclude": []
} }

View File

@ -2,7 +2,7 @@
"compilerOptions": { "compilerOptions": {
"incremental": true, "incremental": true,
"target": "ES2022", "target": "ES2022",
"moduleResolution": "node16", "moduleResolution": "Bundler",
"module": "ES2022", "module": "ES2022",
"declaration": true, "declaration": true,
"sourceMap": true, "sourceMap": true,

8
typedoc.base.json Normal file
View File

@ -0,0 +1,8 @@
{
"$schema": "https://typedoc.org/schema.json",
"includeVersion": true,
"validation": {
"invalidLink": true,
"notExported": true
}
}

View File

@ -1,21 +1,16 @@
const packageJson = require("./package.json"); const packageJson = require("./package.json");
let entryPoints = [];
for (const entryPoint of packageJson.workspaces) {
if (!["packages/tests", "packages/build-utils"].includes(entryPoint))
entryPoints.push(entryPoint);
}
module.exports = { module.exports = {
entryPointStrategy: "packages", "treatWarningsAsErrors": false,
entryPoints, "entryPointStrategy": "packages",
out: "docs", "entryPoints": packageJson.workspaces,
exclude: ["**/*.spec.ts"], "out": "docs",
excludeInternal: true, "excludeInternal": true,
treatWarningsAsErrors: true, "excludeExternals": true,
excludeExternals: true, "excludeReferences": true,
validation: { "exclude": ["**/*.spec.ts", "packages/build-utils", "packages/tests"],
invalidLink: true, "validation": {
notExported: true, "invalidLink": true,
}, "notExported": true,
}
}; };