@pixelbyte-software/pixcode 1.41.4 → 1.41.5
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/dist/assets/{index-CIEN0bZ-.js → index-BmK4VcVP.js} +52 -52
- package/dist/assets/index-CHa1760s.css +32 -0
- package/dist/index.html +2 -2
- package/dist-server/server/routes/live-view.js +44 -8
- package/dist-server/server/routes/live-view.js.map +1 -1
- package/dist-server/server/services/live-view.js +86 -6
- package/dist-server/server/services/live-view.js.map +1 -1
- package/package.json +2 -1
- package/scripts/smoke/live-view-environment.mjs +92 -0
- package/server/routes/live-view.js +45 -8
- package/server/services/live-view.js +90 -6
- package/dist/assets/index-BC8CXTJj.css +0 -32
|
@@ -294,6 +294,91 @@ function buildManagedPhpCommand(runtimeStatus) {
|
|
|
294
294
|
};
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
function publicCommand(command) {
|
|
298
|
+
if (!command) return null;
|
|
299
|
+
return {
|
|
300
|
+
id: command.id,
|
|
301
|
+
label: command.label,
|
|
302
|
+
displayCommand: command.displayCommand,
|
|
303
|
+
custom: command.custom === true || command.id === 'custom',
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
function liveViewEnvironmentMode(target, session) {
|
|
308
|
+
const kind = session?.kind || target?.kind || 'none';
|
|
309
|
+
if (kind === 'static') return 'static';
|
|
310
|
+
if (kind === 'process') return 'local-process';
|
|
311
|
+
return 'unavailable';
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function liveViewEnvironmentStatus(target, session) {
|
|
315
|
+
if (session?.status) return session.status;
|
|
316
|
+
if (target?.available) return 'ready';
|
|
317
|
+
return 'unavailable';
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
function liveViewEnvironmentCommand(target, session) {
|
|
321
|
+
return publicCommand(session?.command) || publicCommand(target?.command);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function liveViewEnvironmentLogs(session) {
|
|
325
|
+
return Array.isArray(session?.log) ? session.log.slice(-40) : [];
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function liveViewEnvironmentRuntime(target, session) {
|
|
329
|
+
return session?.runtime || target?.runtime || null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function liveViewEnvironmentManagedRuntime(target, session) {
|
|
333
|
+
return session?.managedRuntime || target?.managedRuntime || target?.command?.managedRuntime || null;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export function buildLiveViewEnvironment({ target = null, session = null } = {}) {
|
|
337
|
+
const mode = liveViewEnvironmentMode(target, session);
|
|
338
|
+
const status = liveViewEnvironmentStatus(target, session);
|
|
339
|
+
const command = liveViewEnvironmentCommand(target, session);
|
|
340
|
+
const framework = session?.framework || target?.framework || null;
|
|
341
|
+
const label = session?.label || target?.label || framework || 'Live View';
|
|
342
|
+
const runtime = liveViewEnvironmentRuntime(target, session);
|
|
343
|
+
const managedRuntime = liveViewEnvironmentManagedRuntime(target, session);
|
|
344
|
+
const logs = liveViewEnvironmentLogs(session);
|
|
345
|
+
const reason = session?.error || target?.reason || null;
|
|
346
|
+
|
|
347
|
+
return {
|
|
348
|
+
id: mode === 'unavailable' ? 'live-view-unavailable' : `live-view-${mode}`,
|
|
349
|
+
mode,
|
|
350
|
+
status,
|
|
351
|
+
framework,
|
|
352
|
+
label,
|
|
353
|
+
command,
|
|
354
|
+
runtime,
|
|
355
|
+
managedRuntime,
|
|
356
|
+
port: session?.port ?? null,
|
|
357
|
+
upstreamUrl: session?.upstreamUrl ?? null,
|
|
358
|
+
sharePath: session?.sharePath ?? null,
|
|
359
|
+
logs,
|
|
360
|
+
diagnostics: {
|
|
361
|
+
runnerKind: session?.kind || target?.kind || 'none',
|
|
362
|
+
targetAvailable: Boolean(target?.available || session),
|
|
363
|
+
reason,
|
|
364
|
+
error: session?.error || null,
|
|
365
|
+
exitCode: session?.exitCode ?? null,
|
|
366
|
+
exitSignal: session?.exitSignal ?? null,
|
|
367
|
+
spawnErrorCode: session?.spawnErrorCode ?? null,
|
|
368
|
+
startedAt: session?.startedAt || null,
|
|
369
|
+
stoppedAt: session?.stoppedAt || null,
|
|
370
|
+
readyTimeoutMs: READY_TIMEOUT_MS,
|
|
371
|
+
staticServing: mode === 'static',
|
|
372
|
+
customCommand: command?.custom === true,
|
|
373
|
+
publicTunnelReady: false,
|
|
374
|
+
},
|
|
375
|
+
tunnel: {
|
|
376
|
+
status: 'local-only',
|
|
377
|
+
url: null,
|
|
378
|
+
},
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
|
|
297
382
|
function detectPackageCommand(packageJson, packageManager) {
|
|
298
383
|
const scripts = packageJson.scripts || {};
|
|
299
384
|
const devScript = String(scripts.dev || '');
|
|
@@ -648,11 +733,7 @@ function publicSession(session) {
|
|
|
648
733
|
kind: session.kind,
|
|
649
734
|
framework: session.framework,
|
|
650
735
|
label: session.label,
|
|
651
|
-
command: session.command
|
|
652
|
-
id: session.command.id,
|
|
653
|
-
label: session.command.label,
|
|
654
|
-
displayCommand: session.command.displayCommand,
|
|
655
|
-
} : null,
|
|
736
|
+
command: publicCommand(session.command),
|
|
656
737
|
runtime: session.runtime || null,
|
|
657
738
|
managedRuntime: session.managedRuntime || null,
|
|
658
739
|
port: session.port,
|
|
@@ -670,9 +751,11 @@ function publicSession(session) {
|
|
|
670
751
|
export async function getLiveViewState(projectName, projectPath) {
|
|
671
752
|
const target = await detectLiveViewTarget(projectPath);
|
|
672
753
|
const session = sessionsByProject.get(projectName) ?? null;
|
|
754
|
+
const publicLiveViewSession = publicSession(session);
|
|
673
755
|
return {
|
|
674
756
|
target,
|
|
675
|
-
session:
|
|
757
|
+
session: publicLiveViewSession,
|
|
758
|
+
environment: buildLiveViewEnvironment({ target, session: publicLiveViewSession }),
|
|
676
759
|
};
|
|
677
760
|
}
|
|
678
761
|
|
|
@@ -697,6 +780,7 @@ export async function startLiveView(projectName, projectPath, options = {}) {
|
|
|
697
780
|
command: customCommand,
|
|
698
781
|
args: [],
|
|
699
782
|
displayCommand: customCommand,
|
|
783
|
+
custom: true,
|
|
700
784
|
shell: true,
|
|
701
785
|
},
|
|
702
786
|
}
|