@arcblock/ux 2.12.63 → 2.12.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import debug from 'debug';
2
+ export declare const createDebug: debug.Debug & {
3
+ debug: debug.Debug;
4
+ default: debug.Debug;
5
+ };
6
+ export declare const createLogger: (namespace: string) => Console;
@@ -0,0 +1,25 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ import debug from 'debug';
3
+ export const createDebug = debug;
4
+ export const createLogger = namespace => {
5
+ return new Proxy(window.console, {
6
+ get(target, prop) {
7
+ return (...args) => {
8
+ try {
9
+ if (['log', 'debug', 'info', 'warn', 'error'].includes(prop)) {
10
+ // @ts-ignore
11
+ return target[prop](namespace, ...args);
12
+ }
13
+ if (target[prop] instanceof Function) {
14
+ // @ts-ignore
15
+ return target[prop](...args);
16
+ }
17
+ return target[prop];
18
+ } catch (err) {
19
+ console.error(`Logger error in ${namespace}:`, err);
20
+ return undefined;
21
+ }
22
+ };
23
+ }
24
+ });
25
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "2.12.63",
3
+ "version": "2.12.64",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -70,12 +70,12 @@
70
70
  "react": ">=18.2.0",
71
71
  "react-router-dom": ">=6.22.3"
72
72
  },
73
- "gitHead": "47f8ac34d544cb600e084266ceb722989476f287",
73
+ "gitHead": "535a7ce33f7325f00aab13b8812123cafc5788c7",
74
74
  "dependencies": {
75
75
  "@arcblock/did-motif": "^1.1.13",
76
- "@arcblock/icons": "^2.12.63",
77
- "@arcblock/nft-display": "^2.12.63",
78
- "@arcblock/react-hooks": "^2.12.63",
76
+ "@arcblock/icons": "^2.12.64",
77
+ "@arcblock/nft-display": "^2.12.64",
78
+ "@arcblock/react-hooks": "^2.12.64",
79
79
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
80
80
  "@fontsource/roboto": "^5.2.5",
81
81
  "@fontsource/ubuntu-mono": "^5.0.18",
@@ -96,6 +96,7 @@
96
96
  "core-js": "^3.25.5",
97
97
  "d3-geo": "^1.12.1",
98
98
  "dayjs": "^1.11.5",
99
+ "debug": "^4.4.0",
99
100
  "devices.css": "^0.1.15",
100
101
  "dompurify": "^3.2.1",
101
102
  "highlight.js": "^11.6.0",
@@ -0,0 +1,27 @@
1
+ /* eslint-disable import/prefer-default-export */
2
+ import debug from 'debug';
3
+
4
+ export const createDebug = debug;
5
+
6
+ export const createLogger = (namespace: string) => {
7
+ return new Proxy(window.console, {
8
+ get(target, prop: keyof Console) {
9
+ return (...args: any[]) => {
10
+ try {
11
+ if (['log', 'debug', 'info', 'warn', 'error'].includes(prop)) {
12
+ // @ts-ignore
13
+ return target[prop](namespace, ...args);
14
+ }
15
+ if (target[prop] instanceof Function) {
16
+ // @ts-ignore
17
+ return target[prop](...args);
18
+ }
19
+ return target[prop];
20
+ } catch (err) {
21
+ console.error(`Logger error in ${namespace}:`, err);
22
+ return undefined;
23
+ }
24
+ };
25
+ },
26
+ });
27
+ };