Remove jsx-runtime alias for React 18 (#635)

* Remove jsx-runtime alias for React 18

* Adjust override

* s/cb/fn/
This commit is contained in:
Jaco
2022-04-23 08:57:36 +02:00
committed by GitHub
parent e4787f1b25
commit 6c2d03a6c5
7 changed files with 222 additions and 213 deletions
+1 -2
View File
@@ -43,8 +43,7 @@ module.exports = {
'@polkadot/react-identicon': path.resolve(__dirname, '../react-identicon/build'),
'@polkadot/ui-keyring': path.resolve(__dirname, '../ui-keyring/build'),
'@polkadot/ui-settings': path.resolve(__dirname, '../ui-settings/build'),
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build'),
'react/jsx-runtime': require.resolve('react/jsx-runtime')
'@polkadot/ui-shared': path.resolve(__dirname, '../ui-shared/build')
},
extensions: ['.js', '.ts', '.tsx'],
fallback: {}
+2 -2
View File
@@ -29,12 +29,12 @@
"color": "^3.2.1",
"ethereum-blockies-base64": "^1.0.2",
"jdenticon": "3.1.1",
"react-copy-to-clipboard": "^5.0.4",
"react-copy-to-clipboard": "^5.1.0",
"styled-components": "^5.3.5"
},
"devDependencies": {
"@types/react-copy-to-clipboard": "^5.0.2",
"@types/react-dom": "^18.0.0",
"@types/react-dom": "^18.0.2",
"@types/styled-components": "^5.1.25",
"styled-components": "^5.3.5",
"xmlserializer": "^0.6.1"
+1 -1
View File
@@ -27,7 +27,7 @@
"react-native-svg": "^12.3.0"
},
"devDependencies": {
"@types/react-native": "^0.67.3"
"@types/react-native": "^0.67.6"
},
"peerDependencies": {
"@polkadot/util": "*",
+8 -9
View File
@@ -6,24 +6,23 @@ import type { KeyringJson, KeyringStore } from '../types';
import store from 'store';
export class BrowserStore implements KeyringStore {
public all (cb: (key: string, value: KeyringJson) => void): void {
public all (fn: (key: string, value: KeyringJson) => void): void {
store.each((value: KeyringJson, key: string): void => {
cb(key, value);
fn(key, value);
});
}
public get (key: string, cb: (value: KeyringJson) => void): void {
// eslint-disable-next-line node/no-callback-literal
cb(store.get(key) as KeyringJson);
public get (key: string, fn: (value: KeyringJson) => void): void {
fn(store.get(key) as KeyringJson);
}
public remove (key: string, cb?: () => void): void {
public remove (key: string, fn?: () => void): void {
store.remove(key);
cb && cb();
fn && fn();
}
public set (key: string, value: KeyringJson, cb?: () => void): void {
public set (key: string, value: KeyringJson, fn?: () => void): void {
store.set(key, value);
cb && cb();
fn && fn();
}
}
+8 -8
View File
@@ -21,33 +21,33 @@ export class FileStore implements KeyringStore {
this.#path = path;
}
public all (cb: (key: string, value: KeyringJson) => void): void {
public all (fn: (key: string, value: KeyringJson) => void): void {
fs
.readdirSync(this.#path)
.filter((key): boolean => !['.', '..', '.DS_Store'].includes(key))
.forEach((key): void => {
const value = this._readKey(key);
value?.address && cb(key, value);
value?.address && fn(key, value);
});
}
public get (key: string, cb: (value: KeyringJson) => void): void {
public get (key: string, fn: (value: KeyringJson) => void): void {
const value = this._readKey(key);
assert(value?.address, `Invalid JSON found for ${key}`);
cb(value);
fn(value);
}
public remove (key: string, cb?: () => void): void {
public remove (key: string, fn?: () => void): void {
fs.unlinkSync(this._getPath(key));
cb && cb();
fn && fn();
}
public set (key: string, value: KeyringJson, cb?: () => void): void {
public set (key: string, value: KeyringJson, fn?: () => void): void {
fs.writeFileSync(this._getPath(key), Buffer.from(JSON.stringify(value), 'utf-8'));
cb && cb();
fn && fn();
}
private _getPath (key: string): string {