@dcl/inspector

中文文档
7.61.2发布于 2026/11/10TypeScriptCommonJS构建来源已验证近 30 天下载 1.7万

npm version License: Apache-2.0 [![CI Status](

原始使用文档
文档目录18 节
  1. Table of Contents
  2. Features
  3. Quick Start
  4. Prerequisites
  5. Getting Started
  6. Local Development with Asset Packs
  7. Testing New Assets Locally
  8. Integration
  9. WebSocket Integration
  10. IFrame Integration
  11. Configuration
  12. Testing
  13. Troubleshooting
  14. Common Issues
  15. Development Tips
  16. Dependencies
  17. Related Architecture Decisions
  18. License

@dcl/inspector

npm version License: Apache-2.0 CI Status

A React-based scene editor interface for Decentraland, providing a modular architecture for scene editing and manipulation.

Table of Contents

Features

  • Entity Hierarchy: Tree-based scene management with component operations
  • Component Inspector: Specialized editors for all component types
  • Level Editor: 3D scene visualization with Babylon.js
  • Asset Management: Local assets, custom items, and asset packs support (via @dcl/asset-packs)

Quick Start

Prerequisites

  • Node.js 22.x or higher
  • A Decentraland SDK7 scene (or create one with npx @dcl/sdk-commands init)
  • Basic understanding of WebSockets or IFrame communication

Getting Started

  1. Start the CLI server:
npx @dcl/sdk-commands start --data-layer --port 8001
  1. Serve the inspector (choose one method):
# Method 1: Development server (from monorepo)
git clone https://github.com/decentraland/creator-hub.git
cd creator-hub
make init
cd packages/inspector
npm start

# Method 2: From node_modules
npm install @dcl/inspector
npx http-server node_modules/@dcl/inspector/public
  1. Access the Inspector:
http://localhost:8000/?dataLayerRpcWsUrl=ws://127.0.0.1:8001/data-layer

Where http://localhost:8000 is the URL of the Inspector and ws://127.0.0.1:8001/data-layer is the WebSocket URL of the CLI server.

Local Development with Asset Packs

To develop the Inspector with local asset-packs integration:

  1. Start the asset-packs dev environment:

    cd packages/asset-packs
    npm run start  # Starts SDK7 server on port 8001
    
  2. In another terminal, start the docker content server:

    cd packages/asset-packs
    docker-compose up  # Starts content server on port 9000
    
  3. In another terminal, upload assets to local content server:

    cd packages/asset-packs
    npm run upload  # Uploads to http://localhost:9000
    
  4. Start the Inspector dev server:

    cd packages/inspector
    npm start  # Starts on port 8000
    
  5. Configure the Inspector to use local asset-packs:

    Access the Inspector with these parameters:

    http://localhost:8000/?contentUrl=http://localhost:9000/asset-packs&binIndexJsUrl=http://localhost:8001/bin/index.js
    
    • contentUrl: Points to local content server for asset loading
    • binIndexJsUrl: Points to local SDK7 dev server for Smart Items runtime

See the main README for complete local development setup instructions.

Testing New Assets Locally

The inspector fetches the asset catalog at runtime from S3. If latest/catalog.json is unreachable (e.g. on a pre-merge PR branch, in CI, or offline), it automatically falls back to the catalog.json bundled in the @dcl/asset-packs npm package — so the inspector always loads.

When you add a new asset locally it won't appear in the Asset Packs tab automatically because neither the CDN nor the bundled catalog knows about it yet. Two options are available:

Follow the asset-packs Local Development setup (docker-compose + npm run upload). The upload script also publishes catalog.json as asset-packs/latest/catalog.json to MinIO, mirroring CI. Then open the inspector with:

http://localhost:8000/?contentUrl=http://localhost:9000/asset-packs

Both the catalog and all asset files are served locally — no remote CDN needed.

Option 2 — Upload to dev CDN via PR

Push your branch and comment /upload-assets on the pull request (org members only). The CI uploads all asset files to the development CDN (https://builder-items.decentraland.zone) and posts a confirmation comment.

To test against the dev CDN:

http://localhost:8000/?contentUrl=https://builder-items.decentraland.zone

This gives a complete end-to-end test with real asset files. Note that latest/catalog.json on the dev CDN is only updated on merge to main, so use the Docker option to see catalog changes before merging.

Integration

The Inspector supports two integration approaches:

WebSocket Integration

For development environments using the CLI:

// Connect to CLI's WebSocket server
const inspectorUrl = `http://localhost:3000/?dataLayerRpcWsUrl=ws://127.0.0.1:8001/data-layer`

IFrame Integration

For web applications embedding the Inspector:

function initRpc(iframe: HTMLIFrameElement) {
  const transport = new MessageTransport(window, iframe.contentWindow!)
  const storage = new StorageRPC(transport)

  // Handle file operations
  storage.handle('read_file', async ({ path }) => {
    return fs.readFile(path)
  })

  storage.handle('write_file', async ({ path, content }) => {
    await fs.writeFile(path, content)
  })

  // ... other handlers

  return {
    storage,
    dispose: () => storage.dispose()
  }
}

function InspectorComponent() {
  const iframeRef = useRef()

  const handleIframeRef = useCallback((iframe) => {
    if (iframe) {
      iframeRef.current = initRpc(iframe)
    }
  }, [])

  useEffect(() => {
    return () => iframeRef.current?.dispose()
  }, [])

  const params = new URLSearchParams({
    dataLayerRpcParentUrl: window.location.origin
  })
  const inspectorUrl = `http://localhost:3000/`
  const url = `${inspectorUrl}?${params}`

  return <iframe onLoad={handleIframeRef} src={url} />
}

Configuration

Configure the Inspector through URL parameters or a global object. All configuration options can be set using either method:

type InspectorConfig = {
  // Data Layer Configuration
  dataLayerRpcWsUrl: string | null // ?dataLayerRpcWsUrl=ws://...
  dataLayerRpcParentUrl: string | null // ?dataLayerRpcParentUrl=https://...

  // Smart Items Configuration
  binIndexJsUrl: string | null // ?binIndexJsUrl=https://...
  disableSmartItems: boolean // ?disableSmartItems=true

  // Content Configuration
  contentUrl: string // ?contentUrl=https://...

  // Analytics Configuration
  segmentKey: string | null // ?segmentKey=...
  segmentAppId: string | null // ?segmentAppId=...
  segmentUserId: string | null // ?segmentUserId=...
  projectId: string | null // ?projectId=...
}

// Method 1: Global configuration
globalThis.InspectorConfig = {
  dataLayerRpcWsUrl: 'ws://127.0.0.1:8001/data-layer',
  contentUrl: 'https://builder-items.decentraland.org'
}

// Method 2: URL parameters
// http://localhost:3000/?dataLayerRpcWsUrl=ws://127.0.0.1:8001/data-layer&contentUrl=https://builder-items.decentraland.org&disableSmartItems=true

Configuration options are resolved in the following order:

  1. URL parameters (highest priority)
  2. Global object
  3. Default values (lowest priority)

Testing

Run all inspector tests:

make test-inspector

Run specific test files in watch mode:

make test-inspector FILES="--watch packages/@dcl/inspector/src/path/to/some-test.spec.ts"

Troubleshooting

Common Issues

  1. WebSocket Connection

    • Verify CLI server is running with --data-layer flag
    • Check WebSocket URL matches CLI server port
    • Ensure no firewall blocking connection
  2. File System Access

    • Check file permissions
    • Verify CLI has necessary access rights
    • Ensure paths are correctly formatted
  3. Asset Loading

    • Verify contentUrl is correctly configured
    • Check network access to content server
    • Ensure asset paths are valid

Development Tips

  1. Debugging

    • Use Chrome DevTools for WebSocket inspection
    • Enable React DevTools
    • Monitor browser console for RPC messages
  2. Testing

    • Use in-memory implementation for unit tests
    • Mock RPC calls for integration testing
    • Test both WebSocket and IFrame transport

Dependencies

The Inspector is part of the Creator Hub monorepo and depends on:

  • @dcl/asset-packs - Asset packs and Smart Items runtime (located at packages/asset-packs)

For local development with asset-packs integration, see the main README for setup instructions.

For a deeper understanding of the architecture and design decisions:

License

Apache 2.0

版本与发布记录

@dcl/inspector 共发布 1,033 个版本,首次发布于 2023/02/01;过去 12 个月发布了 168 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
7.61.2latest2026/11/102 天前
7.61.12026/11/102 天前
7.61.02026/11/074 天前
7.60.22026/11/065 天前
7.60.12026/11/065 天前
7.60.02026/11/066 天前

其他发布通道:ci → 7.8.16,experimental → 7.9.7-17068748871.commit-5d621a3,next → 7.9.7-17128822054.commit-3e15997,protocol-squad → 7.15.2-19251638766.commit-26dce86。

关于 @dcl/inspector 的常见问题

@dcl/inspector 是什么?

[![CI Status](

如何安装 @dcl/inspector?

在项目目录运行 npm install @dcl/inspector,或使用 pnpm add / yarn add / bun add。

@dcl/inspector 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@dcl/inspector 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@dcl/inspector 可以商用吗?

@dcl/inspector 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@dcl/inspector 的下载量有多少?

根据 npm 官方下载统计,@dcl/inspector 在 2026/10/12 – 2026/11/10 这 30 天内被下载 17,331 次,日均约 578 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@dcl/inspector 还在维护吗?

最新版本 7.61.2 发布于 2026/11/10(2 天前);至今共发布 1033 个版本,其中过去 12 个月发布了 168 个;首次发布于 2023/02/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。