diff --git a/package-lock.json b/package-lock.json index bfcc938b48..081a702087 100644 --- a/package-lock.json +++ b/package-lock.json @@ -984,6 +984,19 @@ "uint8arraylist": "^2.3.2" } }, + "node_modules/@libp2p/interface-address-manager": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@libp2p/interface-address-manager/-/interface-address-manager-2.0.1.tgz", + "integrity": "sha512-JjlQUJ0cF1h0wsOS22PNRQiiiMLwftd5QttjJK2jDsou5FkZETeQ9eYL05I0ykQKZvEJqwH8G5WLwxWtwsj7Ag==", + "dependencies": { + "@libp2p/interfaces": "^3.0.0", + "@multiformats/multiaddr": "^11.0.0" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, "node_modules/@libp2p/interface-connection": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@libp2p/interface-connection/-/interface-connection-3.0.3.tgz", @@ -1015,9 +1028,9 @@ } }, "node_modules/@libp2p/interface-connection-manager": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@libp2p/interface-connection-manager/-/interface-connection-manager-1.3.0.tgz", - "integrity": "sha512-25tlCE8ECX/ARP+yV+j2+MQeZ9+HfzvwYEU2TymywP83Q5v6oKZM8pmS51yiNwcKPZMMZiHQk1eFmaOrJB25zQ==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@libp2p/interface-connection-manager/-/interface-connection-manager-1.3.1.tgz", + "integrity": "sha512-aaRFzpIU6f2DKo6q9fx7W3xPfT2iW/J5mnGTHvvndCtPGmoziCY90cFYJiZ4nJJfX5YKs+v/kDTztXVWgPA9Nw==", "dependencies": { "@libp2p/interface-connection": "^3.0.0", "@libp2p/interface-peer-id": "^1.0.0", @@ -1030,9 +1043,9 @@ } }, "node_modules/@libp2p/interface-content-routing": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@libp2p/interface-content-routing/-/interface-content-routing-1.0.3.tgz", - "integrity": "sha512-8oARfHOkf3NAMaDQWBM3nbVNg+Skj1hjGAjomakZ/jZPjOjbQ9BfPZAsrnDRrV0snnnJNrxiYz6w58y8ehg+cA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@libp2p/interface-content-routing/-/interface-content-routing-1.0.4.tgz", + "integrity": "sha512-zJn7wH8KWaAdlc6kNUMsq9cYx1bEdTj0yAEhzIsrfdXX/XTlBqCeWmMBuFMwj4vBp0pKI0nlt3fUHON1cIGX1w==", "dependencies": { "@libp2p/interface-peer-info": "^1.0.0", "@libp2p/interfaces": "^3.0.0", @@ -1044,9 +1057,9 @@ } }, "node_modules/@libp2p/interface-dht": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@libp2p/interface-dht/-/interface-dht-1.0.2.tgz", - "integrity": "sha512-vBMR90VFQbNwUdgf7yYO6buDP8K6srb+Z0KdoHMklZd9UIx6k/SVUANkHWw/tGAX4C2EZ0qMdSiivkJg2dcPjg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@libp2p/interface-dht/-/interface-dht-1.0.3.tgz", + "integrity": "sha512-8SuGn2QIztqHjMPZLNKAZ+UlWc4EDB9rIt53KfjWZnQrRJzkyqFYXvT9VhnqtFX7iblf4N4I3Z42OFAM8ezCvg==", "dependencies": { "@libp2p/interface-peer-discovery": "^1.0.0", "@libp2p/interface-peer-id": "^1.0.0", @@ -1120,9 +1133,9 @@ } }, "node_modules/@libp2p/interface-peer-routing": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@libp2p/interface-peer-routing/-/interface-peer-routing-1.0.1.tgz", - "integrity": "sha512-MKx2g0mIUI6qNuLv3xApKXR2ZrO9CUTT9ZPL0gvRlhpFCXovEkdWJ1h8KnmkR7tGPxKHt2bsCCJ8gqUaFeNstA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@libp2p/interface-peer-routing/-/interface-peer-routing-1.0.2.tgz", + "integrity": "sha512-TPv9ALS3FUG+q95jyvT0jOQd2k17bdzn0jw0nGwTo7beoeRMVehTHAXPn2Hh5tRjc2eH/Y+SSmb0gR3eAQpn6w==", "dependencies": { "@libp2p/interface-peer-id": "^1.0.0", "@libp2p/interface-peer-info": "^1.0.0", @@ -1205,6 +1218,22 @@ "npm": ">=7.0.0" } }, + "node_modules/@libp2p/interface-transport": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@libp2p/interface-transport/-/interface-transport-2.0.1.tgz", + "integrity": "sha512-yrL6YZmPQX4JT/E/60XgNgNSCu9tNPjjq2HuWZs1n1k8cstV0/WvViUE8aoOlJlKZSVjQNcpRAy9LgVxznK7/g==", + "dependencies": { + "@libp2p/interface-connection": "^3.0.0", + "@libp2p/interface-stream-muxer": "^3.0.0", + "@libp2p/interfaces": "^3.0.0", + "@multiformats/multiaddr": "^11.0.0", + "it-stream-types": "^1.0.4" + }, + "engines": { + "node": ">=16.0.0", + "npm": ">=7.0.0" + } + }, "node_modules/@libp2p/interfaces": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-3.0.4.tgz", @@ -1628,22 +1657,6 @@ "npm": ">=7.0.0" } }, - "node_modules/@libp2p/websockets/node_modules/@libp2p/interface-transport": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@libp2p/interface-transport/-/interface-transport-2.0.1.tgz", - "integrity": "sha512-yrL6YZmPQX4JT/E/60XgNgNSCu9tNPjjq2HuWZs1n1k8cstV0/WvViUE8aoOlJlKZSVjQNcpRAy9LgVxznK7/g==", - "dependencies": { - "@libp2p/interface-connection": "^3.0.0", - "@libp2p/interface-stream-muxer": "^3.0.0", - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^11.0.0", - "it-stream-types": "^1.0.4" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/@manypkg/find-root": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@manypkg/find-root/-/find-root-1.1.0.tgz", @@ -8486,35 +8499,6 @@ "npm": ">=7.0.0" } }, - "node_modules/libp2p/node_modules/@libp2p/interface-address-manager": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@libp2p/interface-address-manager/-/interface-address-manager-2.0.1.tgz", - "integrity": "sha512-JjlQUJ0cF1h0wsOS22PNRQiiiMLwftd5QttjJK2jDsou5FkZETeQ9eYL05I0ykQKZvEJqwH8G5WLwxWtwsj7Ag==", - "dependencies": { - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^11.0.0" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, - "node_modules/libp2p/node_modules/@libp2p/interface-transport": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@libp2p/interface-transport/-/interface-transport-2.0.1.tgz", - "integrity": "sha512-yrL6YZmPQX4JT/E/60XgNgNSCu9tNPjjq2HuWZs1n1k8cstV0/WvViUE8aoOlJlKZSVjQNcpRAy9LgVxznK7/g==", - "dependencies": { - "@libp2p/interface-connection": "^3.0.0", - "@libp2p/interface-stream-muxer": "^3.0.0", - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^11.0.0", - "it-stream-types": "^1.0.4" - }, - "engines": { - "node": ">=16.0.0", - "npm": ">=7.0.0" - } - }, "node_modules/libp2p/node_modules/it-all": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/it-all/-/it-all-2.0.0.tgz", @@ -17321,11 +17305,24 @@ "dependencies": { "@chainsafe/libp2p-noise": "^10.1.0", "@libp2p/bootstrap": "^5.0.0", + "@libp2p/interface-address-manager": "^2.0.1", + "@libp2p/interface-connection": "^3.0.3", + "@libp2p/interface-connection-manager": "^1.3.1", + "@libp2p/interface-content-routing": "^1.0.4", + "@libp2p/interface-dht": "^1.0.3", + "@libp2p/interface-metrics": "^3.0.0", "@libp2p/interface-peer-discovery": "^1.0.2", + "@libp2p/interface-peer-id": "^1.0.6", + "@libp2p/interface-peer-routing": "^1.0.2", + "@libp2p/interface-peer-store": "^1.2.3", + "@libp2p/interface-pubsub": "^3.0.1", + "@libp2p/interface-registrar": "^2.0.4", + "@libp2p/interface-transport": "^2.0.1", "@libp2p/mplex": "^7.0.0", "@libp2p/websockets": "^5.0.0", "@waku/core": "*", - "@waku/interfaces": "*" + "@waku/interfaces": "*", + "interface-datastore": "^7.0.1" }, "devDependencies": { "@rollup/plugin-commonjs": "^22.0.0", @@ -18318,6 +18315,15 @@ } } }, + "@libp2p/interface-address-manager": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@libp2p/interface-address-manager/-/interface-address-manager-2.0.1.tgz", + "integrity": "sha512-JjlQUJ0cF1h0wsOS22PNRQiiiMLwftd5QttjJK2jDsou5FkZETeQ9eYL05I0ykQKZvEJqwH8G5WLwxWtwsj7Ag==", + "requires": { + "@libp2p/interfaces": "^3.0.0", + "@multiformats/multiaddr": "^11.0.0" + } + }, "@libp2p/interface-connection": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@libp2p/interface-connection/-/interface-connection-3.0.3.tgz", @@ -18341,9 +18347,9 @@ } }, "@libp2p/interface-connection-manager": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@libp2p/interface-connection-manager/-/interface-connection-manager-1.3.0.tgz", - "integrity": "sha512-25tlCE8ECX/ARP+yV+j2+MQeZ9+HfzvwYEU2TymywP83Q5v6oKZM8pmS51yiNwcKPZMMZiHQk1eFmaOrJB25zQ==", + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@libp2p/interface-connection-manager/-/interface-connection-manager-1.3.1.tgz", + "integrity": "sha512-aaRFzpIU6f2DKo6q9fx7W3xPfT2iW/J5mnGTHvvndCtPGmoziCY90cFYJiZ4nJJfX5YKs+v/kDTztXVWgPA9Nw==", "requires": { "@libp2p/interface-connection": "^3.0.0", "@libp2p/interface-peer-id": "^1.0.0", @@ -18352,9 +18358,9 @@ } }, "@libp2p/interface-content-routing": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/@libp2p/interface-content-routing/-/interface-content-routing-1.0.3.tgz", - "integrity": "sha512-8oARfHOkf3NAMaDQWBM3nbVNg+Skj1hjGAjomakZ/jZPjOjbQ9BfPZAsrnDRrV0snnnJNrxiYz6w58y8ehg+cA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@libp2p/interface-content-routing/-/interface-content-routing-1.0.4.tgz", + "integrity": "sha512-zJn7wH8KWaAdlc6kNUMsq9cYx1bEdTj0yAEhzIsrfdXX/XTlBqCeWmMBuFMwj4vBp0pKI0nlt3fUHON1cIGX1w==", "requires": { "@libp2p/interface-peer-info": "^1.0.0", "@libp2p/interfaces": "^3.0.0", @@ -18362,9 +18368,9 @@ } }, "@libp2p/interface-dht": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@libp2p/interface-dht/-/interface-dht-1.0.2.tgz", - "integrity": "sha512-vBMR90VFQbNwUdgf7yYO6buDP8K6srb+Z0KdoHMklZd9UIx6k/SVUANkHWw/tGAX4C2EZ0qMdSiivkJg2dcPjg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@libp2p/interface-dht/-/interface-dht-1.0.3.tgz", + "integrity": "sha512-8SuGn2QIztqHjMPZLNKAZ+UlWc4EDB9rIt53KfjWZnQrRJzkyqFYXvT9VhnqtFX7iblf4N4I3Z42OFAM8ezCvg==", "requires": { "@libp2p/interface-peer-discovery": "^1.0.0", "@libp2p/interface-peer-id": "^1.0.0", @@ -18414,9 +18420,9 @@ } }, "@libp2p/interface-peer-routing": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@libp2p/interface-peer-routing/-/interface-peer-routing-1.0.1.tgz", - "integrity": "sha512-MKx2g0mIUI6qNuLv3xApKXR2ZrO9CUTT9ZPL0gvRlhpFCXovEkdWJ1h8KnmkR7tGPxKHt2bsCCJ8gqUaFeNstA==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@libp2p/interface-peer-routing/-/interface-peer-routing-1.0.2.tgz", + "integrity": "sha512-TPv9ALS3FUG+q95jyvT0jOQd2k17bdzn0jw0nGwTo7beoeRMVehTHAXPn2Hh5tRjc2eH/Y+SSmb0gR3eAQpn6w==", "requires": { "@libp2p/interface-peer-id": "^1.0.0", "@libp2p/interface-peer-info": "^1.0.0", @@ -18475,6 +18481,18 @@ "it-stream-types": "^1.0.4" } }, + "@libp2p/interface-transport": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@libp2p/interface-transport/-/interface-transport-2.0.1.tgz", + "integrity": "sha512-yrL6YZmPQX4JT/E/60XgNgNSCu9tNPjjq2HuWZs1n1k8cstV0/WvViUE8aoOlJlKZSVjQNcpRAy9LgVxznK7/g==", + "requires": { + "@libp2p/interface-connection": "^3.0.0", + "@libp2p/interface-stream-muxer": "^3.0.0", + "@libp2p/interfaces": "^3.0.0", + "@multiformats/multiaddr": "^11.0.0", + "it-stream-types": "^1.0.4" + } + }, "@libp2p/interfaces": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@libp2p/interfaces/-/interfaces-3.0.4.tgz", @@ -18813,20 +18831,6 @@ "p-defer": "^4.0.0", "p-timeout": "^6.0.0", "wherearewe": "^2.0.1" - }, - "dependencies": { - "@libp2p/interface-transport": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@libp2p/interface-transport/-/interface-transport-2.0.1.tgz", - "integrity": "sha512-yrL6YZmPQX4JT/E/60XgNgNSCu9tNPjjq2HuWZs1n1k8cstV0/WvViUE8aoOlJlKZSVjQNcpRAy9LgVxznK7/g==", - "requires": { - "@libp2p/interface-connection": "^3.0.0", - "@libp2p/interface-stream-muxer": "^3.0.0", - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^11.0.0", - "it-stream-types": "^1.0.4" - } - } } }, "@manypkg/find-root": { @@ -20152,7 +20156,19 @@ "requires": { "@chainsafe/libp2p-noise": "^10.1.0", "@libp2p/bootstrap": "^5.0.0", + "@libp2p/interface-address-manager": "^2.0.1", + "@libp2p/interface-connection": "^3.0.3", + "@libp2p/interface-connection-manager": "^1.3.1", + "@libp2p/interface-content-routing": "^1.0.4", + "@libp2p/interface-dht": "^1.0.3", + "@libp2p/interface-metrics": "^3.0.0", "@libp2p/interface-peer-discovery": "^1.0.2", + "@libp2p/interface-peer-id": "^1.0.6", + "@libp2p/interface-peer-routing": "^1.0.2", + "@libp2p/interface-peer-store": "^1.2.3", + "@libp2p/interface-pubsub": "^3.0.1", + "@libp2p/interface-registrar": "^2.0.4", + "@libp2p/interface-transport": "^2.0.1", "@libp2p/mplex": "^7.0.0", "@libp2p/websockets": "^5.0.0", "@rollup/plugin-commonjs": "^22.0.0", @@ -20169,6 +20185,7 @@ "eslint-plugin-functional": "^4.0.2", "eslint-plugin-import": "^2.25.3", "eslint-plugin-prettier": "^4.0.0", + "interface-datastore": "^7.0.1", "npm-run-all": "^4.1.5", "prettier": "^2.1.1", "rollup": "^2.75.0", @@ -24372,27 +24389,6 @@ "xsalsa20": "^1.1.0" }, "dependencies": { - "@libp2p/interface-address-manager": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@libp2p/interface-address-manager/-/interface-address-manager-2.0.1.tgz", - "integrity": "sha512-JjlQUJ0cF1h0wsOS22PNRQiiiMLwftd5QttjJK2jDsou5FkZETeQ9eYL05I0ykQKZvEJqwH8G5WLwxWtwsj7Ag==", - "requires": { - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^11.0.0" - } - }, - "@libp2p/interface-transport": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@libp2p/interface-transport/-/interface-transport-2.0.1.tgz", - "integrity": "sha512-yrL6YZmPQX4JT/E/60XgNgNSCu9tNPjjq2HuWZs1n1k8cstV0/WvViUE8aoOlJlKZSVjQNcpRAy9LgVxznK7/g==", - "requires": { - "@libp2p/interface-connection": "^3.0.0", - "@libp2p/interface-stream-muxer": "^3.0.0", - "@libp2p/interfaces": "^3.0.0", - "@multiformats/multiaddr": "^11.0.0", - "it-stream-types": "^1.0.4" - } - }, "it-all": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/it-all/-/it-all-2.0.0.tgz", diff --git a/packages/byte-utils/tsconfig.dev.json b/packages/byte-utils/tsconfig.dev.json index ffc27ef6ba..4f7c34af3c 100644 --- a/packages/byte-utils/tsconfig.dev.json +++ b/packages/byte-utils/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "exclude": [] + "extends": "../../tsconfig.dev" } diff --git a/packages/byte-utils/tsconfig.json b/packages/byte-utils/tsconfig.json index 7b01b30897..eebbc51585 100644 --- a/packages/byte-utils/tsconfig.json +++ b/packages/byte-utils/tsconfig.json @@ -1,54 +1,10 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "incremental": true, - "target": "es2020", "outDir": "dist/", "rootDir": "src", - "moduleResolution": "node", - "module": "es2020", - "declaration": true, - "sourceMap": true, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Include modules imported with .json extension. */, - "tsBuildInfoFile": "dist/.tsbuildinfo", - "strict": true /* Enable all strict type-checking options. */, - - /* Strict Type-Checking Options */ - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "forceConsistentCasingInFileNames": true, - - /* Debugging Options */ - "traceResolution": false /* Report module resolution log messages. */, - "listEmittedFiles": false /* Print names of generated files part of the compilation. */, - "listFiles": false /* Print names of files part of the compilation. */, - "pretty": true /* Stylize errors and messages using color and context. */, - - // Due to broken types in indirect dependencies - "skipLibCheck": true, - - /* Experimental Options */ - // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, - - "lib": ["es2020", "dom"], - "types": ["node", "mocha"], - "typeRoots": ["node_modules/@types", "src/types"] + "tsBuildInfoFile": "dist/.tsbuildinfo" }, "include": ["src"], - "exclude": ["src/**/*.spec.ts", "src/test_utils"], - "compileOnSave": false, - "ts-node": { - "files": true - } + "exclude": ["src/**/*.spec.ts", "src/test_utils"] } diff --git a/packages/core/build-scripts/fix-imports.js b/packages/core/build-scripts/fix-imports.js deleted file mode 100644 index 31562e9046..0000000000 --- a/packages/core/build-scripts/fix-imports.js +++ /dev/null @@ -1,69 +0,0 @@ -import path from "path"; -import fs from "fs"; - -const START_PATH = path.join(process.cwd(), "dist/"); -const IMPORT_REGEXP = - /^((import|export) [^';]* from "(\.[^@";]*\/[^";]*)[^";]*)"/g; -const JUST_ADD_AN_EXTENSION = '$1.js"'; -const ADD_INDEX_FILE = '$1/index.js"'; -const JS_EXT = ".js"; - -function fixImportsAtFolder(rootPath) { - const entries = fs.readdirSync(rootPath); - - entries.forEach((entry) => { - const entryPath = path.join(rootPath, entry); - if (entry.endsWith(JS_EXT)) { - fixImportsAtFile(entryPath); - } else { - const extName = path.extname(entry); - if (!extName) { - const stat = fs.statSync(entryPath); - if (stat.isDirectory()) { - fixImportsAtFolder(entryPath); - } - } - } - }); -} - -function fixImportsAtFile(filePath) { - const content = fs.readFileSync(filePath).toString("utf8"); - const lines = content.split("\n"); - const fixedLines = lines.map((l) => { - if (!l.match(IMPORT_REGEXP)) { - return l; - } - - const [_, importPath] = l.split(`"`); - let exists; - let fullPath; - if (importPath.startsWith(".")) { - fullPath = path.join(filePath, "..", importPath); - exists = fs.existsSync(fullPath); - } else { - fullPath = path.join(process.cwd(), "node_modules", importPath); - exists = fs.existsSync(fullPath); - } - - if (exists === false) { - console.log("Update ", l); - return l.replace(IMPORT_REGEXP, JUST_ADD_AN_EXTENSION); - } - - const stat = fs.statSync(fullPath); - const isDirectory = stat.isDirectory(); - if (isDirectory === true) { - console.log("Update ", l); - return l.replace(IMPORT_REGEXP, ADD_INDEX_FILE); - } - - return l; - }); - const withFixedImports = fixedLines.join("\n"); - fs.writeFileSync(filePath, withFixedImports); -} - -fixImportsAtFolder(START_PATH); -console.log("imports fixed..."); -console.log("================"); diff --git a/packages/core/package.json b/packages/core/package.json index 2ff0fa38a9..49cfb1a0bf 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -53,7 +53,7 @@ ], "scripts": { "build": "run-s build:**", - "build:esm": "tsc && node build-scripts/fix-imports.js", + "build:esm": "tsc", "build:bundle": "rollup --config rollup.config.js", "fix": "run-s fix:*", "fix:prettier": "prettier . --write", diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 12a1ea8c07..dbafc4d4e2 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,29 +1,29 @@ -export { DefaultPubSubTopic } from "./lib/constants"; -export { DefaultUserAgent } from "./lib/waku"; +export { DefaultPubSubTopic } from "./lib/constants.js"; +export { DefaultUserAgent } from "./lib/waku.js"; -export * as proto_message from "./proto/message"; -export * as proto_topic_only_message from "./proto/topic_only_message"; +export * as proto_message from "./proto/message.js"; +export * as proto_topic_only_message from "./proto/topic_only_message.js"; -export * as waku from "./lib/waku"; -export { WakuNode } from "./lib/waku"; +export * as waku from "./lib/waku.js"; +export { WakuNode } from "./lib/waku.js"; -export * as waku_filter from "./lib/waku_filter"; -export { wakuFilter } from "./lib/waku_filter"; +export * as waku_filter from "./lib/waku_filter/index.js"; +export { wakuFilter } from "./lib/waku_filter/index.js"; -export * as waku_light_push from "./lib/waku_light_push"; +export * as waku_light_push from "./lib/waku_light_push/index.js"; export { wakuLightPush, LightPushCodec, PushResponse, -} from "./lib/waku_light_push"; +} from "./lib/waku_light_push/index.js"; -export * as waku_relay from "./lib/waku_relay"; -export { wakuRelay } from "./lib/waku_relay"; +export * as waku_relay from "./lib/waku_relay/index.js"; +export { wakuRelay } from "./lib/waku_relay/index.js"; -export * as waku_store from "./lib/waku_store"; +export * as waku_store from "./lib/waku_store/index.js"; export { PageDirection, wakuStore, StoreCodec, createCursor, -} from "./lib/waku_store"; +} from "./lib/waku_store/index.js"; diff --git a/packages/core/src/lib/predefined_bootstrap_nodes.ts b/packages/core/src/lib/predefined_bootstrap_nodes.ts index b46ea5f461..69e7f8ad44 100644 --- a/packages/core/src/lib/predefined_bootstrap_nodes.ts +++ b/packages/core/src/lib/predefined_bootstrap_nodes.ts @@ -1,4 +1,4 @@ -import { getPseudoRandomSubset } from "./random_subset"; +import { getPseudoRandomSubset } from "./random_subset.js"; export const DefaultWantedNumber = 1; diff --git a/packages/core/src/lib/push_or_init_map.spec.ts b/packages/core/src/lib/push_or_init_map.spec.ts index e6ffd1456e..6b59e04331 100644 --- a/packages/core/src/lib/push_or_init_map.spec.ts +++ b/packages/core/src/lib/push_or_init_map.spec.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { pushOrInitMapSet } from "./push_or_init_map"; +import { pushOrInitMapSet } from "./push_or_init_map.js"; describe("pushOrInitMapSet", () => { it("Init the array if not present", () => { diff --git a/packages/core/src/lib/to_proto_message.spec.ts b/packages/core/src/lib/to_proto_message.spec.ts index 2280c99f12..1f45affb75 100644 --- a/packages/core/src/lib/to_proto_message.spec.ts +++ b/packages/core/src/lib/to_proto_message.spec.ts @@ -1,8 +1,8 @@ import { expect } from "chai"; -import { WakuMessage as WakuMessageProto } from "../proto/message"; +import { WakuMessage as WakuMessageProto } from "../proto/message.js"; -import { toProtoMessage } from "./to_proto_message"; +import { toProtoMessage } from "./to_proto_message.js"; describe("to proto message", () => { it("Fields are not dropped", () => { diff --git a/packages/core/src/lib/to_proto_message.ts b/packages/core/src/lib/to_proto_message.ts index b554581214..f2c987c992 100644 --- a/packages/core/src/lib/to_proto_message.ts +++ b/packages/core/src/lib/to_proto_message.ts @@ -1,6 +1,6 @@ import { ProtoMessage } from "@waku/interfaces"; -import { WakuMessage as WakuMessageProto } from "../proto/message"; +import { WakuMessage as WakuMessageProto } from "../proto/message.js"; const EmptyMessage: ProtoMessage = { payload: undefined, diff --git a/packages/core/src/lib/wait_for_remote_peer.ts b/packages/core/src/lib/wait_for_remote_peer.ts index a7f9e2d64b..75f491142f 100644 --- a/packages/core/src/lib/wait_for_remote_peer.ts +++ b/packages/core/src/lib/wait_for_remote_peer.ts @@ -4,9 +4,9 @@ import { Protocols } from "@waku/interfaces"; import debug from "debug"; import { pEvent } from "p-event"; -import { FilterCodec } from "./waku_filter"; -import { LightPushCodec } from "./waku_light_push"; -import { StoreCodec } from "./waku_store"; +import { FilterCodec } from "./waku_filter/index.js"; +import { LightPushCodec } from "./waku_light_push/index.js"; +import { StoreCodec } from "./waku_store/index.js"; const log = debug("waku:wait-for-remote-peer"); diff --git a/packages/core/src/lib/waku.ts b/packages/core/src/lib/waku.ts index b5690d8889..279846b6df 100644 --- a/packages/core/src/lib/waku.ts +++ b/packages/core/src/lib/waku.ts @@ -7,12 +7,15 @@ import { Protocols } from "@waku/interfaces"; import debug from "debug"; import type { Libp2p } from "libp2p"; -import { FilterCodec, FilterComponents } from "./waku_filter"; -import { LightPushCodec, LightPushComponents } from "./waku_light_push"; -import { EncoderV0 } from "./waku_message/version_0"; -import * as relayConstants from "./waku_relay/constants"; -import { RelayCodecs, RelayPingContentTopic } from "./waku_relay/constants"; -import { StoreCodec, StoreComponents } from "./waku_store"; +import { FilterCodec, FilterComponents } from "./waku_filter/index.js"; +import { + LightPushCodec, + LightPushComponents, +} from "./waku_light_push/index.js"; +import { EncoderV0 } from "./waku_message/version_0.js"; +import * as relayConstants from "./waku_relay/constants.js"; +import { RelayCodecs, RelayPingContentTopic } from "./waku_relay/constants.js"; +import { StoreCodec, StoreComponents } from "./waku_store/index.js"; export const DefaultPingKeepAliveValueSecs = 0; export const DefaultRelayKeepAliveValueSecs = 5 * 60; diff --git a/packages/core/src/lib/waku_filter/filter_rpc.ts b/packages/core/src/lib/waku_filter/filter_rpc.ts index 493501e5ad..f3b771183e 100644 --- a/packages/core/src/lib/waku_filter/filter_rpc.ts +++ b/packages/core/src/lib/waku_filter/filter_rpc.ts @@ -1,6 +1,6 @@ import { v4 as uuid } from "uuid"; -import * as proto from "../../proto/filter"; +import * as proto from "../../proto/filter.js"; export type ContentFilter = { contentTopic: string; diff --git a/packages/core/src/lib/waku_filter/index.ts b/packages/core/src/lib/waku_filter/index.ts index 9a0ccb7cb9..6015dacd4b 100644 --- a/packages/core/src/lib/waku_filter/index.ts +++ b/packages/core/src/lib/waku_filter/index.ts @@ -18,18 +18,18 @@ import all from "it-all"; import * as lp from "it-length-prefixed"; import { pipe } from "it-pipe"; -import { WakuMessage as WakuMessageProto } from "../../proto/message"; -import { DefaultPubSubTopic } from "../constants"; -import { groupByContentTopic } from "../group_by"; -import { selectConnection } from "../select_connection"; +import { WakuMessage as WakuMessageProto } from "../../proto/message.js"; +import { DefaultPubSubTopic } from "../constants.js"; +import { groupByContentTopic } from "../group_by.js"; +import { selectConnection } from "../select_connection.js"; import { getPeersForProtocol, selectPeerForProtocol, selectRandomPeer, -} from "../select_peer"; -import { toProtoMessage } from "../to_proto_message"; +} from "../select_peer.js"; +import { toProtoMessage } from "../to_proto_message.js"; -import { ContentFilter, FilterRPC } from "./filter_rpc"; +import { ContentFilter, FilterRPC } from "./filter_rpc.js"; export { ContentFilter }; diff --git a/packages/core/src/lib/waku_light_push/index.ts b/packages/core/src/lib/waku_light_push/index.ts index 2ddaccaff8..60f202aede 100644 --- a/packages/core/src/lib/waku_light_push/index.ts +++ b/packages/core/src/lib/waku_light_push/index.ts @@ -15,16 +15,16 @@ import * as lp from "it-length-prefixed"; import { pipe } from "it-pipe"; import { Uint8ArrayList } from "uint8arraylist"; -import { PushResponse } from "../../proto/light_push"; -import { DefaultPubSubTopic } from "../constants"; -import { selectConnection } from "../select_connection"; +import { PushResponse } from "../../proto/light_push.js"; +import { DefaultPubSubTopic } from "../constants.js"; +import { selectConnection } from "../select_connection.js"; import { getPeersForProtocol, selectPeerForProtocol, selectRandomPeer, -} from "../select_peer"; +} from "../select_peer.js"; -import { PushRPC } from "./push_rpc"; +import { PushRPC } from "./push_rpc.js"; const log = debug("waku:light-push"); diff --git a/packages/core/src/lib/waku_light_push/push_rpc.ts b/packages/core/src/lib/waku_light_push/push_rpc.ts index 31ce6c94fb..84bd7d60fb 100644 --- a/packages/core/src/lib/waku_light_push/push_rpc.ts +++ b/packages/core/src/lib/waku_light_push/push_rpc.ts @@ -1,7 +1,7 @@ import type { Uint8ArrayList } from "uint8arraylist"; import { v4 as uuid } from "uuid"; -import * as proto from "../../proto/light_push"; +import * as proto from "../../proto/light_push.js"; export class PushRPC { public constructor(public proto: proto.PushRPC) {} diff --git a/packages/core/src/lib/waku_message/topic_only_message.ts b/packages/core/src/lib/waku_message/topic_only_message.ts index d720fce1db..cddc970ce1 100644 --- a/packages/core/src/lib/waku_message/topic_only_message.ts +++ b/packages/core/src/lib/waku_message/topic_only_message.ts @@ -1,7 +1,7 @@ import type { DecodedMessage, Decoder, ProtoMessage } from "@waku/interfaces"; import debug from "debug"; -import * as proto from "../../proto/topic_only_message"; +import * as proto from "../../proto/topic_only_message.js"; const log = debug("waku:message:topic-only"); diff --git a/packages/core/src/lib/waku_message/version_0.spec.ts b/packages/core/src/lib/waku_message/version_0.spec.ts index 586d72910c..08a88001ef 100644 --- a/packages/core/src/lib/waku_message/version_0.spec.ts +++ b/packages/core/src/lib/waku_message/version_0.spec.ts @@ -1,7 +1,7 @@ import { expect } from "chai"; import fc from "fast-check"; -import { DecoderV0, EncoderV0, MessageV0 } from "./version_0"; +import { DecoderV0, EncoderV0, MessageV0 } from "./version_0.js"; const TestContentTopic = "/test/1/waku-message/utf8"; diff --git a/packages/core/src/lib/waku_message/version_0.ts b/packages/core/src/lib/waku_message/version_0.ts index 89d630b706..056504a067 100644 --- a/packages/core/src/lib/waku_message/version_0.ts +++ b/packages/core/src/lib/waku_message/version_0.ts @@ -8,7 +8,7 @@ import type { } from "@waku/interfaces"; import debug from "debug"; -import * as proto from "../../proto/message"; +import * as proto from "../../proto/message.js"; const log = debug("waku:message:version-0"); const OneMillion = BigInt(1_000_000); diff --git a/packages/core/src/lib/waku_relay/index.ts b/packages/core/src/lib/waku_relay/index.ts index f1832e9e3d..edd2ecd501 100644 --- a/packages/core/src/lib/waku_relay/index.ts +++ b/packages/core/src/lib/waku_relay/index.ts @@ -4,10 +4,7 @@ import { GossipsubMessage, GossipsubOpts, } from "@chainsafe/libp2p-gossipsub"; -import { - PeerIdStr, - TopicStr, -} from "@chainsafe/libp2p-gossipsub/dist/src/types"; +import type { PeerIdStr, TopicStr } from "@chainsafe/libp2p-gossipsub/types"; import { SignaturePolicy } from "@chainsafe/libp2p-gossipsub/types"; import type { Callback, @@ -20,11 +17,11 @@ import type { import { DecodedMessage } from "@waku/interfaces"; import debug from "debug"; -import { DefaultPubSubTopic } from "../constants"; -import { pushOrInitMapSet } from "../push_or_init_map"; -import { TopicOnlyDecoder } from "../waku_message/topic_only_message"; +import { DefaultPubSubTopic } from "../constants.js"; +import { pushOrInitMapSet } from "../push_or_init_map.js"; +import { TopicOnlyDecoder } from "../waku_message/topic_only_message.js"; -import * as constants from "./constants"; +import * as constants from "./constants.js"; const log = debug("waku:relay"); diff --git a/packages/core/src/lib/waku_store/history_rpc.ts b/packages/core/src/lib/waku_store/history_rpc.ts index ec83d9c0ff..212b546933 100644 --- a/packages/core/src/lib/waku_store/history_rpc.ts +++ b/packages/core/src/lib/waku_store/history_rpc.ts @@ -1,7 +1,7 @@ import type { Uint8ArrayList } from "uint8arraylist"; import { v4 as uuid } from "uuid"; -import * as proto from "../../proto/store"; +import * as proto from "../../proto/store.js"; const OneMillion = BigInt(1_000_000); diff --git a/packages/core/src/lib/waku_store/index.ts b/packages/core/src/lib/waku_store/index.ts index b4a5626fa9..bb343de0f0 100644 --- a/packages/core/src/lib/waku_store/index.ts +++ b/packages/core/src/lib/waku_store/index.ts @@ -17,13 +17,13 @@ import * as lp from "it-length-prefixed"; import { pipe } from "it-pipe"; import { Uint8ArrayList } from "uint8arraylist"; -import * as proto from "../../proto/store"; -import { DefaultPubSubTopic } from "../constants"; -import { selectConnection } from "../select_connection"; -import { getPeersForProtocol, selectPeerForProtocol } from "../select_peer"; -import { toProtoMessage } from "../to_proto_message"; +import * as proto from "../../proto/store.js"; +import { DefaultPubSubTopic } from "../constants.js"; +import { selectConnection } from "../select_connection.js"; +import { getPeersForProtocol, selectPeerForProtocol } from "../select_peer.js"; +import { toProtoMessage } from "../to_proto_message.js"; -import { HistoryRPC, PageDirection, Params } from "./history_rpc"; +import { HistoryRPC, PageDirection, Params } from "./history_rpc.js"; import HistoryError = proto.HistoryResponse.HistoryError; diff --git a/packages/core/tsconfig.dev.json b/packages/core/tsconfig.dev.json index ffc27ef6ba..4f7c34af3c 100644 --- a/packages/core/tsconfig.dev.json +++ b/packages/core/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "exclude": [] + "extends": "../../tsconfig.dev" } diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 7b01b30897..eebbc51585 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -1,54 +1,10 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "incremental": true, - "target": "es2020", "outDir": "dist/", "rootDir": "src", - "moduleResolution": "node", - "module": "es2020", - "declaration": true, - "sourceMap": true, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Include modules imported with .json extension. */, - "tsBuildInfoFile": "dist/.tsbuildinfo", - "strict": true /* Enable all strict type-checking options. */, - - /* Strict Type-Checking Options */ - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "forceConsistentCasingInFileNames": true, - - /* Debugging Options */ - "traceResolution": false /* Report module resolution log messages. */, - "listEmittedFiles": false /* Print names of generated files part of the compilation. */, - "listFiles": false /* Print names of files part of the compilation. */, - "pretty": true /* Stylize errors and messages using color and context. */, - - // Due to broken types in indirect dependencies - "skipLibCheck": true, - - /* Experimental Options */ - // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, - - "lib": ["es2020", "dom"], - "types": ["node", "mocha"], - "typeRoots": ["node_modules/@types", "src/types"] + "tsBuildInfoFile": "dist/.tsbuildinfo" }, "include": ["src"], - "exclude": ["src/**/*.spec.ts", "src/test_utils"], - "compileOnSave": false, - "ts-node": { - "files": true - } + "exclude": ["src/**/*.spec.ts", "src/test_utils"] } diff --git a/packages/create/package.json b/packages/create/package.json index 208bb81cda..3928a2858b 100644 --- a/packages/create/package.json +++ b/packages/create/package.json @@ -52,11 +52,24 @@ "dependencies": { "@chainsafe/libp2p-noise": "^10.1.0", "@libp2p/bootstrap": "^5.0.0", + "@libp2p/interface-address-manager": "^2.0.1", + "@libp2p/interface-connection": "^3.0.3", + "@libp2p/interface-connection-manager": "^1.3.1", + "@libp2p/interface-content-routing": "^1.0.4", + "@libp2p/interface-dht": "^1.0.3", + "@libp2p/interface-metrics": "^3.0.0", "@libp2p/interface-peer-discovery": "^1.0.2", + "@libp2p/interface-peer-id": "^1.0.6", + "@libp2p/interface-peer-routing": "^1.0.2", + "@libp2p/interface-peer-store": "^1.2.3", + "@libp2p/interface-pubsub": "^3.0.1", + "@libp2p/interface-registrar": "^2.0.4", + "@libp2p/interface-transport": "^2.0.1", "@libp2p/mplex": "^7.0.0", "@libp2p/websockets": "^5.0.0", "@waku/core": "*", - "@waku/interfaces": "*" + "@waku/interfaces": "*", + "interface-datastore": "^7.0.1" }, "devDependencies": { "@rollup/plugin-commonjs": "^22.0.0", diff --git a/packages/create/src/index.ts b/packages/create/src/index.ts index 63e09865ac..98b9cba06c 100644 --- a/packages/create/src/index.ts +++ b/packages/create/src/index.ts @@ -18,7 +18,10 @@ import { getPredefinedBootstrapNodes } from "@waku/core/lib/predefined_bootstrap import type { Relay, WakuFull, WakuLight, WakuPrivacy } from "@waku/interfaces"; import type { Libp2p } from "libp2p"; import { createLibp2p, Libp2pOptions } from "libp2p"; -import type { Components } from "libp2p/components"; + +import type { Libp2pComponents } from "./libp2p_components.js"; + +export { Libp2pComponents }; type WakuOptions = waku.WakuOptions; type RelayCreateOptions = waku_relay.CreateOptions; @@ -158,13 +161,13 @@ export async function createFullNode( } export function defaultPeerDiscovery(): ( - components: Components + components: Libp2pComponents ) => PeerDiscovery { return bootstrap({ list: getPredefinedBootstrapNodes() }); } export async function defaultLibp2p( - wakuRelay?: (components: Components) => Relay, + wakuRelay?: (components: Libp2pComponents) => Relay, options?: Partial, userAgent?: string ): Promise { diff --git a/packages/create/src/libp2p_components.ts b/packages/create/src/libp2p_components.ts new file mode 100644 index 0000000000..d04adad066 --- /dev/null +++ b/packages/create/src/libp2p_components.ts @@ -0,0 +1,39 @@ +import type { AddressManager } from "@libp2p/interface-address-manager"; +import type { + ConnectionGater, + ConnectionProtector, +} from "@libp2p/interface-connection"; +import type { + ConnectionManager, + Dialer, +} from "@libp2p/interface-connection-manager"; +import type { ContentRouting } from "@libp2p/interface-content-routing"; +import type { DualDHT } from "@libp2p/interface-dht"; +import type { Metrics } from "@libp2p/interface-metrics"; +import type { PeerId } from "@libp2p/interface-peer-id"; +import type { PeerRouting } from "@libp2p/interface-peer-routing"; +import type { PeerStore } from "@libp2p/interface-peer-store"; +import type { PubSub } from "@libp2p/interface-pubsub"; +import type { Registrar } from "@libp2p/interface-registrar"; +import type { TransportManager, Upgrader } from "@libp2p/interface-transport"; +import type { Datastore } from "interface-datastore"; + +// TODO: Get libp2p to export this. +export interface Libp2pComponents { + peerId: PeerId; + addressManager: AddressManager; + peerStore: PeerStore; + upgrader: Upgrader; + registrar: Registrar; + connectionManager: ConnectionManager; + transportManager: TransportManager; + connectionGater: ConnectionGater; + contentRouting: ContentRouting; + peerRouting: PeerRouting; + datastore: Datastore; + connectionProtector?: ConnectionProtector; + dialer: Dialer; + metrics?: Metrics; + dht?: DualDHT; + pubsub?: PubSub; +} diff --git a/packages/create/tsconfig.dev.json b/packages/create/tsconfig.dev.json index ffc27ef6ba..4f7c34af3c 100644 --- a/packages/create/tsconfig.dev.json +++ b/packages/create/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "exclude": [] + "extends": "../../tsconfig.dev" } diff --git a/packages/create/tsconfig.json b/packages/create/tsconfig.json index 7b01b30897..eebbc51585 100644 --- a/packages/create/tsconfig.json +++ b/packages/create/tsconfig.json @@ -1,54 +1,10 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "incremental": true, - "target": "es2020", "outDir": "dist/", "rootDir": "src", - "moduleResolution": "node", - "module": "es2020", - "declaration": true, - "sourceMap": true, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Include modules imported with .json extension. */, - "tsBuildInfoFile": "dist/.tsbuildinfo", - "strict": true /* Enable all strict type-checking options. */, - - /* Strict Type-Checking Options */ - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "forceConsistentCasingInFileNames": true, - - /* Debugging Options */ - "traceResolution": false /* Report module resolution log messages. */, - "listEmittedFiles": false /* Print names of generated files part of the compilation. */, - "listFiles": false /* Print names of files part of the compilation. */, - "pretty": true /* Stylize errors and messages using color and context. */, - - // Due to broken types in indirect dependencies - "skipLibCheck": true, - - /* Experimental Options */ - // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, - - "lib": ["es2020", "dom"], - "types": ["node", "mocha"], - "typeRoots": ["node_modules/@types", "src/types"] + "tsBuildInfoFile": "dist/.tsbuildinfo" }, "include": ["src"], - "exclude": ["src/**/*.spec.ts", "src/test_utils"], - "compileOnSave": false, - "ts-node": { - "files": true - } + "exclude": ["src/**/*.spec.ts", "src/test_utils"] } diff --git a/packages/dns-discovery/tsconfig.dev.json b/packages/dns-discovery/tsconfig.dev.json index ffc27ef6ba..4f7c34af3c 100644 --- a/packages/dns-discovery/tsconfig.dev.json +++ b/packages/dns-discovery/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "exclude": [] + "extends": "../../tsconfig.dev" } diff --git a/packages/dns-discovery/tsconfig.json b/packages/dns-discovery/tsconfig.json index 7b01b30897..eebbc51585 100644 --- a/packages/dns-discovery/tsconfig.json +++ b/packages/dns-discovery/tsconfig.json @@ -1,54 +1,10 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "incremental": true, - "target": "es2020", "outDir": "dist/", "rootDir": "src", - "moduleResolution": "node", - "module": "es2020", - "declaration": true, - "sourceMap": true, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Include modules imported with .json extension. */, - "tsBuildInfoFile": "dist/.tsbuildinfo", - "strict": true /* Enable all strict type-checking options. */, - - /* Strict Type-Checking Options */ - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "forceConsistentCasingInFileNames": true, - - /* Debugging Options */ - "traceResolution": false /* Report module resolution log messages. */, - "listEmittedFiles": false /* Print names of generated files part of the compilation. */, - "listFiles": false /* Print names of files part of the compilation. */, - "pretty": true /* Stylize errors and messages using color and context. */, - - // Due to broken types in indirect dependencies - "skipLibCheck": true, - - /* Experimental Options */ - // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, - - "lib": ["es2020", "dom"], - "types": ["node", "mocha"], - "typeRoots": ["node_modules/@types", "src/types"] + "tsBuildInfoFile": "dist/.tsbuildinfo" }, "include": ["src"], - "exclude": ["src/**/*.spec.ts", "src/test_utils"], - "compileOnSave": false, - "ts-node": { - "files": true - } + "exclude": ["src/**/*.spec.ts", "src/test_utils"] } diff --git a/packages/enr/src/enr.ts b/packages/enr/src/enr.ts index 439d26e148..faabd94f1d 100644 --- a/packages/enr/src/enr.ts +++ b/packages/enr/src/enr.ts @@ -27,12 +27,12 @@ import { createPeerIdFromKeypair, IKeypair, KeypairType, -} from "./keypair"; -import { multiaddrFromFields } from "./multiaddr_from_fields"; -import { decodeMultiaddrs, encodeMultiaddrs } from "./multiaddrs_codec"; -import { ENRKey, ENRValue, NodeId, SequenceNumber } from "./types"; -import * as v4 from "./v4"; -import { decodeWaku2, encodeWaku2, Waku2 } from "./waku2_codec"; +} from "./keypair/index.js"; +import { multiaddrFromFields } from "./multiaddr_from_fields.js"; +import { decodeMultiaddrs, encodeMultiaddrs } from "./multiaddrs_codec.js"; +import { ENRKey, ENRValue, NodeId, SequenceNumber } from "./types.js"; +import * as v4 from "./v4.js"; +import { decodeWaku2, encodeWaku2, Waku2 } from "./waku2_codec.js"; const log = debug("waku:enr"); diff --git a/packages/enr/tsconfig.dev.json b/packages/enr/tsconfig.dev.json index ffc27ef6ba..4f7c34af3c 100644 --- a/packages/enr/tsconfig.dev.json +++ b/packages/enr/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "exclude": [] + "extends": "../../tsconfig.dev" } diff --git a/packages/enr/tsconfig.json b/packages/enr/tsconfig.json index 7b01b30897..eebbc51585 100644 --- a/packages/enr/tsconfig.json +++ b/packages/enr/tsconfig.json @@ -1,54 +1,10 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "incremental": true, - "target": "es2020", "outDir": "dist/", "rootDir": "src", - "moduleResolution": "node", - "module": "es2020", - "declaration": true, - "sourceMap": true, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Include modules imported with .json extension. */, - "tsBuildInfoFile": "dist/.tsbuildinfo", - "strict": true /* Enable all strict type-checking options. */, - - /* Strict Type-Checking Options */ - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "forceConsistentCasingInFileNames": true, - - /* Debugging Options */ - "traceResolution": false /* Report module resolution log messages. */, - "listEmittedFiles": false /* Print names of generated files part of the compilation. */, - "listFiles": false /* Print names of files part of the compilation. */, - "pretty": true /* Stylize errors and messages using color and context. */, - - // Due to broken types in indirect dependencies - "skipLibCheck": true, - - /* Experimental Options */ - // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, - - "lib": ["es2020", "dom"], - "types": ["node", "mocha"], - "typeRoots": ["node_modules/@types", "src/types"] + "tsBuildInfoFile": "dist/.tsbuildinfo" }, "include": ["src"], - "exclude": ["src/**/*.spec.ts", "src/test_utils"], - "compileOnSave": false, - "ts-node": { - "files": true - } + "exclude": ["src/**/*.spec.ts", "src/test_utils"] } diff --git a/packages/interfaces/tsconfig.dev.json b/packages/interfaces/tsconfig.dev.json index ffc27ef6ba..4f7c34af3c 100644 --- a/packages/interfaces/tsconfig.dev.json +++ b/packages/interfaces/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "exclude": [] + "extends": "../../tsconfig.dev" } diff --git a/packages/interfaces/tsconfig.json b/packages/interfaces/tsconfig.json index 7b01b30897..eebbc51585 100644 --- a/packages/interfaces/tsconfig.json +++ b/packages/interfaces/tsconfig.json @@ -1,54 +1,10 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "incremental": true, - "target": "es2020", "outDir": "dist/", "rootDir": "src", - "moduleResolution": "node", - "module": "es2020", - "declaration": true, - "sourceMap": true, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Include modules imported with .json extension. */, - "tsBuildInfoFile": "dist/.tsbuildinfo", - "strict": true /* Enable all strict type-checking options. */, - - /* Strict Type-Checking Options */ - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "forceConsistentCasingInFileNames": true, - - /* Debugging Options */ - "traceResolution": false /* Report module resolution log messages. */, - "listEmittedFiles": false /* Print names of generated files part of the compilation. */, - "listFiles": false /* Print names of files part of the compilation. */, - "pretty": true /* Stylize errors and messages using color and context. */, - - // Due to broken types in indirect dependencies - "skipLibCheck": true, - - /* Experimental Options */ - // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, - - "lib": ["es2020", "dom"], - "types": ["node", "mocha"], - "typeRoots": ["node_modules/@types", "src/types"] + "tsBuildInfoFile": "dist/.tsbuildinfo" }, "include": ["src"], - "exclude": ["src/**/*.spec.ts", "src/test_utils"], - "compileOnSave": false, - "ts-node": { - "files": true - } + "exclude": ["src/**/*.spec.ts", "src/test_utils"] } diff --git a/packages/message-encryption/tsconfig.dev.json b/packages/message-encryption/tsconfig.dev.json index ffc27ef6ba..4f7c34af3c 100644 --- a/packages/message-encryption/tsconfig.dev.json +++ b/packages/message-encryption/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "exclude": [] + "extends": "../../tsconfig.dev" } diff --git a/packages/message-encryption/tsconfig.json b/packages/message-encryption/tsconfig.json index 7b01b30897..eebbc51585 100644 --- a/packages/message-encryption/tsconfig.json +++ b/packages/message-encryption/tsconfig.json @@ -1,54 +1,10 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "incremental": true, - "target": "es2020", "outDir": "dist/", "rootDir": "src", - "moduleResolution": "node", - "module": "es2020", - "declaration": true, - "sourceMap": true, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Include modules imported with .json extension. */, - "tsBuildInfoFile": "dist/.tsbuildinfo", - "strict": true /* Enable all strict type-checking options. */, - - /* Strict Type-Checking Options */ - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "forceConsistentCasingInFileNames": true, - - /* Debugging Options */ - "traceResolution": false /* Report module resolution log messages. */, - "listEmittedFiles": false /* Print names of generated files part of the compilation. */, - "listFiles": false /* Print names of files part of the compilation. */, - "pretty": true /* Stylize errors and messages using color and context. */, - - // Due to broken types in indirect dependencies - "skipLibCheck": true, - - /* Experimental Options */ - // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, - - "lib": ["es2020", "dom"], - "types": ["node", "mocha"], - "typeRoots": ["node_modules/@types", "src/types"] + "tsBuildInfoFile": "dist/.tsbuildinfo" }, "include": ["src"], - "exclude": ["src/**/*.spec.ts", "src/test_utils"], - "compileOnSave": false, - "ts-node": { - "files": true - } + "exclude": ["src/**/*.spec.ts", "src/test_utils"] } diff --git a/packages/tests/src/async_fs.ts b/packages/tests/src/async_fs.ts index 906ebd7f6c..c93f695044 100644 --- a/packages/tests/src/async_fs.ts +++ b/packages/tests/src/async_fs.ts @@ -8,7 +8,7 @@ import fs, { promises as asyncFs } from "fs"; import { promisify } from "util"; -import { delay } from "./delay"; +import { delay } from "./delay.js"; export const existsAsync = (filepath: string): Promise => asyncFs.access(filepath, fs.constants.F_OK); diff --git a/packages/tests/src/index.ts b/packages/tests/src/index.ts index 4cdf70a3f9..5c82602b61 100644 --- a/packages/tests/src/index.ts +++ b/packages/tests/src/index.ts @@ -5,7 +5,8 @@ * @module */ -export * from "./async_fs"; -export * from "./constants"; -export * from "./log_file"; -export * from "./nwaku"; +export * from "./async_fs.js"; +export * from "./constants.js"; +export * from "./delay.js"; +export * from "./log_file.js"; +export * from "./nwaku.js"; diff --git a/packages/tests/src/log_file.ts b/packages/tests/src/log_file.ts index fc1c43e51a..7b30472717 100644 --- a/packages/tests/src/log_file.ts +++ b/packages/tests/src/log_file.ts @@ -9,7 +9,7 @@ import { Context } from "mocha"; import pTimeout from "p-timeout"; import { Tail } from "tail"; -import { waitForFile } from "./async_fs"; +import { waitForFile } from "./async_fs.js"; export default async function waitForLine( filepath: string, diff --git a/packages/tests/src/nwaku.ts b/packages/tests/src/nwaku.ts index f3d2dab561..6e6ddcdd87 100644 --- a/packages/tests/src/nwaku.ts +++ b/packages/tests/src/nwaku.ts @@ -9,9 +9,9 @@ import appRoot from "app-root-path"; import debug from "debug"; import portfinder from "portfinder"; -import { existsAsync, mkdirAsync, openAsync } from "./async_fs"; -import { delay } from "./delay"; -import waitForLine from "./log_file"; +import { existsAsync, mkdirAsync, openAsync } from "./async_fs.js"; +import { delay } from "./delay.js"; +import waitForLine from "./log_file.js"; const log = debug("waku:nwaku"); diff --git a/packages/tests/tests/enr.node.spec.ts b/packages/tests/tests/enr.node.spec.ts index 725af4cdbc..3e85ce269c 100644 --- a/packages/tests/tests/enr.node.spec.ts +++ b/packages/tests/tests/enr.node.spec.ts @@ -5,7 +5,7 @@ import type { WakuPrivacy } from "@waku/interfaces"; import { Protocols } from "@waku/interfaces"; import { expect } from "chai"; -import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src"; +import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src/index.js"; describe("ENR Interop: nwaku", function () { let waku: WakuPrivacy; diff --git a/packages/tests/tests/ephemeral.node.spec.ts b/packages/tests/tests/ephemeral.node.spec.ts index 408906a33a..78c3ab80b7 100644 --- a/packages/tests/tests/ephemeral.node.spec.ts +++ b/packages/tests/tests/ephemeral.node.spec.ts @@ -15,8 +15,13 @@ import { import { expect } from "chai"; import debug from "debug"; -import { makeLogFileName, NOISE_KEY_1, NOISE_KEY_2, Nwaku } from "../src"; -import { delay } from "../src/delay"; +import { + delay, + makeLogFileName, + NOISE_KEY_1, + NOISE_KEY_2, + Nwaku, +} from "../src/index.js"; const log = debug("waku:test:ephemeral"); diff --git a/packages/tests/tests/filter.node.spec.ts b/packages/tests/tests/filter.node.spec.ts index 514250d39b..823d43a33d 100644 --- a/packages/tests/tests/filter.node.spec.ts +++ b/packages/tests/tests/filter.node.spec.ts @@ -7,8 +7,7 @@ import { Protocols } from "@waku/interfaces"; import { expect } from "chai"; import debug from "debug"; -import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src"; -import { delay } from "../src/delay"; +import { delay, makeLogFileName, NOISE_KEY_1, Nwaku } from "../src/index.js"; const log = debug("waku:test"); diff --git a/packages/tests/tests/light_push.node.spec.ts b/packages/tests/tests/light_push.node.spec.ts index e06fb2d3df..38b8edca22 100644 --- a/packages/tests/tests/light_push.node.spec.ts +++ b/packages/tests/tests/light_push.node.spec.ts @@ -8,12 +8,12 @@ import { expect } from "chai"; import debug from "debug"; import { + delay, makeLogFileName, MessageRpcResponse, NOISE_KEY_1, Nwaku, -} from "../src"; -import { delay } from "../src/delay"; +} from "../src/index.js"; const log = debug("waku:test:lightpush"); diff --git a/packages/tests/tests/log_file.node.spec.ts b/packages/tests/tests/log_file.node.spec.ts index 0d40474b6f..c79b5f2bd7 100644 --- a/packages/tests/tests/log_file.node.spec.ts +++ b/packages/tests/tests/log_file.node.spec.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { makeLogFileName } from "../src"; +import { makeLogFileName } from "../src/index.js"; describe("This", function () { describe("Is", function () { diff --git a/packages/tests/tests/nwaku.node.spec.ts b/packages/tests/tests/nwaku.node.spec.ts index 45edb8bf0f..5423b584f0 100644 --- a/packages/tests/tests/nwaku.node.spec.ts +++ b/packages/tests/tests/nwaku.node.spec.ts @@ -1,6 +1,6 @@ import { expect } from "chai"; -import { argsToArray, defaultArgs } from "../src"; +import { argsToArray, defaultArgs } from "../src/index.js"; describe("nwaku", () => { it("Correctly serialized arguments", function () { diff --git a/packages/tests/tests/relay.node.spec.ts b/packages/tests/tests/relay.node.spec.ts index ac8f533127..e112941ea6 100644 --- a/packages/tests/tests/relay.node.spec.ts +++ b/packages/tests/tests/relay.node.spec.ts @@ -23,14 +23,14 @@ import { expect } from "chai"; import debug from "debug"; import { + delay, makeLogFileName, MessageRpcResponse, NOISE_KEY_1, NOISE_KEY_2, NOISE_KEY_3, Nwaku, -} from "../src"; -import { delay } from "../src/delay"; +} from "../src/index.js"; const log = debug("waku:test"); diff --git a/packages/tests/tests/store.node.spec.ts b/packages/tests/tests/store.node.spec.ts index 04db791a0d..25b817fa23 100644 --- a/packages/tests/tests/store.node.spec.ts +++ b/packages/tests/tests/store.node.spec.ts @@ -17,8 +17,13 @@ import { import { expect } from "chai"; import debug from "debug"; -import { makeLogFileName, NOISE_KEY_1, NOISE_KEY_2, Nwaku } from "../src"; -import { delay } from "../src/delay"; +import { + delay, + makeLogFileName, + NOISE_KEY_1, + NOISE_KEY_2, + Nwaku, +} from "../src/index.js"; const log = debug("waku:test:store"); diff --git a/packages/tests/tests/wait_for_remote_peer.node.spec.ts b/packages/tests/tests/wait_for_remote_peer.node.spec.ts index 08bbb4da5c..8adf521525 100644 --- a/packages/tests/tests/wait_for_remote_peer.node.spec.ts +++ b/packages/tests/tests/wait_for_remote_peer.node.spec.ts @@ -4,8 +4,7 @@ import type { WakuLight, WakuPrivacy } from "@waku/interfaces"; import { Protocols } from "@waku/interfaces"; import { expect } from "chai"; -import { makeLogFileName, NOISE_KEY_1, Nwaku } from "../src"; -import { delay } from "../src/delay"; +import { delay, makeLogFileName, NOISE_KEY_1, Nwaku } from "../src/index.js"; describe("Wait for remote peer", function () { let waku1: WakuPrivacy; diff --git a/packages/tests/tests/waku.node.spec.ts b/packages/tests/tests/waku.node.spec.ts index f56c8a8c27..9a85475b7a 100644 --- a/packages/tests/tests/waku.node.spec.ts +++ b/packages/tests/tests/waku.node.spec.ts @@ -18,7 +18,12 @@ import { } from "@waku/message-encryption"; import { expect } from "chai"; -import { makeLogFileName, NOISE_KEY_1, NOISE_KEY_2, Nwaku } from "../src/"; +import { + makeLogFileName, + NOISE_KEY_1, + NOISE_KEY_2, + Nwaku, +} from "../src/index.js"; const TestContentTopic = "/test/1/waku/utf8"; diff --git a/packages/tests/tsconfig.dev.json b/packages/tests/tsconfig.dev.json index d64199f6ad..4f7c34af3c 100644 --- a/packages/tests/tsconfig.dev.json +++ b/packages/tests/tsconfig.dev.json @@ -1,8 +1,3 @@ { - "extends": "./tsconfig", - "compilerOptions": { - "module": "esnext", - "noEmit": true - }, - "include": ["src", "tests"] + "extends": "../../tsconfig.dev" } diff --git a/packages/tests/tsconfig.json b/packages/tests/tsconfig.json index 49df3977af..eebbc51585 100644 --- a/packages/tests/tsconfig.json +++ b/packages/tests/tsconfig.json @@ -1,53 +1,10 @@ { + "extends": "../../tsconfig", "compilerOptions": { - "incremental": true, - "target": "es2020", "outDir": "dist/", - "moduleResolution": "node", - "module": "es2020", - "declaration": true, - "sourceMap": true, - "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, - "resolveJsonModule": true /* Include modules imported with .json extension. */, - "tsBuildInfoFile": "dist/.tsbuildinfo", - "strict": true /* Enable all strict type-checking options. */, - - /* Strict Type-Checking Options */ - "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, - "strictNullChecks": true /* Enable strict null checks. */, - "strictFunctionTypes": true /* Enable strict checking of function types. */, - "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, - "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, - "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, - - /* Additional Checks */ - "noUnusedLocals": true /* Report errors on unused locals. */, - "noUnusedParameters": true /* Report errors on unused parameters. */, - "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, - "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, - "forceConsistentCasingInFileNames": true, - - /* Debugging Options */ - "traceResolution": false /* Report module resolution log messages. */, - "listEmittedFiles": false /* Print names of generated files part of the compilation. */, - "listFiles": false /* Print names of files part of the compilation. */, - "pretty": true /* Stylize errors and messages using color and context. */, - - // Due to broken types in indirect dependencies - "skipLibCheck": true, - - /* Experimental Options */ - // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, - // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, - - "lib": ["es2020", "dom"], - "types": ["node", "mocha"], - "typeRoots": ["node_modules/@types", "src/types"] + "rootDir": "src", + "tsBuildInfoFile": "dist/.tsbuildinfo" }, "include": ["src"], - "exclude": [], - "compileOnSave": false, - "ts-node": { - "files": true - } + "exclude": ["src/**/*.spec.ts", "src/test_utils"] } diff --git a/tsconfig.dev.json b/tsconfig.dev.json new file mode 100644 index 0000000000..ffc27ef6ba --- /dev/null +++ b/tsconfig.dev.json @@ -0,0 +1,8 @@ +{ + "extends": "./tsconfig", + "compilerOptions": { + "module": "esnext", + "noEmit": true + }, + "exclude": [] +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..2a8d6a19a9 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,49 @@ +{ + "compilerOptions": { + "incremental": true, + "target": "es2020", + "moduleResolution": "node16", + "module": "es2020", + "declaration": true, + "sourceMap": true, + "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, + "resolveJsonModule": true /* Include modules imported with .json extension. */, + "strict": true /* Enable all strict type-checking options. */, + + /* Strict Type-Checking Options */ + "noImplicitAny": true /* Raise error on expressions and declarations with an implied 'any' type. */, + "strictNullChecks": true /* Enable strict null checks. */, + "strictFunctionTypes": true /* Enable strict checking of function types. */, + "strictPropertyInitialization": true /* Enable strict checking of property initialization in classes. */, + "noImplicitThis": true /* Raise error on 'this' expressions with an implied 'any' type. */, + "alwaysStrict": true /* Parse in strict mode and emit "use strict" for each source file. */, + + /* Additional Checks */ + "noUnusedLocals": true /* Report errors on unused locals. */, + "noUnusedParameters": true /* Report errors on unused parameters. */, + "noImplicitReturns": true /* Report error when not all code paths in function return a value. */, + "noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */, + "forceConsistentCasingInFileNames": true, + + /* Debugging Options */ + "traceResolution": false /* Report module resolution log messages. */, + "listEmittedFiles": false /* Print names of generated files part of the compilation. */, + "listFiles": false /* Print names of files part of the compilation. */, + "pretty": true /* Stylize errors and messages using color and context. */, + + // Due to broken types in indirect dependencies + "skipLibCheck": true, + + /* Experimental Options */ + // "experimentalDecorators": true /* Enables experimental support for ES7 decorators. */, + // "emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */, + + "lib": ["es2020", "dom"], + "types": ["node", "mocha"], + "typeRoots": ["node_modules/@types"] + }, + "compileOnSave": false, + "ts-node": { + "files": true + } +}