rn-backstage 1.2.1 → 1.4.0
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.
- package/README.md +109 -2
- package/lib/commonjs/Backstage.js +19 -2
- package/lib/commonjs/Backstage.js.map +1 -1
- package/lib/commonjs/bug-report.js +173 -0
- package/lib/commonjs/bug-report.js.map +1 -0
- package/lib/commonjs/components/BackstagePanel.js +100 -17
- package/lib/commonjs/components/BackstagePanel.js.map +1 -1
- package/lib/commonjs/components/BugReportComposer.js +510 -0
- package/lib/commonjs/components/BugReportComposer.js.map +1 -0
- package/lib/commonjs/components/FlagsTab.js +21 -11
- package/lib/commonjs/components/FlagsTab.js.map +1 -1
- package/lib/commonjs/components/FloatingPill.js +82 -22
- package/lib/commonjs/components/FloatingPill.js.map +1 -1
- package/lib/commonjs/components/InfoTab.js +5 -1
- package/lib/commonjs/components/InfoTab.js.map +1 -1
- package/lib/commonjs/components/LogItem.js +6 -0
- package/lib/commonjs/components/LogItem.js.map +1 -1
- package/lib/commonjs/components/LogsTab.js +3 -3
- package/lib/commonjs/components/LogsTab.js.map +1 -1
- package/lib/commonjs/components/NetworkTab.js +3 -2
- package/lib/commonjs/components/NetworkTab.js.map +1 -1
- package/lib/commonjs/components/StorageTab.js +672 -0
- package/lib/commonjs/components/StorageTab.js.map +1 -0
- package/lib/commonjs/constants.js +88 -6
- package/lib/commonjs/constants.js.map +1 -1
- package/lib/commonjs/index.js +84 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.js +2 -0
- package/lib/commonjs/types.js.map +1 -1
- package/lib/module/Backstage.js +19 -2
- package/lib/module/Backstage.js.map +1 -1
- package/lib/module/bug-report.js +164 -0
- package/lib/module/bug-report.js.map +1 -0
- package/lib/module/components/BackstagePanel.js +101 -18
- package/lib/module/components/BackstagePanel.js.map +1 -1
- package/lib/module/components/BugReportComposer.js +505 -0
- package/lib/module/components/BugReportComposer.js.map +1 -0
- package/lib/module/components/FlagsTab.js +23 -13
- package/lib/module/components/FlagsTab.js.map +1 -1
- package/lib/module/components/FloatingPill.js +86 -26
- package/lib/module/components/FloatingPill.js.map +1 -1
- package/lib/module/components/InfoTab.js +6 -2
- package/lib/module/components/InfoTab.js.map +1 -1
- package/lib/module/components/LogItem.js +7 -1
- package/lib/module/components/LogItem.js.map +1 -1
- package/lib/module/components/LogsTab.js +3 -3
- package/lib/module/components/LogsTab.js.map +1 -1
- package/lib/module/components/NetworkTab.js +3 -2
- package/lib/module/components/NetworkTab.js.map +1 -1
- package/lib/module/components/StorageTab.js +667 -0
- package/lib/module/components/StorageTab.js.map +1 -0
- package/lib/module/constants.js +88 -6
- package/lib/module/constants.js.map +1 -1
- package/lib/module/index.js +14 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +4 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/Backstage.d.ts.map +1 -1
- package/lib/typescript/bug-report.d.ts +12 -0
- package/lib/typescript/bug-report.d.ts.map +1 -0
- package/lib/typescript/components/BackstagePanel.d.ts +4 -1
- package/lib/typescript/components/BackstagePanel.d.ts.map +1 -1
- package/lib/typescript/components/BugReportComposer.d.ts +17 -0
- package/lib/typescript/components/BugReportComposer.d.ts.map +1 -0
- package/lib/typescript/components/FlagsTab.d.ts.map +1 -1
- package/lib/typescript/components/FloatingPill.d.ts +2 -0
- package/lib/typescript/components/FloatingPill.d.ts.map +1 -1
- package/lib/typescript/components/InfoTab.d.ts.map +1 -1
- package/lib/typescript/components/LogItem.d.ts.map +1 -1
- package/lib/typescript/components/LogsTab.d.ts.map +1 -1
- package/lib/typescript/components/NetworkTab.d.ts.map +1 -1
- package/lib/typescript/components/StorageTab.d.ts +9 -0
- package/lib/typescript/components/StorageTab.d.ts.map +1 -0
- package/lib/typescript/constants.d.ts +74 -4
- package/lib/typescript/constants.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +13 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +55 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +7 -6
- package/src/Backstage.tsx +0 -209
- package/src/ThemeContext.tsx +0 -38
- package/src/components/BackstagePanel.tsx +0 -258
- package/src/components/FlagsTab.tsx +0 -198
- package/src/components/FloatingPill.tsx +0 -153
- package/src/components/InfoTab.tsx +0 -230
- package/src/components/JsonTreeView.tsx +0 -239
- package/src/components/LogItem.tsx +0 -144
- package/src/components/LogsTab.tsx +0 -217
- package/src/components/NetworkItem.tsx +0 -425
- package/src/components/NetworkTab.tsx +0 -240
- package/src/components/TabBar.tsx +0 -154
- package/src/constants.ts +0 -114
- package/src/index.ts +0 -18
- package/src/log-interceptor.ts +0 -148
- package/src/network-interceptor.ts +0 -468
- package/src/types.ts +0 -213
- package/src/utils/formatTimestamp.ts +0 -22
- package/src/utils/stringify.ts +0 -90
package/src/utils/stringify.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Safely stringifies a value, handling circular references and Error objects.
|
|
3
|
-
*/
|
|
4
|
-
export function safeStringify(value: unknown, indent = 2): string {
|
|
5
|
-
if (value === undefined) return 'undefined'
|
|
6
|
-
if (value === null) return 'null'
|
|
7
|
-
|
|
8
|
-
if (value instanceof Error) {
|
|
9
|
-
return JSON.stringify(
|
|
10
|
-
{
|
|
11
|
-
name: value.name,
|
|
12
|
-
message: value.message,
|
|
13
|
-
stack: value.stack,
|
|
14
|
-
},
|
|
15
|
-
null,
|
|
16
|
-
indent,
|
|
17
|
-
)
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const seen = new WeakSet()
|
|
21
|
-
|
|
22
|
-
try {
|
|
23
|
-
return JSON.stringify(
|
|
24
|
-
value,
|
|
25
|
-
(_key, val) => {
|
|
26
|
-
if (typeof val === 'object' && val !== null) {
|
|
27
|
-
if (seen.has(val)) {
|
|
28
|
-
return '[Circular]'
|
|
29
|
-
}
|
|
30
|
-
seen.add(val)
|
|
31
|
-
}
|
|
32
|
-
if (typeof val === 'bigint') {
|
|
33
|
-
return val.toString()
|
|
34
|
-
}
|
|
35
|
-
if (typeof val === 'function') {
|
|
36
|
-
return `[Function: ${val.name || 'anonymous'}]`
|
|
37
|
-
}
|
|
38
|
-
if (typeof val === 'symbol') {
|
|
39
|
-
return val.toString()
|
|
40
|
-
}
|
|
41
|
-
return val
|
|
42
|
-
},
|
|
43
|
-
indent,
|
|
44
|
-
)
|
|
45
|
-
} catch {
|
|
46
|
-
return String(value)
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Formats a console message and its optional params into a single string.
|
|
52
|
-
*/
|
|
53
|
-
export function formatLogMessage(message: unknown, optionalParams?: unknown[]): string {
|
|
54
|
-
const parts: string[] = []
|
|
55
|
-
|
|
56
|
-
if (message instanceof Error) {
|
|
57
|
-
parts.push(`${message.name}: ${message.message}`)
|
|
58
|
-
} else if (typeof message === 'object' && message !== null) {
|
|
59
|
-
parts.push(safeStringify(message, 0))
|
|
60
|
-
} else if (typeof message === 'string') {
|
|
61
|
-
// Strip console color formatting (%c)
|
|
62
|
-
parts.push(message.replace(/%c/g, '').trim())
|
|
63
|
-
} else {
|
|
64
|
-
parts.push(String(message))
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if (optionalParams && optionalParams.length > 0) {
|
|
68
|
-
for (const param of optionalParams) {
|
|
69
|
-
if (typeof param === 'string' && isColorString(param)) {
|
|
70
|
-
continue // skip css color strings from console.log('%c ...', 'color: ...')
|
|
71
|
-
}
|
|
72
|
-
if (typeof param === 'object' && param !== null) {
|
|
73
|
-
parts.push(safeStringify(param, 0))
|
|
74
|
-
} else {
|
|
75
|
-
parts.push(String(param))
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return parts.join(' ')
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function isColorString(str: string): boolean {
|
|
84
|
-
return (
|
|
85
|
-
str.includes('color:') ||
|
|
86
|
-
str.includes('background:') ||
|
|
87
|
-
str.includes('font-') ||
|
|
88
|
-
/^#[0-9A-Fa-f]{3,8}$/.test(str.trim())
|
|
89
|
-
)
|
|
90
|
-
}
|