@stim-cli/core 1.10.1 → 1.12.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/dist/state.d.mts +108 -1
- package/dist/state.mjs +128 -3
- package/package.json +1 -1
package/dist/state.d.mts
CHANGED
|
@@ -25,6 +25,7 @@ interface AndroidDeviceRecord {
|
|
|
25
25
|
deviceName?: string | null;
|
|
26
26
|
owned?: boolean;
|
|
27
27
|
setupIncomplete?: boolean;
|
|
28
|
+
bootPending?: boolean;
|
|
28
29
|
[key: string]: unknown;
|
|
29
30
|
}
|
|
30
31
|
type DeviceRecord = IosDeviceRecord | AndroidDeviceRecord;
|
|
@@ -72,6 +73,7 @@ interface StimConfig {
|
|
|
72
73
|
repos: Record<string, RepoRecord>;
|
|
73
74
|
tempDir?: unknown;
|
|
74
75
|
iosSimulatorApp?: unknown;
|
|
76
|
+
androidEmulatorApp?: unknown;
|
|
75
77
|
optimizations?: unknown;
|
|
76
78
|
concurrency?: {
|
|
77
79
|
maxBuilds?: unknown;
|
|
@@ -249,6 +251,7 @@ declare function sharedCcache(): string;
|
|
|
249
251
|
declare function sharedGradle(): string;
|
|
250
252
|
declare function sharedPods(): string;
|
|
251
253
|
declare function createdDevicesFile(): string;
|
|
254
|
+
declare function gitMergeCacheDir(): string;
|
|
252
255
|
declare function createdDevicesLock(): string;
|
|
253
256
|
/** The EAS session ledger lives under the real home directory, never under STIM_HOME. */
|
|
254
257
|
declare function easMachineStateRoot(): string;
|
|
@@ -294,6 +297,7 @@ type SettingType = {
|
|
|
294
297
|
* `.stim.json` instead of the app's. A `sensitive` value is never printed and is
|
|
295
298
|
* written to `.stim.json` only as an `env:` or `file:` reference. `scopedHomeValue`
|
|
296
299
|
* replaces every layer and the default while STIM_HOME is set and `env` is not.
|
|
300
|
+
* `desktopDefault` replaces `default` on macOS while Stim Desktop is installed.
|
|
297
301
|
*/
|
|
298
302
|
interface SettingDefinition {
|
|
299
303
|
key: string;
|
|
@@ -305,6 +309,7 @@ interface SettingDefinition {
|
|
|
305
309
|
sensitive?: boolean;
|
|
306
310
|
committedAt?: "repository";
|
|
307
311
|
scopedHomeValue?: number;
|
|
312
|
+
desktopDefault?: string;
|
|
308
313
|
}
|
|
309
314
|
interface SettingEntry {
|
|
310
315
|
key: string;
|
|
@@ -316,6 +321,7 @@ interface SettingEntry {
|
|
|
316
321
|
value: string;
|
|
317
322
|
};
|
|
318
323
|
sensitive?: true;
|
|
324
|
+
defaultReason?: string;
|
|
319
325
|
}
|
|
320
326
|
/** The payload `stim settings --json` prints. */
|
|
321
327
|
interface SettingsPayload {
|
|
@@ -331,6 +337,7 @@ interface SettingsPayload {
|
|
|
331
337
|
}
|
|
332
338
|
declare const REMOTE_DEVICE_BACKENDS: readonly RemoteDeviceBackend[];
|
|
333
339
|
declare const IOS_SIMULATOR_APPS: readonly ["xcode", "siniulator", "stim-desktop"];
|
|
340
|
+
declare const ANDROID_EMULATOR_APPS: readonly ["emulator", "stim-desktop"];
|
|
334
341
|
declare const SETTINGS: readonly SettingDefinition[];
|
|
335
342
|
declare function settingDefinition(key: string): SettingDefinition | null;
|
|
336
343
|
declare function isLayeredSetting(setting: SettingDefinition): boolean;
|
|
@@ -377,6 +384,9 @@ interface IdleStopRecord {
|
|
|
377
384
|
idleMinutes: number;
|
|
378
385
|
}
|
|
379
386
|
declare function readIdleStop(state: WorkspaceState | null | undefined): IdleStopRecord | null;
|
|
387
|
+
/** Each platform's latest run; `lastBuild` holds whichever platform ran last. */
|
|
388
|
+
declare const LAST_BUILD_KEYS: Readonly<Record<StatsPlatform, string>>;
|
|
389
|
+
declare function readLastBuilds(state: WorkspaceState | null | undefined): Partial<Record<StatsPlatform, LastBuildReport>>;
|
|
380
390
|
declare function readWorkspaceState(root: string): WorkspaceState | null;
|
|
381
391
|
declare function lastUseFrom(state: WorkspaceState | null, logMtimes: readonly number[]): number;
|
|
382
392
|
declare function workspaceLastUsed(root: string): number;
|
|
@@ -399,6 +409,68 @@ interface BuildReport {
|
|
|
399
409
|
expectedPhaseMs: number | null;
|
|
400
410
|
basis: number;
|
|
401
411
|
}
|
|
412
|
+
/** Where a build's app came from: a cache tier, or `false` when it compiled or failed before one was found. */
|
|
413
|
+
type BuildCacheHit = "local" | "remote" | false;
|
|
414
|
+
/** A platform's most recent `ios` or `android` run in one workspace. */
|
|
415
|
+
interface LastBuildReport {
|
|
416
|
+
platform: StatsPlatform;
|
|
417
|
+
status: "ok" | "failed";
|
|
418
|
+
cacheHit: BuildCacheHit;
|
|
419
|
+
cacheSkipped: boolean;
|
|
420
|
+
durationMs: number | null;
|
|
421
|
+
fingerprint: string | null;
|
|
422
|
+
startedAt: string;
|
|
423
|
+
finishedAt: string | null;
|
|
424
|
+
errorCode?: string;
|
|
425
|
+
missReason?: BuildMissReason;
|
|
426
|
+
}
|
|
427
|
+
/** What kind of native input a changed fingerprint source is. */
|
|
428
|
+
type BuildMissCategory = "native-dependency" | "config-plugin" | "app-config" | "app-asset" | "package" | "native-dir" | "autolinking" | "package-scripts" | "file" | "other";
|
|
429
|
+
interface BuildMissChange {
|
|
430
|
+
source: string;
|
|
431
|
+
change: "added" | "removed" | "changed";
|
|
432
|
+
category: BuildMissCategory;
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Why a run compiled instead of installing a cached app. `changes` holds at most 20 entries,
|
|
436
|
+
* ordered by importance; `changeCount` is the full number of changed fingerprint sources.
|
|
437
|
+
* Only a plan reports `prebuild-pending`: the run would prebuild before compiling, so the changes
|
|
438
|
+
* compare the fingerprint before that prebuild.
|
|
439
|
+
*/
|
|
440
|
+
interface BuildMissReason {
|
|
441
|
+
kind: "changed" | "no-baseline" | "same-sources" | "cache-skipped" | "fingerprint-error" | "prebuild-pending";
|
|
442
|
+
summary: string;
|
|
443
|
+
changes: BuildMissChange[];
|
|
444
|
+
changeCount: number;
|
|
445
|
+
/** `cacheKey` is kept in workspace state so a later miss can find this baseline; status omits it. */
|
|
446
|
+
baseline: {
|
|
447
|
+
fingerprint: string;
|
|
448
|
+
cacheKey?: string;
|
|
449
|
+
from: "workspace" | "project";
|
|
450
|
+
} | null;
|
|
451
|
+
rekeyedBy: string[];
|
|
452
|
+
}
|
|
453
|
+
/** The payload `stim ios --plan --json` and `stim android --plan --json` print. */
|
|
454
|
+
interface BuildPlanPayload {
|
|
455
|
+
platform: StatsPlatform;
|
|
456
|
+
slot?: string;
|
|
457
|
+
fingerprint: string;
|
|
458
|
+
cacheKey: string | null;
|
|
459
|
+
cacheHit: BuildCacheHit;
|
|
460
|
+
provider: string | null;
|
|
461
|
+
cacheSkipped: boolean;
|
|
462
|
+
prebuild: "none" | "generate" | "regenerate" | "refuse" | null;
|
|
463
|
+
outcome: RunOutcomeKind | null;
|
|
464
|
+
expectedMs: number | null;
|
|
465
|
+
basis: number;
|
|
466
|
+
/** On a predicted miss with cache reads on, why the cache has no app; `baseline` omits `cacheKey`. */
|
|
467
|
+
missReason?: BuildMissReason;
|
|
468
|
+
refusal?: {
|
|
469
|
+
code: string;
|
|
470
|
+
message: string;
|
|
471
|
+
remedy: string;
|
|
472
|
+
};
|
|
473
|
+
}
|
|
402
474
|
type ActivityState = "driven" | "active" | "idle" | "unknown";
|
|
403
475
|
interface ActivityDriver {
|
|
404
476
|
tool: string;
|
|
@@ -411,10 +483,27 @@ interface DeviceActivity {
|
|
|
411
483
|
lastActivityAt?: string;
|
|
412
484
|
basis: string[];
|
|
413
485
|
}
|
|
486
|
+
/**
|
|
487
|
+
* A linked worktree's `git status`. `changed` counts tracked paths with staged or unstaged changes, including
|
|
488
|
+
* conflicts; `untracked` counts untracked entries as `git status` lists them, so an untracked directory counts once.
|
|
489
|
+
* `ahead` and `behind` compare HEAD with `upstream`, and are null when there is no upstream or it no longer exists.
|
|
490
|
+
* `mergedInto` names the default branch (`origin/main`) when `gc` would consider the branch merged into it, judged
|
|
491
|
+
* from local refs without fetching.
|
|
492
|
+
*/
|
|
493
|
+
interface WorktreeGit {
|
|
494
|
+
changed: number;
|
|
495
|
+
untracked: number;
|
|
496
|
+
upstream: string | null;
|
|
497
|
+
ahead: number | null;
|
|
498
|
+
behind: number | null;
|
|
499
|
+
mergedInto: string | null;
|
|
500
|
+
}
|
|
414
501
|
interface WorktreeFacts {
|
|
415
502
|
path: string;
|
|
416
503
|
branch?: string;
|
|
417
504
|
repository?: string;
|
|
505
|
+
/** Null when git could not be read in time, or the worktree is in a folder status does not open. */
|
|
506
|
+
git?: WorktreeGit | null;
|
|
418
507
|
}
|
|
419
508
|
interface AndroidRuntimeFacts {
|
|
420
509
|
serial: string | null;
|
|
@@ -429,6 +518,21 @@ interface RemoteDeviceState {
|
|
|
429
518
|
startedAt: string | null;
|
|
430
519
|
webPreviewUrl: string | null;
|
|
431
520
|
}
|
|
521
|
+
/** Every code a status issue can carry. */
|
|
522
|
+
declare const STATUS_ISSUE_CODES: readonly ["port-not-ours", "sim-missing", "sim-without-metro", "avd-serial-changed", "avd-missing", "avd-not-detected", "avd-unchecked", "supervisor-unverified"];
|
|
523
|
+
type StatusIssueCode = (typeof STATUS_ISSUE_CODES)[number];
|
|
524
|
+
/**
|
|
525
|
+
* One thing in a workspace that needs the user. `remedy` is a command to run from `workspace`; `slot` is absent
|
|
526
|
+
* for the default device slot. `warnings` carries the same issues as text.
|
|
527
|
+
*/
|
|
528
|
+
interface StatusIssue {
|
|
529
|
+
code: StatusIssueCode;
|
|
530
|
+
severity: "error" | "warning";
|
|
531
|
+
message: string;
|
|
532
|
+
remedy: string;
|
|
533
|
+
workspace: string;
|
|
534
|
+
slot?: string;
|
|
535
|
+
}
|
|
432
536
|
interface EnvironmentState {
|
|
433
537
|
slots?: {
|
|
434
538
|
slot: string;
|
|
@@ -439,6 +543,7 @@ interface EnvironmentState {
|
|
|
439
543
|
live: boolean;
|
|
440
544
|
memoryMb: number;
|
|
441
545
|
warnings: string[];
|
|
546
|
+
issues: StatusIssue[];
|
|
442
547
|
ios?: {
|
|
443
548
|
name: string | null;
|
|
444
549
|
udid: string;
|
|
@@ -452,6 +557,7 @@ interface EnvironmentState {
|
|
|
452
557
|
physical: boolean;
|
|
453
558
|
serial?: string | null;
|
|
454
559
|
state?: AndroidRuntimeFacts["state"];
|
|
560
|
+
deviceProfile?: string | null;
|
|
455
561
|
activity?: DeviceActivity;
|
|
456
562
|
} | null;
|
|
457
563
|
metro?: {
|
|
@@ -473,6 +579,7 @@ interface EnvironmentState {
|
|
|
473
579
|
worktree?: WorktreeFacts | null;
|
|
474
580
|
remoteDevices?: RemoteDeviceState[];
|
|
475
581
|
build?: BuildReport | null;
|
|
582
|
+
lastBuilds?: Partial<Record<StatsPlatform, LastBuildReport>>;
|
|
476
583
|
}
|
|
477
584
|
interface StatusCapacity {
|
|
478
585
|
liveCount: number;
|
|
@@ -504,4 +611,4 @@ interface StatusPayload {
|
|
|
504
611
|
simctlAvailable: boolean;
|
|
505
612
|
}
|
|
506
613
|
//#endregion
|
|
507
|
-
export { ANDROID_COMPILER_CACHE_CHOICES, ANDROID_PCH_CHOICES, ActiveBuildState, ActivityDriver, AndroidRuntimeFacts, BUILD_PHASES, BuildPhase, BuildReport, ConcurrencyLimits, Config, CreatedDevicePlatform, CreatedDevices, DeviceActivity, DeviceLeaseState, DeviceRecord, DoctorRunRecord, ERROR_SOURCES, EasSessionClaim, EasSessionLedgerRead, EnvironmentState, IDLE_STOP_KEY, IOS_SIMULATOR_APPS, IdleStopRecord, LEVELS, NdjsonRecord, PlatformRecords, ProjectRecord, QueryCriteria, REMOTE_DEVICE_BACKENDS, RemoteDeviceBackend, RemoteDeviceState, RepoRecord, RunOutcomeKind, SETTINGS, SETTINGS_SCHEMA_FILE, SETTINGS_SCHEMA_URL, SETTING_GROUPS, SETTING_SCOPES, SOURCES, SettingDefinition, SettingEntry, SettingScope, SettingType, SettingsObject, SettingsPayload, StatsPlatform, StatusCapacity, StatusPayload, StimConfig, SupervisorRecord, TUNNEL_MODES, TunnelMode, WorkspaceState, WorktreeFacts, acceptsShape, advanceTail, allMetroPorts, attachExpoErrorContext, buildCriteria, coerceSettingText, compileGrep, configCorruptRepair, configLockPath, createdDevicesFile, createdDevicesLock, easMachineStateRoot, easSessionLedgerFile, easSessionLedgerLock, emulatorLogFile, expectedShape, fileSizes, findEnclosingWorktreeRoot, findProjectByMetroPort, followLogs, getConcurrencyLimits, getConfigPath, getProject, getProjectSetting, getProjectSettings, getRepoSettings, isJsonObject, isLayeredSetting, isPathPrefix, isSensitiveReference, lastUseFrom, levelRank, loadConfig, logFiles, markerWindow, parseNdjsonLine, parseNdjsonText, parseSince, queryLogs, readCreatedDevices, readEasSessionLedger, readIdleStop, readJsonFile, readJsonObject, readLogRecords, readNdjsonGenerations, readWorkspaceState, recordMatches, settingDefinition, settingValueError, settingsJsonSchema, sharedCcache, sharedCompilationCache, sharedGradle, sharedPods, sortByTs, supervisorLogFile, supervisorPidFile, tailRead, validEasSessionClaim, withConfigLock, workspaceDerivedData, workspaceGradleBuild, workspaceLastUsed, workspaceLogErrorIndex, workspaceLogsDir, workspaceMetadataFile, workspaceStateFile, workspaceStateLock };
|
|
614
|
+
export { ANDROID_COMPILER_CACHE_CHOICES, ANDROID_EMULATOR_APPS, ANDROID_PCH_CHOICES, ActiveBuildState, ActivityDriver, AndroidRuntimeFacts, BUILD_PHASES, BuildCacheHit, BuildMissCategory, BuildMissChange, BuildMissReason, BuildPhase, BuildPlanPayload, BuildReport, ConcurrencyLimits, Config, CreatedDevicePlatform, CreatedDevices, DeviceActivity, DeviceLeaseState, DeviceRecord, DoctorRunRecord, ERROR_SOURCES, EasSessionClaim, EasSessionLedgerRead, EnvironmentState, IDLE_STOP_KEY, IOS_SIMULATOR_APPS, IdleStopRecord, LAST_BUILD_KEYS, LEVELS, LastBuildReport, NdjsonRecord, PlatformRecords, ProjectRecord, QueryCriteria, REMOTE_DEVICE_BACKENDS, RemoteDeviceBackend, RemoteDeviceState, RepoRecord, RunOutcomeKind, SETTINGS, SETTINGS_SCHEMA_FILE, SETTINGS_SCHEMA_URL, SETTING_GROUPS, SETTING_SCOPES, SOURCES, STATUS_ISSUE_CODES, SettingDefinition, SettingEntry, SettingScope, SettingType, SettingsObject, SettingsPayload, StatsPlatform, StatusCapacity, StatusIssue, StatusIssueCode, StatusPayload, StimConfig, SupervisorRecord, TUNNEL_MODES, TunnelMode, WorkspaceState, WorktreeFacts, WorktreeGit, acceptsShape, advanceTail, allMetroPorts, attachExpoErrorContext, buildCriteria, coerceSettingText, compileGrep, configCorruptRepair, configLockPath, createdDevicesFile, createdDevicesLock, easMachineStateRoot, easSessionLedgerFile, easSessionLedgerLock, emulatorLogFile, expectedShape, fileSizes, findEnclosingWorktreeRoot, findProjectByMetroPort, followLogs, getConcurrencyLimits, getConfigPath, getProject, getProjectSetting, getProjectSettings, getRepoSettings, gitMergeCacheDir, isJsonObject, isLayeredSetting, isPathPrefix, isSensitiveReference, lastUseFrom, levelRank, loadConfig, logFiles, markerWindow, parseNdjsonLine, parseNdjsonText, parseSince, queryLogs, readCreatedDevices, readEasSessionLedger, readIdleStop, readJsonFile, readJsonObject, readLastBuilds, readLogRecords, readNdjsonGenerations, readWorkspaceState, recordMatches, settingDefinition, settingValueError, settingsJsonSchema, sharedCcache, sharedCompilationCache, sharedGradle, sharedPods, sortByTs, supervisorLogFile, supervisorPidFile, tailRead, validEasSessionClaim, withConfigLock, workspaceDerivedData, workspaceGradleBuild, workspaceLastUsed, workspaceLogErrorIndex, workspaceLogsDir, workspaceMetadataFile, workspaceStateFile, workspaceStateLock };
|
package/dist/state.mjs
CHANGED
|
@@ -71,6 +71,9 @@ function sharedPods() {
|
|
|
71
71
|
function createdDevicesFile() {
|
|
72
72
|
return join(configDir(), "created-devices.json");
|
|
73
73
|
}
|
|
74
|
+
function gitMergeCacheDir() {
|
|
75
|
+
return join(configDir(), "git-merge");
|
|
76
|
+
}
|
|
74
77
|
function createdDevicesLock() {
|
|
75
78
|
return join(configDir(), "created-devices.lock");
|
|
76
79
|
}
|
|
@@ -302,7 +305,8 @@ const SOURCES = [
|
|
|
302
305
|
"metro",
|
|
303
306
|
"client",
|
|
304
307
|
"device",
|
|
305
|
-
"build"
|
|
308
|
+
"build",
|
|
309
|
+
"agent"
|
|
306
310
|
];
|
|
307
311
|
function levelRank(level) {
|
|
308
312
|
const i = LEVELS.indexOf(level);
|
|
@@ -669,6 +673,7 @@ const IOS_SIMULATOR_APPS = [
|
|
|
669
673
|
"siniulator",
|
|
670
674
|
"stim-desktop"
|
|
671
675
|
];
|
|
676
|
+
const ANDROID_EMULATOR_APPS = ["emulator", "stim-desktop"];
|
|
672
677
|
const PROJECT = [
|
|
673
678
|
"workspace",
|
|
674
679
|
"repo",
|
|
@@ -817,6 +822,13 @@ const SETTINGS = [
|
|
|
817
822
|
scopes: PROJECT,
|
|
818
823
|
description: "SDK system image for owned AVDs"
|
|
819
824
|
},
|
|
825
|
+
{
|
|
826
|
+
key: "android.deviceProfile",
|
|
827
|
+
type: STRING,
|
|
828
|
+
scopes: EVERY,
|
|
829
|
+
default: "pixel_6",
|
|
830
|
+
description: "avdmanager hardware profile id for new owned AVDs"
|
|
831
|
+
},
|
|
820
832
|
{
|
|
821
833
|
key: "android.dataPartitionSizeGb",
|
|
822
834
|
type: {
|
|
@@ -945,7 +957,19 @@ const SETTINGS = [
|
|
|
945
957
|
},
|
|
946
958
|
scopes: MACHINE,
|
|
947
959
|
default: "xcode",
|
|
948
|
-
|
|
960
|
+
desktopDefault: "stim-desktop",
|
|
961
|
+
description: "App that displays an owned iOS simulator; stim-desktop by default when Stim Desktop is installed"
|
|
962
|
+
},
|
|
963
|
+
{
|
|
964
|
+
key: "androidEmulatorApp",
|
|
965
|
+
type: {
|
|
966
|
+
kind: "choice",
|
|
967
|
+
choices: ANDROID_EMULATOR_APPS
|
|
968
|
+
},
|
|
969
|
+
scopes: MACHINE,
|
|
970
|
+
default: "emulator",
|
|
971
|
+
desktopDefault: "stim-desktop",
|
|
972
|
+
description: "App that displays an owned Android emulator Stim boots on macOS; stim-desktop by default when Stim Desktop is installed"
|
|
949
973
|
},
|
|
950
974
|
{
|
|
951
975
|
key: "concurrency.maxBuilds",
|
|
@@ -997,6 +1021,14 @@ const SETTINGS = [
|
|
|
997
1021
|
scopedHomeValue: 0,
|
|
998
1022
|
description: "Live workspaces before idle ones are reclaimed; unset or 0 means no limit"
|
|
999
1023
|
},
|
|
1024
|
+
{
|
|
1025
|
+
key: "gc.worktreeGraceMinutes",
|
|
1026
|
+
type: CAPACITY,
|
|
1027
|
+
scopes: MACHINE,
|
|
1028
|
+
default: 120,
|
|
1029
|
+
env: "STIM_GC_WORKTREE_GRACE_MINUTES",
|
|
1030
|
+
description: "Minutes after a linked worktree last changed, or its branch merged, before gc removes it; 0 removes it at once"
|
|
1031
|
+
},
|
|
1000
1032
|
{
|
|
1001
1033
|
key: "pool.iosParkedMax",
|
|
1002
1034
|
type: PARKED_MAX,
|
|
@@ -1227,6 +1259,17 @@ const BUILD_PHASES = [
|
|
|
1227
1259
|
"install",
|
|
1228
1260
|
"launch"
|
|
1229
1261
|
];
|
|
1262
|
+
/** Every code a status issue can carry. */
|
|
1263
|
+
const STATUS_ISSUE_CODES = [
|
|
1264
|
+
"port-not-ours",
|
|
1265
|
+
"sim-missing",
|
|
1266
|
+
"sim-without-metro",
|
|
1267
|
+
"avd-serial-changed",
|
|
1268
|
+
"avd-missing",
|
|
1269
|
+
"avd-not-detected",
|
|
1270
|
+
"avd-unchecked",
|
|
1271
|
+
"supervisor-unverified"
|
|
1272
|
+
];
|
|
1230
1273
|
//#endregion
|
|
1231
1274
|
//#region state/workspace-state.ts
|
|
1232
1275
|
const IDLE_STOP_KEY = "devServerStop";
|
|
@@ -1239,6 +1282,88 @@ function readIdleStop(state) {
|
|
|
1239
1282
|
idleMinutes: record.idleMinutes
|
|
1240
1283
|
};
|
|
1241
1284
|
}
|
|
1285
|
+
/** Each platform's latest run; `lastBuild` holds whichever platform ran last. */
|
|
1286
|
+
const LAST_BUILD_KEYS = {
|
|
1287
|
+
ios: "lastIosBuild",
|
|
1288
|
+
android: "lastAndroidBuild"
|
|
1289
|
+
};
|
|
1290
|
+
const MISS_KINDS = /* @__PURE__ */ new Set([
|
|
1291
|
+
"changed",
|
|
1292
|
+
"no-baseline",
|
|
1293
|
+
"same-sources",
|
|
1294
|
+
"cache-skipped",
|
|
1295
|
+
"fingerprint-error"
|
|
1296
|
+
]);
|
|
1297
|
+
const MISS_CATEGORIES = /* @__PURE__ */ new Set([
|
|
1298
|
+
"native-dependency",
|
|
1299
|
+
"config-plugin",
|
|
1300
|
+
"app-config",
|
|
1301
|
+
"app-asset",
|
|
1302
|
+
"package",
|
|
1303
|
+
"native-dir",
|
|
1304
|
+
"autolinking",
|
|
1305
|
+
"package-scripts",
|
|
1306
|
+
"file",
|
|
1307
|
+
"other"
|
|
1308
|
+
]);
|
|
1309
|
+
const MISS_CHANGE_CAP = 20;
|
|
1310
|
+
function missChange(value) {
|
|
1311
|
+
if (!value || typeof value !== "object") return null;
|
|
1312
|
+
const { source, change, category } = value;
|
|
1313
|
+
if (typeof source !== "string" || change !== "added" && change !== "removed" && change !== "changed") return null;
|
|
1314
|
+
return {
|
|
1315
|
+
source,
|
|
1316
|
+
change,
|
|
1317
|
+
category: typeof category === "string" && MISS_CATEGORIES.has(category) ? category : "other"
|
|
1318
|
+
};
|
|
1319
|
+
}
|
|
1320
|
+
function missReason(value) {
|
|
1321
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1322
|
+
const record = value;
|
|
1323
|
+
if (typeof record.kind !== "string" || !MISS_KINDS.has(record.kind) || typeof record.summary !== "string") return null;
|
|
1324
|
+
const changes = (Array.isArray(record.changes) ? record.changes : []).map(missChange).filter((change) => change !== null).slice(0, MISS_CHANGE_CAP);
|
|
1325
|
+
const baseline = record.baseline;
|
|
1326
|
+
return {
|
|
1327
|
+
kind: record.kind,
|
|
1328
|
+
summary: record.summary,
|
|
1329
|
+
changes,
|
|
1330
|
+
changeCount: Number.isInteger(record.changeCount) && record.changeCount >= changes.length ? record.changeCount : changes.length,
|
|
1331
|
+
baseline: baseline && typeof baseline.fingerprint === "string" && (baseline.from === "workspace" || baseline.from === "project") ? {
|
|
1332
|
+
fingerprint: baseline.fingerprint,
|
|
1333
|
+
from: baseline.from
|
|
1334
|
+
} : null,
|
|
1335
|
+
rekeyedBy: Array.isArray(record.rekeyedBy) ? record.rekeyedBy.filter((step) => typeof step === "string") : []
|
|
1336
|
+
};
|
|
1337
|
+
}
|
|
1338
|
+
function lastBuildReport(platform, value) {
|
|
1339
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return null;
|
|
1340
|
+
const record = value;
|
|
1341
|
+
if (record.platform !== platform || record.status !== "ok" && record.status !== "failed") return null;
|
|
1342
|
+
if (typeof record.startedAt !== "string") return null;
|
|
1343
|
+
const durationMs = typeof record.durationMs === "number" && record.durationMs >= 0 ? record.durationMs : null;
|
|
1344
|
+
const finished = new Date(Date.parse(record.startedAt) + (durationMs ?? NaN));
|
|
1345
|
+
const reason = record.cacheHit === "local" || record.cacheHit === "remote" ? null : missReason(record.missReason);
|
|
1346
|
+
return {
|
|
1347
|
+
platform,
|
|
1348
|
+
status: record.status,
|
|
1349
|
+
cacheHit: record.cacheHit === "local" || record.cacheHit === "remote" ? record.cacheHit : false,
|
|
1350
|
+
cacheSkipped: record.cacheSkipped === true,
|
|
1351
|
+
durationMs,
|
|
1352
|
+
fingerprint: typeof record.fingerprint === "string" ? record.fingerprint : null,
|
|
1353
|
+
startedAt: record.startedAt,
|
|
1354
|
+
finishedAt: Number.isNaN(finished.getTime()) ? null : finished.toISOString(),
|
|
1355
|
+
...typeof record.errorCode === "string" ? { errorCode: record.errorCode } : {},
|
|
1356
|
+
...reason ? { missReason: reason } : {}
|
|
1357
|
+
};
|
|
1358
|
+
}
|
|
1359
|
+
function readLastBuilds(state) {
|
|
1360
|
+
const reports = {};
|
|
1361
|
+
for (const platform of ["ios", "android"]) {
|
|
1362
|
+
const [report] = [lastBuildReport(platform, state?.[LAST_BUILD_KEYS[platform]]), lastBuildReport(platform, state?.lastBuild)].filter((candidate) => candidate !== null).toSorted((a, b) => (Date.parse(b.startedAt) || 0) - (Date.parse(a.startedAt) || 0));
|
|
1363
|
+
if (report) reports[platform] = report;
|
|
1364
|
+
}
|
|
1365
|
+
return reports;
|
|
1366
|
+
}
|
|
1242
1367
|
function readWorkspaceState(root) {
|
|
1243
1368
|
return readJsonObject(workspaceStateFile(root));
|
|
1244
1369
|
}
|
|
@@ -1266,4 +1391,4 @@ function workspaceLastUsed(root) {
|
|
|
1266
1391
|
return lastUseFrom(readWorkspaceState(root), mtimes);
|
|
1267
1392
|
}
|
|
1268
1393
|
//#endregion
|
|
1269
|
-
export { ANDROID_COMPILER_CACHE_CHOICES, ANDROID_PCH_CHOICES, BUILD_PHASES, ERROR_SOURCES, IDLE_STOP_KEY, IOS_SIMULATOR_APPS, LEVELS, REMOTE_DEVICE_BACKENDS, SETTINGS, SETTINGS_SCHEMA_FILE, SETTINGS_SCHEMA_URL, SETTING_GROUPS, SETTING_SCOPES, SOURCES, TUNNEL_MODES, acceptsShape, advanceTail, allMetroPorts, attachExpoErrorContext, buildCriteria, coerceSettingText, compileGrep, configCorruptRepair, configLockPath, createdDevicesFile, createdDevicesLock, easMachineStateRoot, easSessionLedgerFile, easSessionLedgerLock, emulatorLogFile, expectedShape, fileSizes, findEnclosingWorktreeRoot, findProjectByMetroPort, followLogs, getConcurrencyLimits, getConfigPath, getProject, getProjectSetting, getProjectSettings, getRepoSettings, isJsonObject, isLayeredSetting, isPathPrefix, isSensitiveReference, lastUseFrom, levelRank, loadConfig, logFiles, markerWindow, parseNdjsonLine, parseNdjsonText, parseSince, queryLogs, readCreatedDevices, readEasSessionLedger, readIdleStop, readJsonFile, readJsonObject, readLogRecords, readNdjsonGenerations, readWorkspaceState, recordMatches, settingDefinition, settingValueError, settingsJsonSchema, sharedCcache, sharedCompilationCache, sharedGradle, sharedPods, sortByTs, supervisorLogFile, supervisorPidFile, tailRead, validEasSessionClaim, withConfigLock, workspaceDerivedData, workspaceGradleBuild, workspaceLastUsed, workspaceLogErrorIndex, workspaceLogsDir, workspaceMetadataFile, workspaceStateFile, workspaceStateLock };
|
|
1394
|
+
export { ANDROID_COMPILER_CACHE_CHOICES, ANDROID_EMULATOR_APPS, ANDROID_PCH_CHOICES, BUILD_PHASES, ERROR_SOURCES, IDLE_STOP_KEY, IOS_SIMULATOR_APPS, LAST_BUILD_KEYS, LEVELS, REMOTE_DEVICE_BACKENDS, SETTINGS, SETTINGS_SCHEMA_FILE, SETTINGS_SCHEMA_URL, SETTING_GROUPS, SETTING_SCOPES, SOURCES, STATUS_ISSUE_CODES, TUNNEL_MODES, acceptsShape, advanceTail, allMetroPorts, attachExpoErrorContext, buildCriteria, coerceSettingText, compileGrep, configCorruptRepair, configLockPath, createdDevicesFile, createdDevicesLock, easMachineStateRoot, easSessionLedgerFile, easSessionLedgerLock, emulatorLogFile, expectedShape, fileSizes, findEnclosingWorktreeRoot, findProjectByMetroPort, followLogs, getConcurrencyLimits, getConfigPath, getProject, getProjectSetting, getProjectSettings, getRepoSettings, gitMergeCacheDir, isJsonObject, isLayeredSetting, isPathPrefix, isSensitiveReference, lastUseFrom, levelRank, loadConfig, logFiles, markerWindow, parseNdjsonLine, parseNdjsonText, parseSince, queryLogs, readCreatedDevices, readEasSessionLedger, readIdleStop, readJsonFile, readJsonObject, readLastBuilds, readLogRecords, readNdjsonGenerations, readWorkspaceState, recordMatches, settingDefinition, settingValueError, settingsJsonSchema, sharedCcache, sharedCompilationCache, sharedGradle, sharedPods, sortByTs, supervisorLogFile, supervisorPidFile, tailRead, validEasSessionClaim, withConfigLock, workspaceDerivedData, workspaceGradleBuild, workspaceLastUsed, workspaceLogErrorIndex, workspaceLogsDir, workspaceMetadataFile, workspaceStateFile, workspaceStateLock };
|