@dcl/inspector 7.7.1 → 7.7.2-12876822878.commit-75bba39
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 +197 -10
- package/package.json +3 -3
package/README.md
CHANGED
@@ -1,19 +1,206 @@
|
|
1
|
+
# @dcl/inspector
|
1
2
|
|
2
|
-
|
3
|
+
A React-based scene editor interface for Decentraland, providing a modular architecture for scene editing and manipulation.
|
3
4
|
|
4
|
-
##
|
5
|
+
## Features
|
5
6
|
|
6
|
-
|
7
|
+
- **Entity Hierarchy**: Tree-based scene management with component operations
|
8
|
+
- **Component Inspector**: Specialized editors for all component types
|
9
|
+
- **Level Editor**: 3D scene visualization with Babylon.js
|
10
|
+
- **Asset Management**: Local assets, custom items, and asset packs support
|
7
11
|
|
8
|
-
|
12
|
+
## Installation
|
9
13
|
|
10
|
-
|
14
|
+
```bash
|
15
|
+
npm install @dcl/inspector
|
16
|
+
```
|
11
17
|
|
12
|
-
|
18
|
+
## Quick Start
|
13
19
|
|
14
|
-
|
15
|
-
* Run `npx sdk-commands start --data-layer --port 8001` in a scene & go to localhost:8000/?ws=ws://127.0.0.1:8001/data-layer
|
20
|
+
1. Start the CLI server:
|
16
21
|
|
17
|
-
|
22
|
+
```bash
|
23
|
+
npx @dcl/sdk-commands start --data-layer --port 8001
|
24
|
+
```
|
18
25
|
|
19
|
-
|
26
|
+
2. Serve the inspector (choose one method):
|
27
|
+
|
28
|
+
```bash
|
29
|
+
# Method 1: Development server
|
30
|
+
git clone https://github.com/decentraland/js-sdk-toolchain.git
|
31
|
+
cd packages/@dcl/inspector
|
32
|
+
npm start
|
33
|
+
|
34
|
+
# Method 2: From node_modules
|
35
|
+
npm install @dcl/inspector
|
36
|
+
npx http-server node_modules/@dcl/inspector/public
|
37
|
+
```
|
38
|
+
|
39
|
+
3. Access the Inspector:
|
40
|
+
|
41
|
+
```
|
42
|
+
http://localhost:3000/?dataLayerRpcWsUrl=ws://127.0.0.1:8001/data-layer
|
43
|
+
```
|
44
|
+
|
45
|
+
Where `http://localhost:3000` is the URL of the Inspector and `ws://127.0.0.1:8001/data-layer` is the WebSocket URL of the CLI server.
|
46
|
+
|
47
|
+
## Integration
|
48
|
+
|
49
|
+
The Inspector supports two integration approaches:
|
50
|
+
|
51
|
+
### WebSocket Integration
|
52
|
+
|
53
|
+
For development environments using the CLI:
|
54
|
+
|
55
|
+
```typescript
|
56
|
+
// Connect to CLI's WebSocket server
|
57
|
+
const inspectorUrl = `http://localhost:3000/?dataLayerRpcWsUrl=ws://127.0.0.1:8001/data-layer`
|
58
|
+
```
|
59
|
+
|
60
|
+
### IFrame Integration
|
61
|
+
|
62
|
+
For web applications embedding the Inspector:
|
63
|
+
|
64
|
+
```typescript
|
65
|
+
function initRpc(iframe: HTMLIFrameElement) {
|
66
|
+
const transport = new MessageTransport(window, iframe.contentWindow!)
|
67
|
+
const storage = new StorageRPC(transport)
|
68
|
+
|
69
|
+
// Handle file operations
|
70
|
+
storage.handle('read_file', async ({ path }) => {
|
71
|
+
return fs.readFile(path)
|
72
|
+
})
|
73
|
+
|
74
|
+
storage.handle('write_file', async ({ path, content }) => {
|
75
|
+
await fs.writeFile(path, content)
|
76
|
+
})
|
77
|
+
|
78
|
+
// ... other handlers
|
79
|
+
|
80
|
+
return {
|
81
|
+
storage,
|
82
|
+
dispose: () => storage.dispose()
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
function InspectorComponent() {
|
87
|
+
const iframeRef = useRef()
|
88
|
+
|
89
|
+
const handleIframeRef = useCallback((iframe) => {
|
90
|
+
if (iframe) {
|
91
|
+
iframeRef.current = initRpc(iframe)
|
92
|
+
}
|
93
|
+
}, [])
|
94
|
+
|
95
|
+
useEffect(() => {
|
96
|
+
return () => iframeRef.current?.dispose()
|
97
|
+
}, [])
|
98
|
+
|
99
|
+
const params = new URLSearchParams({
|
100
|
+
dataLayerRpcParentUrl: window.location.origin
|
101
|
+
})
|
102
|
+
const inspectorUrl = `http://localhost:3000/`
|
103
|
+
const url = `${inspectorUrl}?${params}`
|
104
|
+
|
105
|
+
return <iframe onLoad={handleIframeRef} src={url} />
|
106
|
+
}
|
107
|
+
```
|
108
|
+
|
109
|
+
## Configuration
|
110
|
+
|
111
|
+
Configure the Inspector through URL parameters or a global object. All configuration options can be set using either method:
|
112
|
+
|
113
|
+
```typescript
|
114
|
+
type InspectorConfig = {
|
115
|
+
// Data Layer Configuration
|
116
|
+
dataLayerRpcWsUrl: string | null // ?dataLayerRpcWsUrl=ws://...
|
117
|
+
dataLayerRpcParentUrl: string | null // ?dataLayerRpcParentUrl=https://...
|
118
|
+
|
119
|
+
// Smart Items Configuration
|
120
|
+
binIndexJsUrl: string | null // ?binIndexJsUrl=https://...
|
121
|
+
disableSmartItems: boolean // ?disableSmartItems=true
|
122
|
+
|
123
|
+
// Content Configuration
|
124
|
+
contentUrl: string // ?contentUrl=https://...
|
125
|
+
|
126
|
+
// Analytics Configuration
|
127
|
+
segmentKey: string | null // ?segmentKey=...
|
128
|
+
segmentAppId: string | null // ?segmentAppId=...
|
129
|
+
segmentUserId: string | null // ?segmentUserId=...
|
130
|
+
projectId: string | null // ?projectId=...
|
131
|
+
}
|
132
|
+
|
133
|
+
// Method 1: Global configuration
|
134
|
+
globalThis.InspectorConfig = {
|
135
|
+
dataLayerRpcWsUrl: 'ws://127.0.0.1:8001/data-layer',
|
136
|
+
contentUrl: 'https://builder-items.decentraland.org'
|
137
|
+
}
|
138
|
+
|
139
|
+
// Method 2: URL parameters
|
140
|
+
// http://localhost:3000/?dataLayerRpcWsUrl=ws://127.0.0.1:8001/data-layer&contentUrl=https://builder-items.decentraland.org&disableSmartItems=true
|
141
|
+
```
|
142
|
+
|
143
|
+
Configuration options are resolved in the following order:
|
144
|
+
|
145
|
+
1. URL parameters (highest priority)
|
146
|
+
2. Global object
|
147
|
+
3. Default values (lowest priority)
|
148
|
+
|
149
|
+
## Testing
|
150
|
+
|
151
|
+
Run all inspector tests:
|
152
|
+
|
153
|
+
```bash
|
154
|
+
make test-inspector
|
155
|
+
```
|
156
|
+
|
157
|
+
Run specific test files in watch mode:
|
158
|
+
|
159
|
+
```bash
|
160
|
+
make test-inspector FILES="--watch packages/@dcl/inspector/src/path/to/some-test.spec.ts"
|
161
|
+
```
|
162
|
+
|
163
|
+
## Troubleshooting
|
164
|
+
|
165
|
+
### Common Issues
|
166
|
+
|
167
|
+
1. **WebSocket Connection**
|
168
|
+
|
169
|
+
- Verify CLI server is running with `--data-layer` flag
|
170
|
+
- Check WebSocket URL matches CLI server port
|
171
|
+
- Ensure no firewall blocking connection
|
172
|
+
|
173
|
+
2. **File System Access**
|
174
|
+
|
175
|
+
- Check file permissions
|
176
|
+
- Verify CLI has necessary access rights
|
177
|
+
- Ensure paths are correctly formatted
|
178
|
+
|
179
|
+
3. **Asset Loading**
|
180
|
+
- Verify `contentUrl` is correctly configured
|
181
|
+
- Check network access to content server
|
182
|
+
- Ensure asset paths are valid
|
183
|
+
|
184
|
+
## Development Tips
|
185
|
+
|
186
|
+
1. **Debugging**
|
187
|
+
|
188
|
+
- Use Chrome DevTools for WebSocket inspection
|
189
|
+
- Enable React DevTools
|
190
|
+
- Monitor browser console for RPC messages
|
191
|
+
|
192
|
+
2. **Testing**
|
193
|
+
- Use in-memory implementation for unit tests
|
194
|
+
- Mock RPC calls for integration testing
|
195
|
+
- Test both WebSocket and IFrame transport
|
196
|
+
|
197
|
+
## Related Architecture Decisions
|
198
|
+
|
199
|
+
For a deeper understanding of the architecture and design decisions:
|
200
|
+
|
201
|
+
- [ADR-281: Items in Decentraland tooling](https://adr.decentraland.org/adr/ADR-281) - Explains the Items abstraction and how it's used in the Inspector
|
202
|
+
- [ADR-282: Decentraland Inspector](https://adr.decentraland.org/adr/ADR-282) - Details the Inspector's architecture, integration approaches, and technical decisions
|
203
|
+
|
204
|
+
## License
|
205
|
+
|
206
|
+
Apache 2.0
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dcl/inspector",
|
3
|
-
"version": "7.7.
|
3
|
+
"version": "7.7.2-12876822878.commit-75bba39",
|
4
4
|
"dependencies": {
|
5
5
|
"@dcl/asset-packs": "^2.1.2",
|
6
6
|
"ts-deepmerge": "^7.0.0"
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"@babylonjs/inspector": "~6.18.0",
|
12
12
|
"@babylonjs/loaders": "~6.18.0",
|
13
13
|
"@babylonjs/materials": "~6.18.0",
|
14
|
-
"@dcl/ecs": "7.7.
|
14
|
+
"@dcl/ecs": "7.7.2-12876822878.commit-75bba39",
|
15
15
|
"@dcl/ecs-math": "2.1.0",
|
16
16
|
"@dcl/mini-rpc": "^1.0.7",
|
17
17
|
"@dcl/rpc": "^1.1.1",
|
@@ -71,5 +71,5 @@
|
|
71
71
|
},
|
72
72
|
"types": "dist/tooling-entrypoint.d.ts",
|
73
73
|
"typings": "dist/tooling-entrypoint.d.ts",
|
74
|
-
"commit": "
|
74
|
+
"commit": "75bba3930f810894d7113263b2979a35c209e380"
|
75
75
|
}
|