Skip to content

Commit cff2a72

Browse files
authored
feat: --asset-bundles forwards local-ab=true into the Explorer deep link (#1539)
1 parent fc8cfc6 commit cff2a72

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

packages/@dcl/sdk-commands/src/commands/start/explorer-alpha.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ async function runApp(
7272
const landscapeTerrainEnabled = !!args['--landscape-terrain-enabled']
7373
const openDeeplinkInNewInstance = !!args['-n']
7474
const multiInstance = !!args['--multi-instance']
75+
const assetBundles = !!args['--asset-bundles']
7576
const mcp = !!args['--mcp']
7677
const mcpPort = args['--mcp-port']
7778

@@ -105,6 +106,11 @@ async function runApp(
105106
if (multiInstance) {
106107
params.set('multi-instance', 'true')
107108
}
109+
if (assetBundles) {
110+
// The explorer owns asset-bundle conversion: local-ab makes it spawn its own
111+
// JIT converter against this preview's content server. No sidecar runs here.
112+
params.set('local-ab', 'true')
113+
}
108114
if (mcp) {
109115
params.set('mcp', 'true')
110116
}

packages/@dcl/sdk-commands/src/commands/start/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export const args = declareArgs({
6868
'--bevy-web': Boolean,
6969
'--web': '--bevy-web',
7070
'--multi-instance': Boolean,
71+
'--asset-bundles': Boolean,
7172
'--no-client': Boolean,
7273
'--mcp': Boolean,
7374
'--mcp-port': Number
@@ -98,6 +99,7 @@ export async function help(options: Options) {
9899
--web, --bevy-web Opens preview using the Bevy Web browser window.
99100
--mobile Show QR code for mobile preview on the same network.
100101
--multi-instance Allow running multiple Explorer instances simultaneously.
102+
--asset-bundles Preview with optimized asset bundles (forwarded as local-ab=true in the deep link; the Desktop Explorer converts the scene's assets itself).
101103
--no-client Suppress every auto-launch (desktop Explorer deeplink, browser open, mobile QR). The file watcher still notifies a desktop Explorer if it connects on its own — useful when an external tool owns the Explorer process.
102104
--mcp Enable the MCP server in the Explorer (forwarded as a deep link parameter).
103105
--mcp-port Port for the MCP server in the Explorer (forwarded as a deep link parameter).

test/sdk-commands/commands/start/explorer-alpha.spec.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,48 @@ describe('explorer-alpha', () => {
185185
})
186186
})
187187

188+
describe('assetBundles parameter', () => {
189+
it('should include local-ab parameter when --asset-bundles flag is provided', async () => {
190+
const args: any = {
191+
'--asset-bundles': true
192+
}
193+
194+
await runExplorerAlpha(mockComponents, {
195+
cwd: '/test',
196+
realm: 'test-realm',
197+
baseCoords: { x: 0, y: 0 },
198+
isHub: false,
199+
args
200+
})
201+
202+
expect(mockExec).toHaveBeenCalledWith(
203+
'/test',
204+
'open',
205+
expect.arrayContaining([expect.stringContaining('local-ab=true')]),
206+
{ silent: true }
207+
)
208+
})
209+
210+
it('should not include local-ab parameter when --asset-bundles flag is not provided', async () => {
211+
const args: any = {}
212+
213+
await runExplorerAlpha(mockComponents, {
214+
cwd: '/test',
215+
realm: 'test-realm',
216+
baseCoords: { x: 0, y: 0 },
217+
isHub: false,
218+
args
219+
})
220+
221+
expect(mockExec).toHaveBeenCalledWith(
222+
'/test',
223+
'open',
224+
expect.arrayContaining([expect.not.stringContaining('local-ab')]),
225+
{ silent: true }
226+
)
227+
})
228+
})
229+
188230
describe('mcp parameter', () => {
189231
it('should include mcp parameter when --mcp flag is provided', async () => {
190232
const args: any = {

0 commit comments

Comments
 (0)